[gradsusr] saving more than one variable in one file
Jennifer Adams
jma at cola.iges.org
Tue Sep 25 11:24:49 EDT 2012
Use the -ap flag with 'set fwrite' to append to an existing file. Also, it is not necessary to define N3 and N4 before displaying them -- why waste the memory? Simply change your 'define' to a 'd' and then you can remove the two 'd N3' and 'd N4' lines.
--Jennifer
On Sep 25, 2012, at 5:20 AM, Mubashar Dogar wrote:
> 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
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
--
Jennifer M. Adams
IGES/COLA
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
jma at cola.iges.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20120925/36e68c52/attachment-0003.html
More information about the gradsusr
mailing list