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 like
I've search and tried everything there is. 
<http://matplotlib.1069221.n5.nabble.com/file/n43580/bad_fb.png> 

from scipy.io.netcdf import netcdf_file as Dataset
import numpy as np
import matplotlib.pyplot as plt

FB = Dataset('./datasets/fb-0217-0320.nc', 'r')
f = FB.variables['f'][:,:]
lat = FB.variables['lat'][:,0]
lon = FB.variables['lon'][0,:]
masked_fb = np.ma.masked_where(np.isnan(f), f)
mtx_lon, mtx_lat = np.meshgrid(lon, lat)
m = Basemap(projection='spstere',boundinglat=-50, lon_0=180.,
resolution='l')
m.bluemarble()

plt.figure()
m.pcolormesh(mtx_lon, mtx_lat, masked_fb, latlon=True)
plt.show()

And ncdump gives:
dimensions:
x = 79 ;
y = 83 ;
variables:
float lat(y, x) ;
    lat:standard_name = "latitude" ;
    lat:long_name = "latitude coordinate" ;
    lat:units = "degrees_north" ;
float lon(y, x) ;
    lon:standard_name = "longitude" ;
    lon:long_name = "longitude coordinate" ;
    lon:units = "degrees_east" ;
float f(y, x) ;
    f:long_name = "total_freeboard" ;
    f:units = "mm" ;
    f:coordinates = "lat lon" ;

Could there be something funny with the projection or handling the data?
(When using meshgrid, handling the coordinates like ['lat'][:,0] seems
necessary, otherwise it turns lats and lons like (6557,6557) and gives error
message for pcolormesh, since masked_fb is (83,79).)



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Data-plotting-in-a-wrong-place-tp43580.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to