fwrite wrap data

Sestak, Michael L CIV 63134 michael.l.sestak at NAVY.MIL
Mon Sep 28 16:17:31 EDT 2009


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.

Michael Sestak
Fleet Numerical Meteorology and Oceanography Center
Monterey, CA




From: Javier G. Corripio
Sent: Mon 9/28/2009 12:03
To: GRADSUSR at LIST.CINECA.IT
Subject: fwrite wrap data


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20090928/6540157e/attachment.html 


More information about the gradsusr mailing list