Okay, so in the "variables" section, what you've got is a list of things which vary as a function of the "dimensions" listed in the previous section (time, nsr_delta, lat, lon). I don't remember which of the NetCDF file reading libraries you're using, but using Jeff's older netCDF3 interface, you could do something like:
nc_in = netCDF3.Dataset("outputfile.nc") And then that nc_in thing contains all the data that's contained in the file outputfile.nc, and you can read it into numpy arrays: Ttt_D = nc_in.variables['Ttt_D'][:,:,:] Tpt_D = nc_in.variables['Tpt_D'][:,:,:] Tpp_D = nc_in.variables['Tpp_D'][:,:,:] What that does is stick the north-south, shear, and east-west components of the Diurnal stresses into the three arrays. The [:,:,:] bit says "give me the data for all values of time, latitude and longitude". In order to turn those tensor components into the principal components, you need to, for each (t,lat,lon) set, diagonalize the matrices composed of the stress values: [ [ Ttt(t,lat,lon), Tpt(t,lat,lon) ], [ Tpt(t,lat,lon), Tpp(t,lat,lon) ] ] which you can do with np.eig() The (unit length) eigenvectors it returns will tell you what direction the principal components point, and the corresponding eigenvalues will tell you their magnitudes... which then have to get fed in to quiver(). Hopefully that helps at least a little? JPKay wrote: > > Hello, > > Now that I have correctly imported the NetCDF file and set up the kind of > projection I am interested in having the data displayed over I am having > trouble plotting my data with the quiver function. I am interested in > plotting the principal vectors of the stress field onto a Mercator > projection. > My netcdf file is telling me the following after "ncdump -h" > dimensions: > nsr_delta = 20 ; > time = 24 ; > latitude = 37 ; > longitude = 73 ; > variables: > float nsr_delta(nsr_delta) ; > nsr_delta:units = "" ; > nsr_delta:long_name = "NSR Surface Delta (mu/(eta*omega))" ; > float time(time) ; > time:units = "degrees" ; > time:long_name = "degrees after periapse" ; > float latitude(latitude) ; > latitude:units = "degrees_north" ; > latitude:long_name = "latitude" ; > float longitude(longitude) ; > longitude:units = "degrees_east" ; > longitude:long_name = "longitude" ; > float Ttt_D(time, latitude, longitude) ; > Ttt_D:units = "Pa" ; > Ttt_D:long_name = "north-south component stress of Diurnal > stresses" ; > float Tpt_D(time, latitude, longitude) ; > Tpt_D:units = "Pa" ; > Tpt_D:long_name = "shear component of Diurnal stresses" ; > float Tpp_D(time, latitude, longitude) ; > Tpp_D:units = "Pa" ; > Tpp_D:long_name = "east-west component of Diurnal stresses" ; > float Ttt_N(nsr_delta, latitude, longitude) ; > Ttt_N:units = "Pa" ; > Ttt_N:long_name = "north-south component of NSR stresses" ; > float Tpt_N(nsr_delta, latitude, longitude) ; > Tpt_N:units = "Pa" ; > Tpt_N:long_name = "shear component of NSR stresses" ; > float Tpp_N(nsr_delta, latitude, longitude) ; > Tpp_N:units = "Pa" ; > Tpp_N:long_name = "east-west component of NSR stresses" ; > > // global attributes: > :description = "Testing pySatStress on a regular grid" ; > :history = "Created: Mon Jun 15 12:46:13 2009 using > pySatStress" ; > :Conventions = "COARDS" ; > However, when I am strugglingto use the quiver_demo.py as a guide to > making my quiver plot. > Thanks for any help you can offer. > Jon > > -- View this message in context: http://www.nabble.com/Quiver-plot-of-a-netcdf-file-tp23986313p24046177.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users