[gradsusr] saving more than one variable in one file

Mubashar Dogar mubashardogar at gmail.com
Tue Sep 25 05:20:08 EDT 2012


Dear GrADS users,

I have 2 spatial variables in one file. I wanted to do some operation
on each one and wanted to save 2 new variables in a new GrADS file. I
am doing some thing as given below:

'open File.ctl'
'set gxout fwrite'
'set fwrite NEW_FILE.dat'
t=1                       ********************T=1 is Jan1900 and it is
monthly data
tmax=60
while (t<=tmax)
'set t 't
'define N3=aave(temp,lon=-150,lon=-90,lat=-5,lat=5)'
'define N4=aave(temp,lon=160,lon=210,lat=-5,lat=5)'
'd N3'
'd N4'
t=t+1
endwhile
'disable fwrite'
********************************
As the new variables are a 1-D time series, so my ctl file to open
newly written data file is as:

dset NEW_FILE.dat
title N3 and N4 indices
undef -9.99e+08
xdef 1 linear 1 1
ydef 1 linear 1 1
zdef 1 linear 1 1
tdef 103 linear jan1900 1yr
vars 2
N3   0 99  N3 variable
N4   0 99  N4 variable
endvars

It works fine but it looks that the values of both variables are not
representing to original values. How can I work with two or more
variables in one file?

Thanks,

Mubashar



More information about the gradsusr mailing list