fwrite (again)
Mark Sponsler
msponsler at COMCAST.NET
Mon Oct 17 18:33:44 EDT 2005
Thanks for your help. I removed the 2 option cards but still come up with the same result.
So I ran 'set gxout grid' for a small area on both the origianl grid and the fwrite output grid for only the variable HTSGWsfc to try and see what was going on. Reading just a bit of one latitiude row:
Original Grib Values: 4 4 3 3 3 3 2 2
Fwrite Grib Values: 172 155 157 159 156 160 166 157
There's no apparent correlation. Not sure where to go now....
Just to confirm: I should be able to just read the fwrite output file using a modified ctl file and no fortran interpretation??
--
Thanks,
Mark
-------------- Original message --------------
> The "options yrev" should not be used. Even though your original file has x
> and y reversed, fwrite writes the data from grads arrays so everything is in
> the order grads expects. I don't think that would give you the results you
> report, though. The grid should just be skewed around since you are reading
> rows and columns in the wrong order. The little endian may be a problem.
> If you are writing and reading the files on the same machine, you don't need
> to specify the endian type. Again, fwrite uses the expected format for the
> machine you are on. Since you only have two variables with one time and
> level, there isn't much more that could be wrong.
>
> > -----Original Message-----
> > From: Mark Sponsler [mailto:msponsler at COMCAST.NET]
> > Sent: Monday, October 17, 2005 2:42 PM
> > To: GRADSUSR at LIST.CINECA.IT
> > Subject: fwrite (again)
> >
> >
> > Sorry to be so bothersome but I have another simple question
> > that I could
> > not answer after reviewing the documentation.
> >
> > When using the fwrite defaults, it streams the data to a
> > binary file for
> > eventualy re-ingestion into GRADS. Is some level of fortran
> > manipulation
> > of the fwrite output required before it can be re-read by Grads?
> >
> > I ask because I was able to manually generate a control file
> > and get Grads
> > to read the file producing some results, but the data is way off
> > (Significant Wave Heights are all too high and and Direction
> > is set to 180
> > degrees for all grib points).
> >
> > Here's my modified control file:
> >
> > dset grads.fwrite
> > undef 9.999E+20
> > options little_endian
> > options yrev
> > ydef 157 linear -78.000000 1
> > xdef 288 linear 0.000000 1.250000
> > tdef 1 linear 18Z12nov2004 03hr
> > zdef 1 linear 1 1
> > vars 2
> > DIRPWsfc 0 107,1,1 ** surface Primary wave direction [deg]
> > HTSGWsfc 0 100,1,1 ** surface Sig height of wind waves and swell [m]
> > ENDVARS
> >
> > Here's the control file for original dataset that fwrite used as it's
> > source:
> >
> > dset nww3.all.grb
> > index nww3.all.grb.idx
> > undef 9.999E+20
> > title 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 61 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
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20051017/04cce1cf/attachment.html
More information about the gradsusr
mailing list