Tank you very much for both solutions Phil,

with best regards,
Sudheer 
***************************************************************
Sudheer Joseph 
Indian National Centre for Ocean Information Services
Ministry of Earth Sciences, Govt. of India
POST BOX NO: 21, IDA Jeedeemetla P.O.
Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
E-mail:sjo.in...@gmail.com;sudheer.jos...@yahoo.com
Web- http://oppamthadathil.tripod.com
***************************************************************


________________________________
 From: Phil Elson <pelson....@gmail.com>
To: "Matplotlib-users@lists.sourceforge.net" 
<matplotlib-users@lists.sourceforge.net> 
Sent: Saturday, 2 March 2013 3:07 PM
Subject: Re: [Matplotlib-users] depth longitude plot
 

Perhaps something like:


from matplotlib import pyplot as plt
from netCDF4 import Dataset
import numpy as np


url='http://www.marine.csiro.au/dods/nph-dods/dods-data/climatology-netcdf/levitus_monthly_temp_98.nc'
ds = Dataset(url)


temp = ds.variables['TEMP']
lats = ds.variables['lat']
lons = ds.variables['lon']
depths = ds.variables['z']


# filter all but one latitude
lat_index = np.where(lats[:] == 0.5)[0][0]
lats = lats[lat_index]

# filter a range of longitudes
lon_lower_index = np.where(lons[:] == 44.5)[0][0]
lon_upper_index = np.where(lons[:] == 100.5)[0][0]
lons = lons[lon_lower_index:lon_upper_index]

temp = temp[0, :, lat_index, lon_lower_index:lon_upper_index]


plt.pcolormesh(lons, depths[:], temp)
plt.gca().invert_yaxis()

plt.show()




The indexing approach used here is quite flakey, so I certainly wouldn't use 
this in anything operational.

Hope this helps,

Phil

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to