[Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-09 Thread Rolling Six
Hi im new to Python and basemap i am trying to follow the script below that was posted in another thread here but im getting this error alec@alec-imedia-S2870:~$ python Desktop/test.py /usr/lib/pymodules/python2.7/mpl_too

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-09 Thread Paul Hobson
As the error message says, the problem is on Line 14: print f.variables['WWSWHGT_P0_L1_GLL0'] a KeyError means that you tried to access an element that is not in a dictionary. In this case "f.variables" is the dictionary and "' WWSWHGT_P0_L1_GLL0'" is the element. Did your data and script come o

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-09 Thread A Short
Hi Paul, Thanks for your reply, I managed to fix it after I realised the mistake I was making. I've currently got a new problem. If you look at the image below, there's a lot of white showing up around the coasts which ideally I'd like to remove. The map is drawn using basemap, is there a functio

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-09 Thread Paul Hobson
I think you posted the same image in both cases. Without seeing the problematic image, I can only guess that it's caused by the resolution of your data. On Thu, Jan 9, 2014 at 7:58 AM, A Short wrote: > Hi Paul, > > Thanks for your reply, I managed to fix it after I realised the mistake I > was

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-09 Thread A Short
ok the file im using is this multi_2.glo_30m.t06z.grib2 from here im not sure its the right file to get wave heights of the North East Atlantic so im trying different ones. as you can see above in the top image there is som

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-09 Thread Paul Hobson
What I'm saying is that your top image and bottom image are identical and I don't see any white boxes in either. What is the resolution of the grid? -paul On Thu, Jan 9, 2014 at 11:59 AM, A Short wrote: > ok the file im using is this multi_2.glo_30m.t06z.grib2 from here >

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-09 Thread A Short
Thats strange they look different on this browser. Hopefully the one below youll see what i mean Thanks -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p4270

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-09 Thread Paul Hobson
How does it look if you remove the calls to `m.drawcoastlines()` and ` m.fillcontinents()`? On Thu, Jan 9, 2014 at 1:05 PM, A Short wrote: > Thats strange they look different on this browser. Hopefully the one below > youll see what i mean > > Thanks > >

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-09 Thread A Short
Ive also changed the grib file from multi_2.glo_30m.t06z.grib2 to nww3.t12z.grib.grib2 i still cant figure out which is the right file for the North East Atlantic neither...i wonder if my data source is wrong..? -- View this

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-09 Thread Paul Hobson
Looks like it's just a coarse resolution to me. Try showing the data as an image with no iterpolation. On Thu, Jan 9, 2014 at 3:26 PM, A Short wrote: > Ive also changed the grib file from multi_2.glo_30m.t06z.grib2 to > nww3.t12z.grib.grib2 i still cant figure out which is the right file for >

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-09 Thread A Short
Thanks Paul i added m.imshow(data, origin='lower', interpolation='none') Its made a little improvement but something still seems to be not right -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Plott

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-28 Thread A Short
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? `import Nio from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np f = Nio.open_file('

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-28 Thread Eric Firing
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 cor

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-29 Thread Ian Thomas
On 29 January 2014 03:21, Eric Firing wrote: > 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 contour

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-29 Thread A Short
Is there any work around so it looks like the below image? Could anyone confirm that this would be the correct grib file for The North Atlantic..? ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/wave/prod/wave.20140129/nww3.t06z.grib.grib2 Thanks for all the help

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-29 Thread Eric Firing
On 2014/01/28 11:40 PM, Ian Thomas wrote: > On 29 January 2014 03:21, Eric Firing > wrote: > > 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 figu

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-29 Thread Eric Firing
On 2014/01/29 5:41 AM, A Short wrote: > Is there any work around so it looks like the below image? It looks like with any reasonable contouring algorithm, this would require interpolating into land regions, contouring, and then plotting the land on top. The key is the interpolation, not the plo

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-29 Thread klo uo
IMHO that's the most straightforward approach. He can use masked array for empty blocks (if contour data doesn't already contain the holes as masked array) and apply inpainting, then draw the land. For more details about inpainting: http://stackoverflow.com/a/17125125/992005 On Wed, Jan 29, 2014

Re: [Matplotlib-users] Plotting NOAA grib2 data in basemap

2014-01-30 Thread A Short
Thanks Eric and Kio - ive been trying for a couple of days and i just cant seem to get my head around the interpolation or masked arrays. Would it be possible for anyone to give me a few pointers on where to start editing the script. Ive tried digesting these tutorials the first one seems to be re