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

<<attachment: figure_1.png>>

------------------------------------------------------------------------------
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