[Thread Prev][Thread Next][Index]

Re: [ferret_users] india boundary



Hi
Thank you for that resource, Patrick.

Once you have the outline and have verified it using PLOT/VS, Patrick's message shows how to use the POLYGON command to plot the shape. Another option is the function pt_in_poly,
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/appendix-a-external-functions/pt_in_poly/

which would let you make a mask which is 1 at every grid location inside the polygon and missing outside it; so you could do calculations or graphics over only the region inside the border.

Ansley

On 2/7/2012 11:29 AM, Brockmann Patrick wrote:
nitin patil a écrit :
Dear ferret users,
Did any one knows how to give a border to India country if we have to plot only India.
if possible can we  border states also?

Hi,

I have done this recently using kml files distributed
by the "Global Administrative Areas" website.

Please follow the different steps:

1) From http://www.gadm.org
Go in the Download section, select the country
and choose "Google Earth .kmz"

After the download, you can have a look to the kmz file
with googleearth of course.
Unzip the kmz file. You should obtain a kml file.

2) Convert the kml file to a text with
3 columns lon,lat,number (number is the
index representing the area) with the python
script attached.

3) Use the ferret plot.jnl script to validate and
save the polygons as a netcdf file.

Here is an example with India with the first
2 administratives levels.

$ unzip IND_adm1.kmz
$ ./convert_kml.py IND_adm1.kml > IND_adm1.dat
$ ferret
yes? go plot.jnl IND_adm1.dat IND_adm1.nc

Note: that when I try to do the same with IND_adm0.dat,
ferret restarts my X11 server !
The problem occurs at line
repeat/name=n/range=1:`numb[i=@max]` ( def sym n=`n` ; let lon1=if numb eq `n` then lon ; let lat1=if numb eq `n` then lat ; polygon/line/fill/o/nolab/lev=(1,200,1)/pal=thirty_by_levels.spk lon1,lat1,`n` ; PPL SHASET RESET )

But the method is still ok, just do not not blindly
use polygon command but rather plot/vs.
There may be a problem anyway.

Happy ferreting

Patrick



[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement