[gradsusr] gradsusr Digest, Vol 31, Issue 32
Mubashar Dogar
mubashardogar at gmail.com
Tue Sep 25 16:05:07 EDT 2012
Hi Jennifer,
Thansk for your reply but using appending -ap doesn't make any difference.
I am again pasting my question down for you. Please open any data and and
display both the variables before writing and then display the newly
written variables after opening the new file. You will clearly see the
difference. Myy last question is pasted again to reconsider if you can
click it:
******************************************************************************
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 -ap NEW_FILE.dat'
t=1 ********************T=1 is Jan1900 and it is
monthly data
tmax=60
while (t<=tmax)
'set t 't
'd aave(temp,lon=-150,lon=-90,lat=-5,lat=5)'
'd aave(temp,lon=160,lon=210,lat=-5,lat=5)'
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
*****************************************************
From: Jennifer Adams <jma at cola.iges.org>
Subject: Re: [gradsusr] saving more than one variable in one file
To: GrADS Users Forum <gradsusr at gradsusr.org>
Message-ID: <EA8F4F69-2E29-4827-A703-D42BA6B88308 at cola.iges.org>
Content-Type: text/plain; charset="us-ascii"
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 Tue, Sep 25, 2012 at 6:27 PM, <gradsusr-request at gradsusr.org> wrote:
> Send gradsusr mailing list submissions to
> gradsusr at gradsusr.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://gradsusr.org/mailman/listinfo/gradsusr
> or, via email, send a message with subject or body 'help' to
> gradsusr-request at gradsusr.org
>
> You can reach the person managing the list at
> gradsusr-owner at gradsusr.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gradsusr digest..."
>
>
> Today's Topics:
>
> 1. If else condition in GRADS (Mubashar Dogar)
> 2. Re: If else condition in GRADS (M.Adnan Abid)
> 3. Help with wind barb? (Howard Staines)
> 4. Re: If else condition in GRADS ( ?? )
> 5. saving more than one variable in one file (Mubashar Dogar)
> 6. Why fwrite writes more data? (Rupak Rajbhandari)
> 7. Re: saving more than one variable in one file (Jennifer Adams)
> 8. Re: Why fwrite writes more data? (Jennifer Adams)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 24 Sep 2012 19:05:04 +0300
> From: Mubashar Dogar <mubashardogar at gmail.com>
> Subject: [gradsusr] If else condition in GRADS
> To: gradsusr <gradsusr at gradsusr.org>
> Message-ID:
> <
> CAHBht21wno-ztQDt1Zm0Tq+ecu_SZTamuAgKhMy6fjf9EdFWxQ at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Dear GrADS users,
>
> I have 30 years time series data in a file named "File.ctl". The name
> of the variable in the file is "output" and it has different value for
> each year.
>
> I wanted to use if/else in GrADS. My condition is that if my output
> value is greater than "0" then write a new variable as "alpha=0.4"
> else "alpha=0".
>
> Following are few lines that I tried but it is only saving one value
> for each year
> 'open File.ctl'
> 'set gxout fwrite '
> 'set fwrite alpha.dat'
> 'set t 1 30'
> if (output>0)
> 'define alpha=0.4'
> else
> 'define alpha=0'
> endif
> 'd alpha'
> But it is giving only one value that is 0.4 for all years. what's wrong in
> this?
>
> Thanks,
>
> Mubashar
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 24 Sep 2012 19:24:33 +0300
> From: "M.Adnan Abid" <madnanabid at gmail.com>
> Subject: Re: [gradsusr] If else condition in GRADS
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID:
> <
> CAL+Vpnv+GkbxdqD9AUd_mzbzCJx1tS+odgpDOhKgfY8fu_Nv4g at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi Mubashar
>
> Try maskout function
>
> Adnan
>
> On Mon, Sep 24, 2012 at 7:05 PM, Mubashar Dogar <mubashardogar at gmail.com>
> wrote:
> > Dear GrADS users,
> >
> > I have 30 years time series data in a file named "File.ctl". The name
> > of the variable in the file is "output" and it has different value for
> > each year.
> >
> > I wanted to use if/else in GrADS. My condition is that if my output
> > value is greater than "0" then write a new variable as "alpha=0.4"
> > else "alpha=0".
> >
> > Following are few lines that I tried but it is only saving one value
> > for each year
> > 'open File.ctl'
> > 'set gxout fwrite '
> > 'set fwrite alpha.dat'
> > 'set t 1 30'
> > if (output>0)
> > 'define alpha=0.4'
> > else
> > 'define alpha=0'
> > endif
> > 'd alpha'
> > But it is giving only one value that is 0.4 for all years. what's wrong
> in this?
> >
> > Thanks,
> >
> > Mubashar
> > _______________________________________________
> > gradsusr mailing list
> > gradsusr at gradsusr.org
> > http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 25 Sep 2012 06:42:03 +1200
> From: Howard Staines <metris at clear.net.nz>
> Subject: [gradsusr] Help with wind barb?
> To: gradsusr at gradsusr.org
> Message-ID: <050601cd9a84$4a3f10a0$debd31e0$@net.nz>
> Content-Type: text/plain; charset=us-ascii
>
> Your script below ...
> You set your background to white ... the default is black.
>
> So to get a black barb color
>
>
> 'set lat 32'
> 'set lon 35'
> 'set grads off'
> 'set timelab off'
> 'set parea 0.5 10.7 6.7 8.2'
> 'set frame on'
> 'set xlab off'
> 'set t 't1' 't2''
> 'set gxout tserbarb'
> 'set digsiz 0.05'
> 'set lev 925'
> 'set line color '
>
> This should be
> 'set line 1'
>
> This may fix the boundary issue as well
> The grads default colours numbers are
>
> 0 same as the background (in your script white)
> &
> 1 a foreground color ... ie either black or white depending on the
> background, so on a background
> Of white ... the foreground color would be black (that's the way I
> understand it)
>
>
>
>
> 'd gr2stn(ugrdprs, 35, 32);gr2stn(vgrdprs, 35, 32)'
>
>
>
> Regards
>
> Howard Staines
>
> Metris Limited
>
> WEATHER FORECAST SERVICES
>
> phone 0800 372 433 - mobile 027 2785586 - P O Box 24 FEATHERSTON
> email info at metris.co.nz - info at metscape.net.nz - website www.metris.co.nz-
> www.metscape.net.nz
>
>
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 25 Sep 2012 11:53:58 +0800
> From: " ?? " <497805453 at qq.com>
> Subject: Re: [gradsusr] If else condition in GRADS
> To: " GrADS Users Forum " <gradsusr at gradsusr.org>
> Message-ID: <tencent_481D24560D23DEDA794F3A04 at qq.com>
> Content-Type: text/plain; charset="gb18030"
>
> Hi,Mubashar
> there is an example GrADS Function Documentation,here is the link:
> http://grads.iges.org/grads/gadoc/gradfuncconst.html
>
> use const and maskout function together.
>
> Qingfeng
>
>
>
>
> ------------------ Original ------------------
> From: "Mubashar Dogar"<mubashardogar at gmail.com>;
> Date: Tue, Sep 25, 2012 00:05 AM
> To: "gradsusr"<gradsusr at gradsusr.org>;
>
> Subject: [gradsusr] If else condition in GRADS
>
>
>
> Dear GrADS users,
>
> I have 30 years time series data in a file named "File.ctl". The name
> of the variable in the file is "output" and it has different value for
> each year.
>
> I wanted to use if/else in GrADS. My condition is that if my output
> value is greater than "0" then write a new variable as "alpha=0.4"
> else "alpha=0".
>
> Following are few lines that I tried but it is only saving one value
> for each year
> 'open File.ctl'
> 'set gxout fwrite '
> 'set fwrite alpha.dat'
> 'set t 1 30'
> if (output>0)
> 'define alpha=0.4'
> else
> 'define alpha=0'
> endif
> 'd alpha'
> But it is giving only one value that is 0.4 for all years. what's wrong in
> this?
>
> Thanks,
>
> Mubashar
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://gradsusr.org/pipermail/gradsusr/attachments/20120925/4b008327/attachment-0001.html
>
> ------------------------------
>
> Message: 5
> Date: Tue, 25 Sep 2012 12:20:08 +0300
> From: Mubashar Dogar <mubashardogar at gmail.com>
> Subject: [gradsusr] saving more than one variable in one file
> To: gradsusr <gradsusr at gradsusr.org>
> Message-ID:
> <
> CAHBht208O8gmgQOT4_NQnHsCwm2X1gtCh0u1Mm454wfYKyw3qw at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> 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
>
>
> ------------------------------
>
> Message: 6
> Date: Tue, 25 Sep 2012 21:04:05 +0545
> From: Rupak Rajbhandari <rupak.rajbhandari at gmail.com>
> Subject: [gradsusr] Why fwrite writes more data?
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID:
> <CAPUBxUQ_L4XXEHd0=
> LvuY612DqrGL4WzKiviWyPwAL6QTNFPuQ at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
>
> Greetings!
>
> PRINCETON University generated Hydroclimatology corrected NetCDF global 1
> degree temperature file or data (eg. tmax_daily_1970-1970.nc) has
> dimension of 360x180. When I write the data to a file using fwrite command,
> it says "wrote 65160 of 65160 elements ...", which is 360x181 and the image
> is distorted. Could someone experienced in NetCDF file explain to US
> (novice in NetCDF), why and what is happening and perhaps how to correct?
>
> Thanks for the help!
>
> -rupak
>
> Rupak Rajbhandari
> Department of Meteorology
> TriChandra College
> Kathmandu, NEPAL
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://gradsusr.org/pipermail/gradsusr/attachments/20120925/7a85d30c/attachment-0001.html
>
> ------------------------------
>
> Message: 7
> Date: Tue, 25 Sep 2012 11:24:49 -0400
> From: Jennifer Adams <jma at cola.iges.org>
> Subject: Re: [gradsusr] saving more than one variable in one file
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID: <EA8F4F69-2E29-4827-A703-D42BA6B88308 at cola.iges.org>
> Content-Type: text/plain; charset="us-ascii"
>
> 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-0001.html
>
> ------------------------------
>
> Message: 8
> Date: Tue, 25 Sep 2012 11:27:52 -0400
> From: Jennifer Adams <jma at cola.iges.org>
> Subject: Re: [gradsusr] Why fwrite writes more data?
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID: <2A3717FF-B4CD-4DE0-B6C5-A7467895332C at cola.iges.org>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Be sure to use the 'set x' and 'set y' commands to set the dimension
> environment to the exact grid dimensions before using fwrite. By default,
> when GrADS opens a global data set, it invokes a 'set lon 0 360' command
> which can add an extra column to the fwrite output. --Jennifer
>
>
>
> On Sep 25, 2012, at 11:19 AM, Rupak Rajbhandari wrote:
>
> > Hi all,
> >
> > Greetings!
> >
> > PRINCETON University generated Hydroclimatology corrected NetCDF global
> 1 degree temperature file or data (eg. tmax_daily_1970-1970.nc) has
> dimension of 360x180. When I write the data to a file using fwrite command,
> it says "wrote 65160 of 65160 elements ...", which is 360x181 and the image
> is distorted. Could someone experienced in NetCDF file explain to US
> (novice in NetCDF), why and what is happening and perhaps how to correct?
> >
> > Thanks for the help!
> >
> > -rupak
> >
> > Rupak Rajbhandari
> > Department of Meteorology
> > TriChandra College
> > Kathmandu, NEPAL
> >
> >
> > _______________________________________________
> > 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/db4e680b/attachment.html
>
> ------------------------------
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> End of gradsusr Digest, Vol 31, Issue 32
> ****************************************
>
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20120925/8025134c/attachment-0003.html
More information about the gradsusr
mailing list