Importing variables from Netcdf into Python -
i new python, , have managed read in variables netcdf in python , plot them, size of variables isn't correct.
my dataset 144 x 90 (lon x lat) when call in variables, seems miss large section of data.
do need specify size of dataset i'm reading in? i'm doing wrong here?
here code using:
import netcdf4 netcdf4 import dataset pylab import * ncfile = dataset('dec3499.aije03ccek11p5a.nc','r') temp = ncfile.variables['tsurf'] prec = ncfile.variables['prec'] subplot(2,1,1) pcolor(temp) subplot(2,1,2) pcolor(prec) savefig('dec3499.png',optimize=true,quality=85) quit()
just clarify, here image showing output. there should data right far right hand side of box.
(http://img163.imageshack.us/img163/6900/screenshot20130520at112.png)
i figured out.
for interested, needed amend following lines pull in variables properly:
temp = ncfile.variables['tsurf'][:,:] prec = ncfile.variables['prec'][:,:]
thanks!
Comments
Post a Comment