John wrote:
> Can anyone explain this??
>  
> >>> N.max(Zdat)  #this is numpy.max function
> 1302.73592859
> >>> zdat,x,y = 
> m.transform_scalar(Zdat,lons,lats,nx,ny,returnxy=True,order=0)
> >>> N.max (zdat)
> 0.0
> >>>
>  
> In this case, Zdat is my original array sent to my plotting function. 
> It seems to lose all it's data when I run transform_scalar. I've tried 
> it with order=1 as well, with the same result. Am I missing something?
>  
> I'm having a really hard time getting basemap to work using either 
> imshow or contourf. Any help would be greatly appreciated.
>  
> Thanks!

John:  I'll need more info about the Zdat array.  It should be a 2-D 
array on a lat/lon grid whose longitudes (the 2nd dimension) are given 
by the 1-d array lons, and whose latitudes (the first dimension) are 
given by the 1-d array lats.  lats and lons should be given in degrees.  
transform_scalar should then return an array of shape (ny,nx) on a 
regular grid in map projection coordinates.

Note that to use contourf you don't have to use transform_scalar, you 
can just plot the data on the original lat/lon grid.

Below is the transform_scalar docstring for reference:

    def 
transform_scalar(self,datin,lons,lats,nx,ny,returnxy=False,checkbounds=False,order=1,masked=False):
        """
 interpolate a scalar field (datin) from a lat/lon grid with longitudes =
 lons and latitudes = lats to a (ny,nx) native map projection grid.
 Typically used to transform data to map projection coordinates
 so it can be plotted on the map with imshow.

 lons, lats must be rank-1 arrays containing longitudes and latitudes
 (in degrees) of datin grid in increasing order
 (i.e. from dateline eastward, and South Pole northward).
 For non-cylindrical projections (those other than
 cylindrical equidistant, mercator and miller)
 lons must fit within range -180 to 180.

 if returnxy=True, the x and y values of the native map projection grid
 are also returned.

 If checkbounds=True, values of lons and lats are checked to see that
 they lie within the map projection region.  Default is False.
 If checkbounds=False, points outside map projection region will
 be clipped to values on the boundary if masked=False. If masked=True,
 the return value will be a masked array with those points masked.

 The order keyword can be 0 for nearest-neighbor interpolation,
 or 1 for bilinear interpolation (default 1)."""

-Jeff

-- 
Jeffrey S. Whitaker         Phone  : (303)497-6313
Meteorologist               FAX    : (303)497-6449
NOAA/OAR/PSD  R/PSD1        Email  : [EMAIL PROTECTED]
325 Broadway                Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web    : http://tinyurl.com/5telg


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to