<HTML><HEAD></HEAD>
<BODY>
<DIV id=idOWAReplyText38210 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>When using fwrite you should use 'set x' and 'set y' instead of 'set lat' and 'set lon' so the number of grid points in each dimension is certain. With set lat and set lon, what a person thinks is the last x grid position may not be written due to roundoff error, especially for fine resolution grids.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>Michael Sestak</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>Fleet Numerical Meteorology and Oceanography Center</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>Monterey, CA</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Javier G. Corripio<BR><B>Sent:</B> Mon 9/28/2009 12:03<BR><B>To:</B> GRADSUSR@LIST.CINECA.IT<BR><B>Subject:</B> fwrite wrap data<BR></FONT><BR></DIV>
<DIV><PRE style="WORD-WRAP: break-word">Dear all,
I would appreciate some advice with fwrite.
I am trying to write some data which is a subset of a larger grib. It seems that the data is wrapped
around in a peculiar way when using fwrite.
Here I show and example for clarity, the topography of the Alps from the GFS (hgtsfc). When using
the data written by fwrite it will display with the eastern end on the northwestern corner
The ctl files seems to be OK, so I wonder if I failed to specify any settings for fwrite.
These are the commands:
open gfs.ctl
set lon 0 20
set lat 40 50
d hgtsfc;************** first map correct
set gxout fwrite
set fwrite alpsset.dat
d hgtsfc
disaple fwrite
reinit
open alpsset.ctl
d topo;**************** second map wrapped around
ctl file for subset:
ga-> q ctlinfo
dset alpsset.dat
title
undef 9.999e+20
xdef 40 linear 0 0.5
ydef 20 linear 40 0.5
zdef 1 linear 1013 1
tdef 1 linear 00Z04SEP2009 60mn
vars 1
topo 0 1,1,0,0 surface height (m) []
endvars
original ctl file:
ga-> q ctlinfo 2
dset gfs
title gfs
undef 9.999e+20
xdef 720 linear 0 0.5
ydef 361 linear -90 0.5
zdef 26 levels 1000 975 950 925 900 850 800 750
700 650 600 550 500 450 400 350 300 250
200 150 100 70 50 30 20 10
tdef 51 linear 00Z28SEP2009 180mn
vars 52
.....
endvars
Image of what it should be and what I obtained:
http://tinyurl.com/y8f2xcq
or in a schematic way,
THIS:
*
****
********
************
*****************
****************************
*****************
************
********
****
*
BECOMES THIS:
***
**************
***
*
****
********
************
**************
**************
**************
************
********
****
*
Thanks a lot for any help.
Javier
</PRE></DIV></BODY></HTML>