On 2014/01/28 10:01 AM, A Short wrote:
> Hi - Ive now improved my code and confirmed the use of the right grib file
> but i cant for the life of me figure out the missing data near the
> coastline..? Could anyone help?

The present contouring algorithm works with rectangular blocks, and if 
any corner has missing data, nothing is filled for that block.

Eric

>
> `import Nio
> from mpl_toolkits.basemap import Basemap
> import matplotlib.pyplot as plt
> import numpy as np
>
> f = Nio.open_file('nww3.t12z.grib(2).grib2')
> lons = f.variables['lon_0'][:]
> lats = f.variables['lat_0'][::-1] # flip latitudes so data goes S-->N
> times = f.variables['forecast_time0'][:]
> ntime = 5
> data = f.variables['HTSGW_P0_L1_GLL0'][ntime,::-1]
>
> fig = plt.figure(figsize=(16,16))
> m = Basemap(llcrnrlon=-35.,llcrnrlat=42.,urcrnrlon=5.,urcrnrlat=65.,
>              projection='lcc',lat_1=10.,lat_2=15.,lon_0=10.,
>              resolution ='h',area_thresh=1000.)
>
> x, y = m(*np.meshgrid(lons, lats))
> m.fillcontinents(color='#477519')
> m.drawcoastlines(linewidth=0.5, color='k', antialiased=1, ax=None,
> zorder=None )
>
> m.contourf(x, y, data, np.arange(0,9.9,0.1))
> plt.show() `
>
> Resulting plot is here
> <http://matplotlib.1069221.n5.nabble.com/file/n42790/figure_7.png>
>
>
>
> --
> View this message in context: 
> http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42790.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import
> a virtual appliance and go from zero to informed in seconds.
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to