Map plotting using cdat

Hi ,

The following code will produce world map outline with orwithout continents .

we can zoom or place the specific country map using scaleof latitude and longitude.
<br>import vcs, cdms2, cdutil, time, os, sys<br><br># Open data file:<br>filepath = os.path.join(sys.prefix, 'sample_data/clt.nc')<br>cdmsfile = cdms2.open( filepath )<br><br># Extract a 3 dimensional data set and get a subset of the time dimension<br>#data = cdmsfile('clt', longitude=(-180, 180), latitude = (-180., 180.))<br>data = cdmsfile('clt', longitude=(60, 100), latitude = (5., 40.))&nbsp;&nbsp; # for india long(60,100) and lat(5,30) (5,40)&nbsp;&nbsp; , (60,94)&amp;(0,30) to hide black<br><br># Initial VCS.<br>v = vcs.init()<br><br># Assign the variable "cf_asd" to the persistent 'ASD' isofill graphics methods.<br>cf_asd = v.getboxfill( 'ASD' )<br><br># Generate a log10 boxfill graphics method plot<br>#cf_asd.boxfill_type='log10'&nbsp; # change the boxfill type to log10<br>cf_asd.datawc(1e20,1e20,1e20,1e20) # change to default region<br>#cf_asd.datawc(0,0,80,80)<br>cf_asd.level_1=1e20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # change to default minimum level<br>cf_asd.level_2=1e20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # change to default maximum level<br>cf_asd.color_1=240&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # change 1st color index value<br>cf_asd.color_2=240&nbsp;&nbsp; # change 2nd color index value<br><br>v.plot( data, cf_asd,continents=4 )# continents=4 for political region map&nbsp; , 0 for geographical region<br><br>print "Press the Return key to close."<br>sys.stdin.readline()<br>

Our India Map :

Our World Map :

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: