Writing in ASCII

Stegert stegert at IFM.UNI-HAMBURG.DE
Wed May 16 08:09:46 EDT 2007


Daer Augusto,

This can be done with a GrADS-Skript and
the command is:
   res = write('datafile.dat',var)

Assuming you have a 2D dataset (10x10 data) and want
to store the variable "PA" to an ASCII file:

j=1
while (j<=10)
    'set y 'j
    var = ''             * re-initialize string 'var'
    i=1
    while (i<=10)
       'set x 'i         * dims for x,y,z,t are constant
       'd 'PA            * displaying PA returns its value
       var = ''var' 'subwrd(result,4)  * store it in the string
       i=i+1
    endwhile
    res = write('datafile.dat',var)    * write whole string to ASCII
                                       * res includes error-return
    j=j+1
endwhile
st1 = close('datafile.dat')

You can have a look at:
http://grads.iges.org/grads/gadoc/script.html and go
to 'intrinsic functions'.

or you may also search the usergroup archieve for more
possibilities hidden in the GrADS Scripting language not described
in the Documentation (there are many!) and ask further here.

Greetings
Christoph

Augusto Cesar GETIRANA schrieb:
> Hi,
> I'm a begineer with GRADS. In fact, all I want is to read a few
> climatologic inflrmation files (*.nc)and write them in an ASCII format. I
> can read the files but I don't know how to write them in other format.
> As additional information, I work in Windows plataform and I use the
> grads-1.8sl11-win32e version.
>
> Could anyone help me?
>
> Augusto Cesar VIEIRA GETIRANA <getirana at lmtg.obs-mip.fr>


--
Christoph Stegert
Institute for Oceanography - Ecological Modelling group
University of Hamburg, GER - (ZMK/ZMAW alliance member)
Bundesstr.53 20146 Hamburg - +49-40/42838-7486 Room 348



More information about the gradsusr mailing list