Problem with fwrite

Hyacinth Cyprain Nnamchi hc.nnamchi at LASG.IAP.AC.CN
Sat Sep 12 11:22:29 EDT 2009


Dear GrADS Users,

I am trying to write out SST data from the Hadley Centre dataset at 1*1-degree lon/lat grids for the oceans using the code in  .gs file:

tt=1
while(tt<=684)
'set  z  1'
'set  lon -60 20'
'set  lat  -45 5'
'set t ' tt
'd   sst'
tt=tt+1
endwhile
'reinit'

This works when I print the data on the screen as in the "Correct_Fig.JPG" (attached herewith) for the 684 timesteps.The problem is: When I use fwrite to write out the data and then read with ctl file, it produces the "Wrong_Fig.JPG" (Fig attached is for the first timestep.This error occurs in all the timesteps).

The CTL info below is the same with that of the parent data except in respect to the start lon/lat and the numbers of lon/lat:
UNDEF      -1e+30
XDEF       81    LINEAR    -60    1
YDEF        51    LINEAR   -45     1
ZDEF        1     LINEAR     0          1
TDEF       684   LINEAR  JAN1950        1mo
VARS        1
sst    0    99    global monthly SSTs at 1 by 1 resolution from the Hadley Centre
ENDVARS


Can anyone help with some ideas on how to get around this?
Thanks in advance.

hyacinth
MS Windows GrADS 2.0.a5.oga.5







--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Wrong_Fig.JPG
Type: image/jpeg
Size: 130268 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20090912/f2d2410c/attachment.jpe 


More information about the gradsusr mailing list