[gradsusr] Help invoking user function

Davide Sacchetti davide.sacchetti at arpal.gov.it
Tue May 22 05:41:21 EDT 2012


you cannot rely on the ':' position of 'set t 6' result ...

I mean: the answer could be:

Time values set: 2012:5:1:9 2012:5:1:9 

or

Time values set: 2012:11:10:19 2012:11:10:19 ...

A solution is to transform ':' in blanks, then using subwrd:

loop over result chars (subwrd(result,i,1))
if subwrd(result,i,1) = ':' set blank, else let it unchanged
after the loop year = subwrd 1, month ...

hoping it helps a bit ...
Davide

On Tue, 2012-05-22 at 01:06 -0400, Zilore Mumba wrote:
> Help will be appreciated how to invoke a user function. I have to put
> time of validity on model output. In the script attached my BaseDate
> is 19/05/2012 which the script takes from "set t 1". Now I want to put
> validity time of a forecast valid at 06Z on 20th which I want to take
> from "set t 6".
> My script is not able to take the result of t 6, instead it print
> valid to 06Z on / /.
> Please assist.
> Zilore Mumba
> 
> On Mon, May 21, 2012 at 3:52 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. wgrib2 (Jeff Lake)
> >   2. Re: Reg: re.gs file (Arlindo da Silva)
> >   3. Re: Building 2.0.1 on Ubuntu 12.04 (hdf4, netcdf, shapefile
> >      not detected) (Arlindo da Silva)
> >   4. Re: g2grb subregion (Mike Manning)
> >   5. Re: Stippling/cross hatching for south polar (KODAMA Chihiro)
> >   6. Area average only for California (rjmera)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Fri, 18 May 2012 14:16:23 -0400
> > From: Jeff Lake <admin at michiganwxsystem.com>
> > Subject: [gradsusr] wgrib2
> > To: Grads <gradsusr at gradsusr.org>
> > Message-ID: <4FB691F7.4010105 at michiganwxsystem.com>
> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >
> > yes this is a GrADS list, but those of you that have experience with wgrib2
> > I have a problem with a simple snippet ..
> > Attempting to get a 12hr fcst_ave from the NWS NDFD grib files
> > following the directions on the wgrib2 pages, this looks like it should work
> >
> > wgrib2 -vt -var -lev -misc ds.td.bin -fcst_ave 12hr newdew.bin
> > but its not doing anything but making an exact copy of the ds.td.bin
> >
> > anybody used wgrib2 like this so I can use GrADS to make 12hr fcsts and
> > not 3hr
> >
> > --
> > -Jeff Lake
> > MichiganWxSystem.com
> > WeatherMichigan.net
> > TheWeatherCenter.net
> > GRLevelXStuff.com
> >
> >
> >
> > ------------------------------
> >
> > Message: 2
> > Date: Sat, 19 May 2012 17:33:27 -0400
> > From: Arlindo da Silva <dasilva at alum.mit.edu>
> > Subject: Re: [gradsusr] Reg: re.gs file
> > To: GrADS Users Forum <gradsusr at gradsusr.org>
> > Message-ID:
> >        <CALz7xZcRi-u7keX1hFqrSGo4UuwdPGF5mFo3t9_zZEAjw7kJvw at mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> > On Mon, May 14, 2012 at 7:34 AM, ?? ??????? ?????? <nelli.narendra at gmail.com
> >> wrote:
> >
> >> Dear friends
> >>
> >> Can any one send me re.gs file for regrid the rawdata in Opengrads.
> >>
> >>
> >
> > I am not sure what you mean by "raw data". Now, re is not a script but an
> > opengrads extension (written in C). If you have the opengrads bundle it
> > should be included. Try this:
> >
> > ga-> q udf
> >
> > Do you see re() list? Documentation is here:
> >
> >         http://opengrads.org/doc/udxt/re/
> >
> >  Arlindo
> >
> >
> >
> >
> >
> >
> >
> >> Thanks in advance
> >>
> >> Narendra Reddy
> >>
> >> --
> >> Regards,
> >>
> >> N.Narendra Reddy
> >> Research Scholar,
> >> C/O Dr.Kusuma G Rao
> >> Atmospheric Science Programme
> >> Antariksh Bhavan, NEW BEL Road
> >> ISRO HQ, B'lore, 560 094.
> >> Office: +91 80 2217 2091, 2077
> >> Home: +91 80 42035437
> >> Mobile: 09986589807 (*18:30 - 21:30 IST*)
> >> nelli.narendra at gmail.com
> >> ************************************************************************
> >> ???? ???? ???? ????? ???? ?????? ???? ??????? ????? ....
> >>
> >> *************************************************************************
> >>
> >>
> >> _______________________________________________
> >> gradsusr mailing list
> >> gradsusr at gradsusr.org
> >> http://gradsusr.org/mailman/listinfo/gradsusr
> >>
> >>
> >
> >
> > --
> > Arlindo da Silva
> > *dasilva at alum.mit.edu*
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL: http://gradsusr.org/pipermail/gradsusr/attachments/20120519/c1c7e26b/attachment-0001.html
> >
> > ------------------------------
> >
> > Message: 3
> > Date: Sat, 19 May 2012 17:42:30 -0400
> > From: Arlindo da Silva <dasilva at alum.mit.edu>
> > Subject: Re: [gradsusr] Building 2.0.1 on Ubuntu 12.04 (hdf4, netcdf,
> >        shapefile not detected)
> > To: GrADS Users Forum <gradsusr at gradsusr.org>
> > Message-ID:
> >        <CALz7xZcj0dui5PknWX=1BQNudV9LbPzj8yHQPk2h1yq9gUOebA at mail.gmail.com>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > On Sun, May 13, 2012 at 10:38 PM, klo uo <klonuo at gmail.com> wrote:
> >
> >> OK, sorry for previous message, but I'll take smarter route and
> >> install what's available in repository
> >> Building whole grads from source on Debian/Ubuntu is not trivial task (for
> >> me)
> >>
> >>
> > Building GrADS is not trivial even for us who have been doing this for
> > years. GrADS itself builds very easily, the problem are those pesky
> > dependencies...
> >
> >  Arlindo
> >
> > --
> > Arlindo da Silva
> > *dasilva at alum.mit.edu*
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL: http://gradsusr.org/pipermail/gradsusr/attachments/20120519/af8b0571/attachment-0001.html
> >
> > ------------------------------
> >
> > Message: 4
> > Date: Mon, 21 May 2012 09:03:52 +1000
> > From: Mike Manning <michael at bsch.au.com>
> > Subject: Re: [gradsusr] g2grb subregion
> > To: gradsusr at gradsusr.org
> > Message-ID: <4FB97858.2030806 at bsch.au.com>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Thanks Wesley,
> >
> > I'll give that a try this week :)
> >
> > Cheers, Mike
> >
> >
> > On 19/05/2012 1:07 AM, Wesley Ebisuzaki wrote:
> >> Mike,
> >>
> >>    The error message suggests that you haven't installed all the files
> >> needed
> >> for g2grb.gs <http://g2grb.gs> to run. You need
> >>
> >>  template.grb2 in the $GADDIR directory
> >>  you need wgrib2 (v1.8.4+)   on your path
> >>
> >>
> >> BTW The simpler way of making regional grib2 subset is to use wgrib2.
> >>
> >>   For lat-lon -> subset lat-lon: use the -small_grib option
> >>
> >>     wgrib2 IN.grb2 -set_grib_type j  -small_grib 100:170 -55:0 OUT.grb2
> >>
> >> You can also interpolate to a lat-lon grid by the -new_grid option.
> >>
> >>    Yours,
> >>    Wesley
> >>
> >>
> >>
> >> On Fri, May 18, 2012 at 3:19 AM, Mike Manning <michael at bsch.au.com
> >> <mailto:michael at bsch.au.com>> wrote:
> >>
> >>     Hi all,
> >>
> >>     I've got data downloaded from an archive now however I'd like to
> >>     extract
> >>     a subregion from the grib2 files using g2grb.  I've created a test.ctl
> >>     files as follows:
> >>
> >>     'open gfs.00z.ctl'
> >>     'set lat -55 0'
> >>     'set lon 100 170'
> >>     'g2grb LFTXsfc extrap.grb UGRD:1000 mb:anl:packing=j:center=7'
> >>     #'g2grb h(lev=925) +extrap.grb HGT:925 mb:anl:packing=j:center=7'
> >>     #'g2grb h(lev=850) +extrap.grb HGT:850 mb:anl:packing=j:center=7'
> >>     #'g2grb h(lev=700) +extrap.grb HGT:700 mb:anl:packing=j:center=7'
> >>     #'g2grb h(lev=600) +extrap.grb HGT:600 mb:anl:packing=j:center=7'
> >>     #'g2grb h(lev=500) +extrap.grb HGT:500 mb:anl:packing=j:center=7'
> >>     quit
> >>
> >>
> >>     I run it using grads -blc however it's throwing up some errors:
> >>     Starting "/grads2/Linux/Versions/2.0.a9.oga.1/i686/grads   -blc
> >>     test.ctl
> >>     " ...
> >>
> >>
> >>     Grid Analysis and Display System (GrADS) Version 2.0.a9.oga.1
> >>     Copyright (c) 1988-2010 by Brian Doty and the
> >>     Institute for Global Environment and Society (IGES)
> >>     GrADS comes with ABSOLUTELY NO WARRANTY
> >>     See file COPYRIGHT for more information
> >>
> >>     Config: v2.0.a9.oga.1 little-endian readline printim grib2 netcdf
> >>     hdf4-sds hdf5 opendap-grids,stn athena geotiff shapefile
> >>     Issue 'q config' command for more detailed configuration information
> >>     Loading User Defined Extensions table
> >>     </grads2/Linux/Versions/2.0.a9.oga.1/i686/gex/udxt> ... ok.
> >>     GX Package Initialization: Size = 11 8.5
> >>     Running in Batch mode
> >>     dlon=1 nx = 71 lon0 = 100
> >>     Y is varying   Lat = -55 to 0   Y = 36 to 91
> >>     dlat=1 ny = 56 lat0 = -55
> >>     need to generate date
> >>     new inv=d=2011121000:UGRD:1000 mb:anl:packing=j:center=7
> >>     new grads found undef=-999000000.000000
> >>     making template file
> >>     ! /grads2/wgrib2 $GADDIR/template.grb2 -d 1 -lola 100:71:1 -55:56:1
> >>     extrap.grb.template grib
> >>     argument: -lola ????
> >>     argument: 100:71:1 ????
> >>     argument: -55:56:1 ????
> >>     argument: extrap.grb.template ????
> >>     argument: grib ????
> >>     missing GRIB record(s)
> >>     opening fwrite extrap.grb.tmp
> >>     going to display LFTXsfc
> >>     result is Wrote 3976 of 3976 elements to extrap.grb.tmp as Sequential
> >>     Big_Endian
> >>
> >>     metadata = 1:0:d=2011121000:UGRD:1000 mb:anl:packing=j:center=7:
> >>     ! /grads2/wgrib2  extrap.grb.template -import_ieee extrap.grb.tmp
> >>     -set_metadata extrap.grb.inv -undefine_val -999000000.000000 -grib_out
> >>     extrap.grb
> >>     argument: -import_ieee ????
> >>     argument: extrap.grb.tmp ????
> >>     argument: -set_grib_type ????
> >>     argument: c3 ????
> >>     argument: -set_metadata ????
> >>     argument: extrap.grb.inv ????
> >>     argument: -undefine_val ????
> >>     argument: -999000000.000000 ????
> >>     argument: -grib_out ????
> >>     argument: extrap.grb ????
> >>     could not open file: extrap.grb.template
> >>
> >>     !rm extrap.grb.tmp extrap.grb.inv extrap.grb.template
> >>     rm: cannot remove `extrap.grb.template': No such file or directory
> >>
> >>
> >>     I'm not sure why it's not working :( All I'd like to do is extract the
> >>     subregion from lat -55 to 0 and lon 100 to 170 for all variables
> >>     in the
> >>     grib data files I've downloaded.
> >>
> >>     Cheers, Mike
> >>     _______________________________________________
> >>     gradsusr mailing list
> >>     gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
> >>     http://gradsusr.org/mailman/listinfo/gradsusr
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> 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/20120521/21f56adc/attachment-0001.html
> >
> > ------------------------------
> >
> > Message: 5
> > Date: Mon, 21 May 2012 18:37:30 +0900
> > From: KODAMA Chihiro <kodamac at jamstec.go.jp>
> > Subject: Re: [gradsusr] Stippling/cross hatching for south polar
> > To: GrADS Users Forum <gradsusr at gradsusr.org>
> > Message-ID: <4FBA0CDA.3050303 at jamstec.go.jp>
> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >
> > Dear Katherine,
> >
> > Just use maskout function, like:
> >
> > ga-> hatch maskout(var,-lat-20) min max
> >
> >
> > Good luck!
> >
> > Chihiro Kodama
> >
> >
> > (2012/05/17 13:27), Katherine Sadler wrote:
> >> Thanks Chihiro, it now works.
> >>
> >> However it also draws cross-hatching outside the boundary i've chosen (i
> >> want between the south pole and the equator, but it seems to draw
> >> cross-hatching from the pole to about 20 degrees north), is there a way
> >> to limit it?
> >>
> >> Thank you also for sharing hatch.gs <http://hatch.gs>, it has been very
> >> useful to me.
> >>
> >> Cheers,
> >> Katherine
> >>
> >>
> >> _______________________________________________
> >> gradsusr mailing list
> >> gradsusr at gradsusr.org
> >> http://gradsusr.org/mailman/listinfo/gradsusr
> >
> >
> > --
> > =====================================================
> > KODAMA Chihiro, Ph.D.
> > Japan Agency for Marine-Earth Science and Technology
> > Research Institute for Global Change
> > PHONE:  +81-45-778-5623 (direct)
> > E-Mail: kodamac at jamstec.go.jp
> > URL:    http://kodama.fubuki.info/
> > =====================================================
> >
> >
> >
> > ------------------------------
> >
> > Message: 6
> > Date: Mon, 21 May 2012 12:52:18 -0700
> > From: rjmera <rjmera at coas.oregonstate.edu>
> > Subject: [gradsusr] Area average only for California
> > To: GrADS Users Forum <gradsusr at gradsusr.org>
> > Message-ID: <4FBA9CF2.1050009 at coas.oregonstate.edu>
> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >
> > Hi, all. I've looked at some of the previous posts on this subject but I
> > wasn't sure if it covered what I wanted to do. What I'm trying to do is
> > to get area average for an irregular polygon. To be specific, the state
> > of California, for example. This would exclude other states in the
> > vicinity and the ocean. How should I proceed?
> >
> > Robert
> >
> > I'm using this version of grads:
> >
> > Grid Analysis and Display System (GrADS) Version 2.0.a9.oga.1
> > Copyright (c) 1988-2010 by Brian Doty and the
> > Institute for Global Environment and Society (IGES)
> > GrADS comes with ABSOLUTELY NO WARRANTY
> > See file COPYRIGHT for more information
> >
> > Config: v2.0.a9.oga.1 little-endian readline printim grib2 netcdf
> > hdf4-sds hdf5 opendap-grids,stn athena geotiff shapefile
> > Issue 'q config' command for more detailed configuration information
> > Loading User Defined Extensions table
> > </home/server/pi/homes/rjmera/grads/Contents/Linux/Versions/2.0.a9.oga.1/x86_64/gex/udxt>
> > ... ok.
> >
> >
> >
> > ------------------------------
> >
> > _______________________________________________
> > gradsusr mailing list
> > gradsusr at gradsusr.org
> > http://gradsusr.org/mailman/listinfo/gradsusr
> >
> >
> > End of gradsusr Digest, Vol 27, Issue 37
> > ****************************************
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

-- 
--> Attenzione cambio indirizzo: davide.sacchetti at arpal.gov.it
--
Davide Sacchetti
Centro Funzionale Meteo Idrologico di Protezione Civile della Regione Liguria
ARPAL Unità Tecnica Complessa di livello Regionale
V.le Brigare Partigiane 2 16121 Genova (I)
tel: +39 010 6437535                    fax: +39 010 6437520
mail: davide.sacchetti at arpal.gov.it     web: www.meteoliguria.it





More information about the gradsusr mailing list