Help to read grib files: FINAL SOLUTION

Henrique Barbosa hmjbarbosa at GMAIL.COM
Sun Apr 16 09:46:37 EDT 2006


Dear Oluseum,

Appart from the instruction from Zilore, what I did to figure out
the numbers of lats and lons was to use wgrib. I used the
following command:

             wgrib -verf -V sample_grib_file.grib

and it returned the answer bellow. As you can see, there is
a part of the output called "latlon". There you find 2 lines.

The first about the latitudes (from -37.5 to 40.08 in steps of -32.767).
And a second line about the longitudes (from 340 to 57.58
in steps of -32.767). There is also important numbers:
nxny=186624 (tell you the total number of floats in each
record) and 432x432 (the dimension of the record, if you
multiply both should give you nxny).

Well, now if you multiply 432 by -32.767 it obviously does not
correspond to the range in lat (40.08+37.5=77.58) or in
lon (57.58+20=77.58).... So i GUESSED that it was the
range (and not the number of points in x or y) that was wrong.

Now I had to find the correct range, which happens to be the
same for x and y, since they both have 432 points and
the same range of 77.58degrees. That's easy:
dividing 77.58 by 432 gives you 0.17958333...

Then I used emacs to open the ctl (it is a plain ascii file)
and I modified the line that had the range in x and y.
I also modified the name of the variable.

After that I opend the ctl in grads and plotted the field.
Since I got a reasonable result, I concluded that my
guess about the error in the step size (-32.767) was ok and
that I had properly fixed the problem.

Cheers,
Henrique

> Undefined parameter table (center 74-2 table 160), using NCEP-opn
> rec 1:0:date 2006032218 PVORT kpds5=4 kpds6=205 kpds7=1 levels=(0,1)
> grid=255  48hr fcst:
>   PVORT=Pot. vorticity [km^2/kg/s]
>   timerange 0 P1 48 P2 0 TimeU 1  nx 432 ny 432 GDS grid 0 num_in_ave
> 0 missing 0
>   center 74 subcenter 2 process 1 Table 160
>   latlon: lat  -37.500000 to 40.080000 by -32.767000  nxny 186624
>           long 340.000000 to 57.580000 by -32.767000, (432 x 432) scan
> 64 mode 0 bdsgrid 1
>   min/max data 269.25 314.125  num bits 24  BDS_Ref 269.25  DecScale 0
> BinScale -18
>
> rec 2:560228:date 2006032300 PVORT kpds5=4 kpds6=205 kpds7=1
> levels=(0,1) grid=255  54hr fcst:
>   PVORT=Pot. vorticity [km^2/kg/s]
>   timerange 0 P1 54 P2 0 TimeU 1  nx 432 ny 432 GDS grid 0 num_in_ave
> 0 missing 0
>   center 74 subcenter 2 process 1 Table 160
>   latlon: lat  -37.500000 to 40.080000 by -32.767000  nxny 186624
>           long 340.000000 to 57.580000 by -32.767000, (432 x 432) scan
> 64 mode 0 bdsgrid 1
>   min/max data 266.75 310.375  num bits 24  BDS_Ref 266.75  DecScale 0
> BinScale -18



More information about the gradsusr mailing list