Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Lionel Roubeyrie <lroubeyrie@li...>  20070420 07:56:26

hi all, is there a way to plot (contourf) a .grd file from GMT directly with Basema= p?=20 I have a problem with contourf because I can't reshape to 2D the Z values ,= x=20 and y are in Lambert projection, so I can't compute the shape :( thanks =2D=20 Lionel Roubeyrie  lroubeyrie@... Chag=C3=A9 d'=C3=A9tudes et de maintenance LIMAIR  la Surveillance de l'Air en Limousin http://www.limair.asso.fr 
From: Jeff Whitaker <jswhit@fa...>  20070420 11:12:03

Lionel Roubeyrie wrote: > hi all, > is there a way to plot (contourf) a .grd file from GMT directly with Basemap? > I have a problem with contourf because I can't reshape to 2D the Z values ,x > and y are in Lambert projection, so I can't compute the shape :( > thanks > > Lionel: No, not directly. You have to read in the x,y,z values and convert them to 2D arrays. You'll have to give more details on your problem  just because x,y are in Lambert projection coordinates doesn't mean you can't reshape z. Jeff  Jeffrey S. Whitaker Phone : (303)4976313 NOAA/OAR/CDC R/PSD1 FAX : (303)4976449 325 Broadway Boulder, CO, USA 803053328 
From: Lionel Roubeyrie <lroubeyrie@li...>  20070420 12:04:40

Hi Jeff, yes, lambert is not the problem, you're right. I have some .grd files with= =20 x,y,z values, and I want to project z values on maps and interpolate them. = I=20 don't have the dimensions of the shape, but with m.scatter(x, y, z), I see= =20 that the scatters are displayed in a regular grid. Then is there a way to=20 retrieve the dimensions of the resulting grid, and then I can reshape z to= =20 pass it to contourf?=20 I tried to convert x and y to degrees, hoping removing the duplicated entri= es=20 (with rouding) gives me the dimensions, but I also have a problem with=20 m(x,y,inverse=3DTrue), because the results are not good ( I use m =3D=20 Basemap(llcrnrlon=3D0.5, llcrnrlat=3D44.8, urcrnrlon=3D2.8, urcrnrlat=3D46.= 5,=20 projection=3D'lcc', lat_1=3D45.89891889,lat_2=3D47.69601444,lon_0=3D2.33722= 917)). thanks Le Vendredi 20 Avril 2007 13:11, Jeff Whitaker a =E9crit=A0: > Lionel Roubeyrie wrote: > > hi all, > > is there a way to plot (contourf) a .grd file from GMT directly with > > Basemap? I have a problem with contourf because I can't reshape to 2D t= he > > Z values ,x and y are in Lambert projection, so I can't compute the sha= pe > > :( thanks > > Lionel: No, not directly. You have to read in the x,y,z values and > convert them to 2D arrays. You'll have to give more details on your > problem  just because x,y are in Lambert projection coordinates doesn't > mean you can't reshape z. > > Jeff =2D=20 Lionel Roubeyrie  lroubeyrie@... Chag=E9 d'=E9tudes et de maintenance LIMAIR  la Surveillance de l'Air en Limousin http://www.limair.asso.fr 
From: Jeff Whitaker <jswhit@fa...>  20070420 12:58:59

Lionel Roubeyrie wrote: > Hi Jeff, > yes, lambert is not the problem, you're right. I have some .grd files with > x,y,z values, and I want to project z values on maps and interpolate them. I > don't have the dimensions of the shape, but with m.scatter(x, y, z), I see > that the scatters are displayed in a regular grid. Then is there a way to > retrieve the dimensions of the resulting grid, and then I can reshape z to > pass it to contourf? > I tried to convert x and y to degrees, hoping removing the duplicated entries > (with rouding) gives me the dimensions, but I also have a problem with > m(x,y,inverse=True), because the results are not good ( I use m = > Basemap(llcrnrlon=0.5, llcrnrlat=44.8, urcrnrlon=2.8, urcrnrlat=46.5, > projection='lcc', lat_1=45.89891889,lat_2=47.69601444,lon_0=2.33722917)). > thanks Lionel: Basemap assumes that x=0,y=0 is the lower left corner of the projection region. You may have to adjust the x,y values coming from your grd file accordingly. Jeff  Jeffrey S. Whitaker Phone : (303)4976313 NOAA/OAR/CDC R/PSD1 FAX : (303)4976449 325 Broadway Boulder, CO, USA 803053328 
From: Jeff Whitaker <jswhit@fa...>  20070420 12:55:10

Lionel Roubeyrie wrote: > Hi Jeff, > yes, lambert is not the problem, you're right. I have some .grd files with > x,y,z values, and I want to project z values on maps and interpolate them. I > don't have the dimensions of the shape, but with m.scatter(x, y, z), I see > that the scatters are displayed in a regular grid. Then is there a way to > retrieve the dimensions of the resulting grid, and then I can reshape z to > pass it to contourf? > Lionel: There should be an attribute or attributes in the netCDF file that specify the dimensions of the grid (at least there should be, according to the GMT documentation). > I tried to convert x and y to degrees, hoping removing the duplicated entries > (with rouding) gives me the dimensions, but I also have a problem with > m(x,y,inverse=True), because the results are not good ( I use m = > Basemap(llcrnrlon=0.5, llcrnrlat=44.8, urcrnrlon=2.8, urcrnrlat=46.5, > projection='lcc', lat_1=45.89891889,lat_2=47.69601444,lon_0=2.33722917)). > thanks > You shouldn't need to do that  just pass x,y and the reshaped z to contourf. You do need to know the parameters of the projection though. Jeff  Jeffrey S. Whitaker Phone : (303)4976313 NOAA/OAR/CDC R/PSD1 FAX : (303)4976449 325 Broadway Boulder, CO, USA 803053328 
From: Lionel Roubeyrie <lroubeyrie@li...>  20070420 14:39:00

By grd file, I mean csv like file, with one line by value, like X1 Y1 Z1 X2 Y1 Z2 X3 Y1 Z3 =2E.. X1 Y2 Zk X2 Y2 Zk+1 =2E.. Xi Yj Zn this is in geographic format, where there is a repetition in the X values a= nd=20 the Y values, because the grid is regular, but not in lambert projection,=20 then I can't retrieve the dimensions of the grid. Le Vendredi 20 Avril 2007 14:54, Jeff Whitaker a =E9crit=A0: > Lionel Roubeyrie wrote: > > Hi Jeff, > > yes, lambert is not the problem, you're right. I have some .grd files > > with x,y,z values, and I want to project z values on maps and interpola= te > > them. I don't have the dimensions of the shape, but with m.scatter(x, y, > > z), I see that the scatters are displayed in a regular grid. Then is > > there a way to retrieve the dimensions of the resulting grid, and then I > > can reshape z to pass it to contourf? > > Lionel: There should be an attribute or attributes in the netCDF file > that specify the dimensions of the grid (at least there should be, > according to the GMT documentation). > > > I tried to convert x and y to degrees, hoping removing the duplicated > > entries (with rouding) gives me the dimensions, but I also have a probl= em > > with m(x,y,inverse=3DTrue), because the results are not good ( I use m = =3D > > Basemap(llcrnrlon=3D0.5, llcrnrlat=3D44.8, urcrnrlon=3D2.8, urcrnrlat= =3D46.5, > > projection=3D'lcc', lat_1=3D45.89891889,lat_2=3D47.69601444,lon_0=3D2.3= 3722917)). > > thanks > > You shouldn't need to do that  just pass x,y and the reshaped z to > contourf. You do need to know the parameters of the projection though. > > Jeff =2D=20 Lionel Roubeyrie  lroubeyrie@... Chag=E9 d'=E9tudes et de maintenance LIMAIR  la Surveillance de l'Air en Limousin http://www.limair.asso.fr 
From: Jeff Whitaker <jswhit@fa...>  20070420 16:10:15

Lionel Roubeyrie wrote: > By grd file, I mean csv like file, with one line by value, like > X1 Y1 Z1 > X2 Y1 Z2 > X3 Y1 Z3 > ... > X1 Y2 Zk > X2 Y2 Zk+1 > ... > Xi Yj Zn > this is in geographic format, where there is a repetition in the X values and > the Y values, because the grid is regular, but not in lambert projection, > then I can't retrieve the dimensions of the grid. > > [SNIP] Lionel: Well, I guess you are stuck without knowing what the dimensions of the grid are. Can't you find that out from the data provider? Jeff  Jeffrey S. Whitaker Phone : (303)4976313 Meteorologist FAX : (303)4976449 NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@... 325 Broadway Office : Skaggs Research Cntr 1D124 Boulder, CO, USA 803033328 Web : http://tinyurl.com/5telg 
From: Lionel Roubeyrie <lroubeyrie@li...>  20070507 15:29:00

Le Vendredi 20 Avril 2007 18:10, Jeff Whitaker a =E9crit=A0: > Lionel Roubeyrie wrote: > > By grd file, I mean csv like file, with one line by value, like > > X1 Y1 Z1 > > X2 Y1 Z2 > > X3 Y1 Z3 > > ... > > X1 Y2 Zk > > X2 Y2 Zk+1 > > ... > > Xi Yj Zn > > this is in geographic format, where there is a repetition in the X valu= es > > and the Y values, because the grid is regular, but not in lambert > > projection, then I can't retrieve the dimensions of the grid. > > > > [SNIP] > > Lionel: Well, I guess you are stuck without knowing what the dimensions > of the grid are. Can't you find that out from the data provider? > > Jeff Hi Jeff, sorry for the latency. Problems come from the implementation of GMT into our programs, which only= =20 uses Lambert coords, and we are now with a deadlock. We're going to replace= =20 it by MPL because we believe in it and we think it's the better way to make= =20 plots and maps, so if for that we have to rewrite all the codes, we can the= n=20 try to catch geographic coords instead of Lambert. Thanks for your help, and for basemap too. =2D=20 Lionel Roubeyrie  lroubeyrie@... Chag=E9 d'=E9tudes et de maintenance LIMAIR  la Surveillance de l'Air en Limousin http://www.limair.asso.fr 