Output txt specific format
Ranyére Nóbrega
ranyere.nobrega at SIPAM.GOV.BR
Thu Feb 14 10:12:37 EST 2008
Thanks Stegert, by the help.
I tested script that you sent me and it generated txt, according to what
I needed.
However, Itested the output data of the following form:
Compared n value of the generated file (output.txt) for a lat x and a
long y, with the value defined in grads, for example.
If the file output.txt gave me the next values:
Lat lon t precipitation
-10 -50 1 15,3
I did,
Set lat -10
Set lon -50
Set t 1
d p - result value=14,1
However, the value is different from save in output.txt.
It it has idea that it can be?
Stegert escreveu:
> Dear Ranyere,
> folloing your ctl:
> - ixmax would be 61 and
> - iymax would be 76 and
> - itmax would be 365
>
> These are to be transferred into world coordinates
> in the center loop:
> _ilonmin equals -90.000 (at x = 1)
> _dlon equals the increment of 1.
> i.e. at x = 12 your ilon = _ilonmin + 12*_dlon
>
> I included a full script as attachment, where I also
> corrected a bug in doing the loop.
>
> Three additions were made there, too:
> 1) Values can be read from the ctl-file using function getlevs
> (if you want to store only a part of the data you
> have to set boundaries manually)
> 2) undefined values can be left out (using "if...")
> 3) your current ctl will return 61*76*365 lines output - quite much.
> You can also store values of each day into a new file
>
> Whether you need these or not you can check for yourself.
> In any way: Looking at various skripts and see what they do
> is, I think, the easiest way to learn how they work and
> how to write your own.
> So, good luck, and for any open question:
> Fell free to ask...
>
> Yours
>
> *--- your ctl ---
> dset ^20080104.ll
> title SA Daily Precipitation from 20020101 to 20021231
> options big_endian
> options template
> options sequential
> undef 9999.
> xdef 61 linear -90.000 1.
> ydef 76 linear -60.000 1.
> zdef 1 linear 1 1
> tdef 365 linear 01jan2003 1dy
> vars 1
> p 0 0 daily precip (mm/day)
> ENDVARS
>
> *--- loop for txt-output (---
> * ix = 1 (BUG1: NOT HERE)
> * iy = 1 (BUG1: NOT HERE)
> it = 1
> *or wherever you like to start
>
> while (it <= itmax)
> * where i*max has to be declared above
> 'set t 'it
> * BUG1: re-initiate iy here:
> iy = 1
> while (iy <= iymax)
> 'set y 'iy
> * re-initiate ix here
> ix = 1
> while (ix <= ixmax)
> 'set x 'ix
> ilon = _ilonmin + ix*_dlon
> * ilat = _ilatmin + ix*_dlat (it has to be iy of course)
> ilat = _ilatmin + iy*_dlat
> * _ilonmin and _dlon (and corresponding lats)
> * are those declared in your CTL
> 'd var'
> * where var is your valiable
> var2 = subwrd(result,4)
> output = ilat' 'ilon' 'it' 'var2
> res = write('output.txt',output,append)
> ix = ix + 1
> endwhile
> iy = iy + 1
> endwhile
> it = it + 1
> endwhile
> st1 = close('output.txt')
>
>
> Ranyére Nóbrega schrieb:
>> Thanks Stegert.
>> I'm having a problem with script.
>> I do not have much knowledge with scripts in Grads, because of this Iask
>> more its help again.
>> What would be the variable dlon and dlat that you defined?
>> Once again, thanks.
>
> --
> Christoph Stegert: Ecological Modelling group
> Institut für Meereskunde - Universität Hamburg, Germany
> Zentrum f. Marine u. Atmosphärische Wissenschaften ZMAW
> Bundesstr.53, 20146 Hamburg - Phone: +49-40/ 42838-7486
--
__________________________________________________________
Ranyére Silva Nóbrega
Analista Intelectual
Divisão de Meteorologia e Climatologia - SIPAM
Centro Técnico e Operacional de Porto Velho
More information about the gradsusr
mailing list