[gradsusr] monthly to yearly script

Jeff Duda jeffduda319 at gmail.com
Sat Nov 7 15:13:36 EST 2015


the 'close' command does not operate as it does in Matplotlib or MATLAB in
closing figures. In Grads, 'close' closes the data file. Since your open
statement is outside the loop, that probably explains why you are only
getting one map. The output from the script should be cluing you into that
fact by saying something like "CAN'T DISPLAY - NO FILES OPEN"

Jeff Duda

On Sat, Nov 7, 2015 at 12:15 PM, Ramchandra Karki <rammetro at hotmail.com>
wrote:

> Hi,
> I have a monthly data set in one binary file and I want to get annual map
> but only one map is plotted with this script. can any body help me to
> correct this script. I want to read those data in ascii too.
>
>
>
> indata = "TMAX20KM.CTL"
> datname = "MAXT"
> 'open 'indata''
> 'set lat 26 31'
> 'set lon 80 89'
> 'set lev 1'
> 'set gxout shaded'
> y= 1
> while (y <=29)
>     yr = 70+y
>     b=y*12
>     a=12*y-11
>     'define yavg=ave(tt, t='a', t='b', 1)'
>     'set mpdset hires'
>     'set display color white'
>     'clear'
>     'd yavg'
>     'draw title Annual 'datname': 19'yr
>     'printim 'yr'.png'
>     'close 1'
> y=y+1
> endwhile
> 'quit'
>
>
>
>
> *RegardsRamchandra Karki*
>
> > From: gradsusr-request at gradsusr.org
> > Subject: gradsusr Digest, Vol 69, Issue 13
> > To: gradsusr at gradsusr.org
> > Date: Sat, 7 Nov 2015 12:00:01 -0500
> >
> > 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. Re: netcdf file opening problem (Boddapati Anil)
> > 2. Re: maskout problems with positive and negative numbers.
> > (leila amini)
> > 3. g2ctl/gribmap and 6hr/12hr GFS (Christopher Gilroy)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Sat, 7 Nov 2015 16:45:54 +0530
> > From: Boddapati Anil <boddapati.anil2 at gmail.com>
> > Subject: Re: [gradsusr] netcdf file opening problem
> > To: GrADS Users Forum <gradsusr at gradsusr.org>
> > Message-ID:
> > <CAJdYfFHSGiGSFYLmZtAERp++hM4gTgy0r1d5rLqha2C=_qL=pw at mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> > Thank you very much for your support in my job
> >
> > On Fri, Nov 6, 2015 at 10:12 PM, Jeff Duda <jeffduda319 at gmail.com>
> wrote:
> >
> > > Grads variable names have requirements. I believe those are a limit of
> 16
> > > characters, and there can be only alphanumeric characters in the name.
> In a
> > > control file, you can rename a netcdf array to meet the grads variable
> name
> > > requirements using the => syntax. For example:
> > >
> > > Atmospheric_Water_Vapor_Mean=>meanwvap
> > >
> > > See http://www.iges.org/grads/gadoc/descriptorfile.html#VARS for
> complete
> > > details.
> > >
> > > Jeff Duda
> > >
> > > On Fri, Nov 6, 2015 at 5:29 AM, Boddapati Anil <
> boddapati.anil2 at gmail.com>
> > > wrote:
> > >
> > >> Dear Users,
> > >>
> > >> I'm using one MODIS file it was converted from hdf to netcdf
> > >>
> > >> for that i wrote one discription file ,using that it was opening but
> > >> cann't display the data
> > >>
> > >>
> > >>
> > >> *Discription File:*dset ^MOD08_D3.A2011003.051.nc
> > >> dtype netcdf
> > >> undef -999
> > >> TITLE MODIS/Terra Aerosol Cloud Water Vapor Ozone Daily L3 Global
> 1Deg CMG
> > >> xdef 360 linear -179.5 1
> > >> ydef 180 linear -89.5 1
> > >> tdef 1 linear 03Jan2011 1dy
> > >> zdef 1 linear 1 1
> > >> vars 1
> > >> Atmospheric_Water_Vapor_Mean 0 99999 y,x Precipitable Water Vapor (IR
> > >> Retrieval) Total Column: Mean
> > >> endvars
> > >>
> > >> *ERROR*
> > >> ga-> d atmospheric_wat
> > >> Error: Variable atmospheric_wat not in netcdf file
> > >> Data Request Error: Error for variable 'atmospheric_wat'
> > >> Error ocurred at column 1
> > >> DISPLAY error: Invalid expression
> > >> Expression = atmospheric_wat
> > >>
> > >> --
> > >>
> > >>
> > >> *Boddapati Anil(PF-822)CSIR Fourth Paradigm Institute*
> > >>
> > >> *Wind Tunnel Road,Belur campous*
> > >>
> > >> *Bengalore-37*
> > >>
> > >>
> > >> *contact:+91-8867766688 +91-7022665333*
> > >>
> > >>
> > >> _______________________________________________
> > >> gradsusr mailing list
> > >> gradsusr at gradsusr.org
> > >> http://gradsusr.org/mailman/listinfo/gradsusr
> > >>
> > >>
> > >
> > >
> > > --
> > > Jeff Duda
> > > Graduate research assistant
> > > University of Oklahoma School of Meteorology
> > > Center for Analysis and Prediction of Storms
> > >
> > > _______________________________________________
> > > gradsusr mailing list
> > > gradsusr at gradsusr.org
> > > http://gradsusr.org/mailman/listinfo/gradsusr
> > >
> > >
> >
> >
> > --
> >
> >
> > *Boddapati Anil(PF-822)CSIR Fourth Paradigm Institute*
> >
> > *Wind Tunnel Road,Belur campous*
> >
> > *Bengalore-37*
> >
> >
> > *contact:+91-8867766688 +91-7022665333*
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL:
> http://gradsusr.org/pipermail/gradsusr/attachments/20151107/67269e98/attachment-0001.html
> >
> > ------------------------------
> >
> > Message: 2
> > Date: Sat, 7 Nov 2015 14:49:20 +0330
> > From: leila amin
> > i <labi475 at gmail.com>
> > Subject: Re: [gradsusr] maskout problems with positive and negative
> > numbers.
> > To: GrADS Users Forum <gradsusr at gradsusr.org>
> > Message-ID:
> > <CAChC=xRM57ij5bvio1xHjUeP-aaBe+TXCoRXEjnVEW6-XJBmtA at mail.gmail.com>
> > Content-Type: text/plain; charset=UTF-8
> >
> > hi
> > please help me ,how can i draw sum of rain in 24 hours on map
> > what is my script?
> > please send for me command
> > thanks
> > leila
> >
> > On 10/29/15, Jeff Duda <jeffduda319 at gmail.com> wrote:
> > > It would probably help if you left the skip function for the very end.
> I
> > > don't see a need for using the skip command to merely define a new
> > > variable. skip() is a display type command.
> > >
> > > define negto10 = const(maskout(zcomp,zcomp-1),10,-u)
> > >
> > > define mor4140 = const(maskout(negto10,41-negto10),40,-u)
> > >
> > > d skip(mor4140,8,8)
> > >
> > > Jeff Duda
> > >
> > > On Thu, Oct 29, 2015 at 6:43 AM, Mikovitz, Colleen (LARC-E302)[SCIENCE
> > > SYSTEMS AND APPLICATIONS, INC] <j.c.mikovitz at nasa.gov> wrote:
> > >
> > >> You can make a negative version of your variable and do a similar
> > >> process. With a field I have on, limiting values between 200 and 300:
> > >>
> > >> 'negto200=const(maskout(toaup,toaup-200),200,-u)'
> > >> 'revnegto200=-negto200'
> > >> 'keep=revnegto200+300'
> > >> 'backtogood=-1*(maskout(keep,keep)-300)'
> > >> 'final=const(back
> > togood,300,-u)'
> > >> 'd final?
> > >>
> > >>
> > >> On Oct 28, 2015, at 10:27 PM, Christopher Gilroy <
> chris.gilroy at gmail.com>
> > >> wrote:
> > >>
> > >> > Alright, so I'm unsure if maskout is really the option I need for
> both
> > >> of these, but is there anyway to take any value less than 1 (even
> > >> negatives) and replace them with 10? I seem to be able to do that
> with:
> > >> >
> > >> > 'define negto10= skip(const(maskout(zcomp,zcomp-0), 10, -u), 8, 8)'
> > >> >
> > >> > That gives me all positive numbers, great so far. Now, I'd like to
> also
> > >> change the results of negto10 and turn all numbers larger than 41 to
> 40.
> > >> I
> > >> can't seem to figure that part out. I've tried all sorts of variants
> of:
> > >> >
> > >> > 'define mor4140 = skip(const(maskout(negto10,negto10+41), 40, -u),
> 8,
> > >> > 8)'
> > >> >
> > >> > all with no luck. Any thoughts?
> > >> > _______________________________________________
> > >> > gradsusr mailing list
> > >> > gradsusr at gradsusr.org
> > >> > http://gradsusr.org/mailman/listinfo/gradsusr
> > >>
> > >>
> > >> _______________________________________________
> > >> gradsusr mailing list
> > >> gradsusr at gradsusr.org
> > >> http://gradsusr.org/mailman/listinfo/gradsusr
> > >>
> > >
> > >
> > >
> > > --
> > > Jeff Duda
> > > Graduate research assistant
> > > University of Oklahoma School of Meteorology
> > > Center for Analysis and Prediction of Storms
> > >
> >
> >
> >
> > ------------------------------
> >
> > Message: 3
> > Date: Sat, 7 Nov 2015 09:52:47 -0500
> > From: Christ
> > opher Gilroy <chris.gilroy at gmail.com>
> > Subject: [gradsusr] g2ctl/gribmap and 6hr/12hr GFS
> > To: GrADS Users Forum <gradsusr at gradsusr.org>
> > Message-ID:
> > <CAFCiPemZ48O9Y5zqGNB5y8GRrpuRCnLyftECffCQT9BHAWdVfQ at mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> > I've always been curious for those who run their plots using scripting
> > approaches and download in 3 or 6-hour increments, how do you handle past
> > hour 240?
> >
> > For example, downloading 6hr files, starting at hr 0, t41=240 and then
> > t43=252 and I'm curious if there's a way to make t42=252, t43=264, etc.
> I'm
> > just looking for a way to make every t = a working timestep.
> >
> > So as an example, if you made a looping grads script for all 384 hours,
> > using 6h files the only way I knew of to "get around" the 2 t-step
> > increments after 240 was doing something like:
> >
> > i=1
> > while (i <= 65)
> >
> > if (i <= 41)
> > trecord=i
> > endif
> > if (i=42)
> > trecord = 43
> > endif
> > if (i=43)
> > trecord = 45
> > endif
> >
> > 'd tmp2m'
> >
> > The only reason I cared to do that even was because otherwise every other
> > image past hr240 would be blank since there is no t=42, t=44, etc.
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL:
> http://gradsusr.org/pipermail/gradsusr/attachments/20151107/61568f88/attachment-0001.html
> >
> > ------------------------------
> >
> > _______________________________________________
> > gradsusr mailing list
> > gradsusr at gra
> > dsusr.org
> > http://gradsusr.org/mailman/listinfo/gradsusr
> >
> >
> > End of gradsusr Digest, Vol 69, Issue 13
> > ****************************************
> >
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20151107/b032dc28/attachment-0001.html 


More information about the gradsusr mailing list