Re: [Matplotlib-users] Data plotting in a wrong place

2014-06-27 Thread Benjamin Root
actually, that is technically incorrect. That only works for monotonically increasing series, but not monotonically decreasing series. diffs = np.diff(lon) if np.all(diffs <= 0): return True if np.all(diffs >= 0): return True return False provided that len(lon) >= 2, obviously (and it doe

Re: [Matplotlib-users] Data plotting in a wrong place

2014-06-27 Thread Jason Swails
On Thu, 2014-06-26 at 23:14 -0700, billyi wrote: > Oh my, it WAS the meshgrid! Thank you so much! > When reading the coordinates like: > lat = FB.variables['lat'][:,:] > lon = FB.variables['lon'][:,:] > > And plotting (without meshgrid!): > m.pcolormesh(lon, lat, masked_fb, latlon=True) > > it w

Re: [Matplotlib-users] Data plotting in a wrong place

2014-06-27 Thread Joel B. Mohler
On 06/27/2014 02:14 AM, billyi wrote: > And I think the longitudes and latitudes are not monotonic, but I don't know > the way to check this, other than checking the array like lon[:] in > terminal. Is there a better way? numpy slicing (subtract prior from next element check that 'all' the result

Re: [Matplotlib-users] Data plotting in a wrong place

2014-06-26 Thread billyi
Oh my, it WAS the meshgrid! Thank you so much! When reading the coordinates like: lat = FB.variables['lat'][:,:] lon = FB.variables['lon'][:,:] And plotting (without meshgrid!): m.pcolormesh(lon, lat, masked_fb, latlon=True) it works! Now I feel stupid. And I think the longitudes and latitudes a

Re: [Matplotlib-users] Data plotting in a wrong place

2014-06-26 Thread Benjamin Root
don't know if this would make a difference, but meshgrid here is completely unnecessary given that the netcdf file has the lats and lons in 2 dimensions anyway. Given that this is a polar projection, I wouldn't be surprised if there is something wonky there. Are the longitudes and latitudes monoto

[Matplotlib-users] Data plotting in a wrong place

2014-06-26 Thread billyi
Hi all! I'm trying to plot some sea ice freeboard data (netCDF, Gridded total freeboard) on the Antarctic sea, but the data that should plot nicely around Antarctica lies at the bottom of my image. NetCDF and matplotlib are fairly new to me so I'm not quite sure, where the error could be and I feel