[Thread Prev][Thread Next][Index]

Re: [ferret_users] lambert GRIB to netcdf?



Hi Peter,
You're right that you could do this kind of thing with a scat2grid function. The projection doesn't change in time, so write the longitudes and latitudes, say as lists of  xpts, ypts.  Then list the data variable as a 2D variable, location vs time. These might be in 2 files, one for the longitude,latitude data and a second for the data field.  Read these in using Ferret ascii commands and then do the scat2grid function to combine them into a gridded variable

DEFINE AXIS/x=12.44:25.22/np=97 long
DEFINE AXIS/y=44.64:50.01/np=61 lati
DEFINE AXIS/t=1:124:1 time

DEFINE GRIDx=long/y=lati gridxy

DEFINE GRID/t=time/x=long/y=lati gridxyt

SET DATA/EZ/VARIABLES="lon,lat"/GRID=gridxy "myfile_lon_lat.txt"


SET DATA/EZ/VARIABLES="tmp"/GRID=gridxyt "myfiletmp.txt"


LET gridded_var = scat2gridlaplac_xy(lon[d=1],lat[d=1],tmp[d=2],...


But maybe you can leave things in the lambert projection.

Is your main goal to do graphics in Ferret?  If so, then what you want to have in your file is 2-D fields for the LONGITUDE and LATITUDE variables, and then the data field a function of i,j, and time.  This is then Curvilinear data in netCDF and Ferret terminology, and Ferret can do graphics directly with it.

The netCDF file you'd be aiming for would look something like this

  name     title             I         J         K         L
 VAR      DATA              1:97     1:61      ...       1:124
 LON      LONGITUDE
         1:97     1:61      ...       ...
 LAT      LATITUDE          1:97     1:61      ...       ...

Where I've just made up the numbers i=1:200 and J=1:00.  The underlying xy grid is just indices, and the longitude and latitude variables describe locations on the Lambert projection. If you can think of a way to output the data in this arrangement, then you're set.  It might be that you'd put the data out in 3 files, one for longitudes, one for latitudes, and a third for the data field, including its time steps, and then read them in as ascii or whatever kind of files they need to be, then read them in using Ferret and write a single netCDF file.



Ansley

Peter Szabo wrote:
Dear Ferret_Users,

i have monthly-stored (one value for every 6 hours in a month), GRIB-formatted, Lambert conformal-projected database. i want this to be in netcdf format (an average or summed value per month is enough).

I know, ferret cannot read GRIB files, so i tried to use CDO. These operators read GRIB files, but cannot operate with Lambert projection. (though it is said on their homepage: http://www.mpimet.mpg.de/fileadmin/software/cdo/ )

Then i tried to walk this way: i made the CDO to write out the values in ASCII format (1. file for 124 timesteps), then i got the coordinates in an other ASCII file (2. file) then i 'cat'-ed the coordinate file to be there in 2. file (now 124 timesteps), after that i pasted the 1. and 2. file (i got lon lat value for 124 timesteps).
i got results like this:

   12.4353   44.6348       280.8
   12.5611   44.6417       281.1
   12.6870   44.6485       281.1
   12.8129   44.6551       281.1
   12.9389   44.6616       281.1
   13.0648   44.6680       281.2
   13.1908   44.6742       281.2
   13.3169   44.6803       281.2
   13.4429   44.6862       281.1
   13.5690   44.6919       281.1
   13.6951   44.6976       281.3
   13.8212   44.7030       281.1
   13.9474   44.7084       280.9
   14.0736   44.7136       281.3
   14.1998   44.7186       281.1
   14.3260   44.7235       279.7
   14.4523   44.7282       278.4
   14.5785   44.7328       279.8
   14.7048   44.7373         280

Then i made script like this:

DEFINE AXIS/x=12.44:25.22/np=97 long
DEFINE AXIS/y=44.64:50.01/np=61 lati
DEFINE AXIS/t=1:124:1 time
DEFINE GRID/t=time/x=long/y=lati grids
SET DATA/EZ/VARIABLES="lon,lat,tmp"/GRID=grids "myfile.txt"

If I save out the variable tmp will it be on a normal lat/lon grid (will it be correct when using 'go land_detail'?) and can i compare it with lat/lon data sets?

i know, for only one timestep it would be such an easy case, i could use 'scat2gridlaplace' and '
SET DATA/EZ/VARIABLES="lon,lat,tmp" "myfile.txt"' without setting the grid but with defining the x-y axis!

Should i start thinking of an other solution in order to be able use Lambert (and) GRIB file? Can someone help me? Thanks in advance,

Peter Szabo, HMS

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement