fwrite help

Sestak, Dr. Michael michael.sestak at FNMOC.NAVY.MIL
Mon Oct 17 14:34:06 EDT 2005


fwrite writes a flat binary file, not a grib file.  You have to manually
create the control file for that data format.  See the grads documentation
on structure of a grads gridded binary file

http://grads.iges.org/grads/gadoc/aboutgriddeddata.html#structure

Michael Sestak
Fleet Numerical Meteorology and Oceanography Center
Monterey, CA

> -----Original Message-----
> From: Mark Sponsler [mailto:msponsler at COMCAST.NET]
> Sent: Monday, October 17, 2005 11:20 AM
> To: GRADSUSR at LIST.CINECA.IT
> Subject: fwrite help
>
>
> Hi Grads Users,
>
> I'm trying to use fwrite to parse out a subset of data from a
> wavewatch3
> grib. Pretty basic stuff. The fwrite function appears to work
> OK, but am
> unable to generate a ctl file from that new dataset using
> grb2ctl.  Or if
> manually generating the ctl file, I cannot get gribmap to construct an
> index file.  I'm using grads v1.8SL11 on Windows.
>
> Here's how I enabled fwrite:
>
>   'open nww3all.ctl'
>   'set t 1'
>   'set y 1 157'
>   'set x 1 288'
>   'set z 1'
>   'set fwrite grads.fwrite'
>   'set gxout fwrite'
>   'd htsgwsfc'
>   'd dirpwsfc'
>   'disable fwrite'
>
> The grads fwrite file was generated with 354 KB of data in it.
>
> Then I tried to build the ctl file:
>
>   grb2ctl.pl grads.fwrite > grads.fwrite.ctl
>
> Received Error:  Big Problem   Either grads.fwrite is missing
> or not a grib
> file.
>
> Here's the ctl file for the source data:
>
> dset c:\grib\input\nww3.all.grb
> index c:\grib\input\nww3.all.grb.idx
> undef 9.999E+20
> title c:\grib\input\nww3.all.grb
> *  produced by grib2ctl v0.9.12.5p33e
> dtype grib 233
> options yrev
> ydef 157 linear -78.000000 1
> xdef 288 linear 0.000000 1.250000
> tdef 51 linear 18Z12nov2004 03hr
> zdef 1 linear 1 1
> vars 11
> DIRPWsfc  0 107,1,1  ** surface Primary wave direction [deg]
> DIRSWsfc  0 109,1,1  ** surface Secondary wave direction [deg]
> HTSGWsfc  0 100,1,1  ** surface Sig height of wind waves and swell [m]
> PERPWsfc  0 108,1,1  ** surface Primary wave mean period [s]
> PERSWsfc  0 110,1,1  ** surface Secondary wave mean period [s]
> UGRDsfc  0 33,1,1  ** surface u wind [m/s]
> VGRDsfc  0 34,1,1  ** surface v wind [m/s]
> WDIRsfc  0 31,1,1  ** surface Wind direction [deg]
> WINDsfc  0 32,1,1  ** surface Wind speed [m/s]
> WVDIRsfc  0 101,1,1  ** surface Direction of wind waves [deg]
> WVPERsfc  0 103,1,1  ** surface Mean period of wind waves [s]
> ENDVARS
>
> Do you have any ideas what is wrong?
>
> Thanks in advance for your help.
>



More information about the gradsusr mailing list