[gradsusr] saving more than one variable in one file

Mubashar Dogar mubashardogar at gmail.com
Wed Sep 26 14:16:05 EDT 2012


Hi Ricardo,

It seems that GrADS can not handle two or more variables written using
fwrite. If I just write only one variable and open it, every thing is
fine. Also If I directly display both the variables, their plot is
also fine. It's either a problem with fwrite for more than one
variables or GrADS is not efficient enough to open more than one
variables written using fwrite command.

Thanks,

Mubashar
On 9/26/12, Ricardo Hallak <hallak at model.iag.usp.br> wrote:
> Hi Mubashar,
>
> when you display in the GrADS prompt (without saving it using fwrite):
>
> 'set x 1'
> 'set y 1'
> 'set t 1 60'
> 'd aave(temp,lon=-150,lon=-90,lat=-5,lat=5)'
>
> your result seems ok?
> Is it different from that that you display after using fwrite?
>
> Ricardo
>
> On Wed, 26 Sep 2012 10:57:54 +0300, Mubashar Dogar wrote
>> Hi  Sujata,
>>
>> It's not the issue of tdef. It doesn't make any difference.
>>
>> Thanks,
>> Mubashar
>>
>> On 9/26/12, Sujata Mandke <amin at tropmet.res.in> wrote:
>> > Hello!
>> >
>> >    If you want to write time series of both the variables
>> >    of 60 times each, then in the ctl file to open
>> >    newly created data, make following changes:
>> >
>> >> tdef 103 linear jan1900 1yr
>> >
>> >   change to
>> >   tdef 60 linear jan1900 1yr
>> >
>> >   With this change both variables are defined
>> >   for time series of 60 times each.
>> >   Hope this will match newly created variable with
>> >   that from original data.
>> > Regards
>> > Sujata Mandke
>> > Indian Institute of Tropical Meteorology
>> > Pune,India.
>> > -------------------------
>> >
>> > ----- Original Message -----
>> > From: Jennifer Adams <jma at cola.iges.org>
>> > To: GrADS Users Forum <gradsusr at gradsusr.org>
>> > Sent: Tue, 25 Sep 2012 20:54:49 +0530 (IST)
>> > Subject: Re: [gradsusr] saving more than one variable in one file
>> >
>> > 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
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > gradsusr mailing list
>> > gradsusr at gradsusr.org
>> > http://gradsusr.org/mailman/listinfo/gradsusr
>> >
>>
>> --
>> Muhammad Mubashar Ahmad Dogar
>> Scientific Officer (Climatology Section),
>> Global Change Impact Studies Centre (GCISC),
>> NCP complex, Quaid-e-Azam University Campus,
>> Shahdra road, Islamabad, Pakistan.
>> Tel:  +92519230226
>> Mob:+923315144169
>> email: mubashardogar at yahoo.com
>>           mubashar.ahmad at gcisc.org.pk
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> Ricardo Hallak
>
> Departamento de Ciências Atmosféricas (ACA)
> Instituto de Astronomia, Geofísica e Ciências Atmosféricas (IAG)
> Universidade de São Paulo (USP)
> Rua do Matão, 1226 - Cidade Universitária - São Paulo SP 05508-900
> Phone.: +55 (11) 3091-2850; 3091-4703
> Fax: +55 (11) 3091-4714
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>


-- 
Muhammad Mubashar Ahmad Dogar
Scientific Officer (Climatology Section),
Global Change Impact Studies Centre (GCISC),
NCP complex, Quaid-e-Azam University Campus,
Shahdra road, Islamabad, Pakistan.
Tel:  +92519230226
Mob:+923315144169
email: mubashardogar at yahoo.com
          mubashar.ahmad at gcisc.org.pk




More information about the gradsusr mailing list