grib to bin - lon shifted
Lynette Bettio
L.Bettio at BOM.GOV.AU
Mon Jun 19 03:27:17 EDT 2006
Hi,
hopefully I have made a simple mistake and this is an easy fix...
I have a grib and ctl file (see attached). with a 2.5X2.5 grid, 145
lons, 73 lats, time=312
couldnt attach grib file as too big but this is the output from a wgrib
-V call on the last record:
rec 312:6613726:date 2004120100 APCP kpds5=61 kpds6=1 kpds7=0
levels=(0,0) grid=255 sfc anl:
APCP=Total precipitation [kg/m^2]
timerange 10 P1 0 P2 0 TimeU 1 nx 145 ny 73 GDS grid 0 num_in_ave 0
missing 0
center 54 subcenter 0 process 45 Table 2
latlon: lat -90.000000 to 90.000000 by 2.500000 nxny 10585
long 0.000000 to 360.000000 by 2.500000, (145 x 73) scan 64
mode 136 bdsgrid 1
min/max data -1 1557.09 num bits 16 BDS_Ref -1e+06 DecScale 6
BinScale 15
I want the output in binary format for reading into fortran. I have a
simple script to do this:
------------------------------------------------------------------------
---------
'set gxout fwrite'
'set fwrite pcpn_xie_arkin_1979_2005_2.5x2.5_ms.dat'
'set y 1 73'
'set x 1 145'
tvar=1
while (tvar<=312)
'set t 'tvar
'd apcpsfc'
tvar=tvar+1
endwhile
'disable fwrite'
------------------------------------------------------------------------
-----------
and my ctl file for the binary data is this:
------------------------------------------------------------------------
-----------
DSET pcpn_xie_arkin_1979_2005_2.5x2.5_ms.dat
TITLE xie arkin surf total precip kg/m^2 3mon avg
OPTIONS sequential
UNDEF 99999.9
XDEF 145 LINEAR 0.0 2.5
YDEF 73 LINEAR -90.000 2.5
ZDEF 1 LINEAR 1 1
TDEF 312 LINEAR JAN1979 1mo
VARS 1
prp 1 99 DMP output variable
ENDVARS
------------------------------------------------------------------------
-----------
When I run the script it all looks fine but unfortunately when I examine
the resultant binary file, at each time step the grid shifts slightly in
the x direction. So at a later time step e.g. set t 200, when compared
with the original grib data, though the binary displays the same pattern
it is quite obviously shifted in the x direction. I was thinking it may
have something to do with the 145 lons - as the zero is repeated twice
(0/360)??
I would really appreciate any suggestions as I have also tried decoding
with wgrib and again it looks like it does everything correctly but the
outputted binary pattern at the various time steps, though on the
correct grid this time, displays a different pattern to the original
grib data. So again I would welcome any suggestions from anyone more
familiar with grib.
Thankyou for your time.
Regards,
Lyn Bettio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20060619/0d735e6d/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcpn_xie_arkin_1979_2005_2.5x2.5_ms.ctl
Type: application/octet-stream
Size: 401 bytes
Desc: pcpn_xie_arkin_1979_2005_2.5x2.5_ms.ctl
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20060619/0d735e6d/attachment.obj
More information about the gradsusr
mailing list