Problem with fwrite

Kim WonMoo kwmski7 at SNU.AC.KR
Mon Sep 14 03:30:05 EDT 2009


I think it's problem with the number of grid points:
>      * when grads writes down (display with gxout fwrite) check number
>        of elements with Nx * Ny

Rather than using 'lon' & 'lat' setting, try 'set x' & 'y'.
i.e., if you use 'set lon -60 60' than the output may not be 81 in
x-dimension, but 82 or 80 sometimes.

Good luck,
Kim, WonMoo


--------------------------------------------------
From: "Davide Sacchetti" <davide.sacchetti at ARPAL.ORG>
Sent: Monday, September 14, 2009 4:27 PM
To: <GRADSUSR at LIST.CINECA.IT>
Subject:      Re: Problem with fwrite

> I don't know ...
> my suggestions are:
>      * use gxout shaded (it helps understanding location of missing
>        data - that's the wrong land sea mask)
>      * when grads writes down (display with gxout fwrite) check number
>        of elements with Nx * Ny
>      * put 'set lon ... lat ... z' out of the loop, tying inside the
>        loop does not help
>      * when you obtain the output file check the file size by
>        Nx*Ny*Nt*4
>      * if any of these check fails try to understand where it fails. In
>        my experience, using high resolutions, fwrite may fail the
>        correct number of X, or Y, or may fail the X,Y start point; it's
>        really unusual the failure with 1 deg resolution.
>
> p.s.: the correct_fig was missing ...
> bye bye
>
> davide
>
> On Sat, 2009-09-12 at 23:22 +0800, Hyacinth Cyprain Nnamchi wrote:
>> 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
>>
>>
>>
>>
>>
>>
>>
>> --
> --
> Sacchetti Davide
> Centro Funzionale Meteo Idrologico di Protezione Civile della Regione
> Liguria
> ARPAL Unit�  Tecnica Complessa di livello Regionale
> V.le Brigare Partigiane 2 16121 Genova (I)
> tel: +39 010 6437535                    fax: +39 010 6437520
> mail: davide.sacchetti at arpal.org     web: www.meteoliguria.it
>
>
>



More information about the gradsusr mailing list