[gradsusr] Help multi-panel plots on a page

Jennifer Adams jma at cola.iges.org
Thu Aug 29 18:05:28 EDT 2013


Don't use the same index for panel number and time step. 
p=1
t=2
while (p<=ptot)
  _vpg.p
  'set t 't
  DRAW STUFF
  t=t+1
  p=p+1
endwhile

--Jennifer

On Aug 29, 2013, at 5:53 PM, Zilore Mumba wrote:

> Jennifer,
> Thank you very much for your time to try and assist me. However, perhaps I did not put my question clearly. I reproduce below part of the code I modified from panels_demo.gs, and I added a part which takes timestamp from the input file.
> Since am displaying rainfall and there is no rainfall at t=1, I start from t=2 (here p=2).
> When I run my script with "panels.gs 2 2" for 4 plots on a page, I get three plots with the first one (top left) blank, and the title appears only on the bottom two but it does not seem to pick the hour correctly (this is from e.g. q time: 06Z30Aug2013).
> 
> I would appreciate assistance from anyone else
> Zilore
> 
> 
> panels(args)
>   p = 2
>   ptot = nrows * ncols
>   'set mproj scaled'
> 
> * Loop through each panel and draw a plot
>   while (p <= ptot)
>     _vpg.p
>     'set t 'p
>     'set grads off'
>   'query time'
>   res=subwrd(result,3)
>   hh=substr(res,1,2)
>   dd=substr(res,4,2)
>   mm=substr(res,6,3)
>   yy=substr(res,9,4)
>   say dd'/'mm'/'yy' 'hh
>   'draw title Total Accumulated precip. (mm) on 'dd'/'mm'/'yy' at 'hh''
>   'cbarn'
>   'd RAINNC'
>   p = p + 1
>   endwhile
> 
> 
> On Wed, Aug 28, 2013 at 6:00 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. Help multi-panel plots on a page (Zilore Mumba)
>    2. fprintf query... (uzair manan)
>    3. Re: fprintf query... (hersala)
>    4. Re: fprintf query... (Jayakrishnan P.R)
>    5. Re: fprintf query... (M.Mahakur)
>    6. Re: Help multi-panel plots on a page (Jennifer Adams)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Wed, 28 Aug 2013 08:00:13 +0200
> From: Zilore Mumba <zmumba at gmail.com>
> Subject: [gradsusr] Help multi-panel plots on a page
> To: gradsusr at gradsusr.org
> Message-ID:
>         <CAKS2qbLaqBQBfDBiT8f24XkCCGPdwMaf3BaurczoE6FjqX=XeQ at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> As my earlier post had no heading, I am reposting the same in the hope that
> it may be seen and I can get help.
> I hope someone can find time to explain to me a few things on panel plots.
> In the panles_demo.gs (snippet below),I do not understand the following:
> 
> 1. for four plots on a page I loop through p=1 to p=4, why do we display t
> (I want to display what I have in my file;
> 2. what is the global variable defined by _vpg.p in this script?
> 3. How do I put a title corresponding to the graphic validity time, on each
> plot?
> Help will be appreciated.
> Zilore Mumba
> 
>   rc = gsfallow("on")
>   if (args='')
>     say 'Two arguments are required: the # of rows and # of columns'
>     return
>   else
>     nrows = subwrd(args,1)
>     ncols = subwrd(args,2)
>   endif
> 
>   'use wrfout_d01_2013-07-27_00.ctl'
>   'reset'
>   panels(args)
>   p = 1
>   ptot = nrows * ncols
>   'set mproj scaled'
> 
> * Loop through each panel and draw a plot
>   while (p <= ptot)
>     _vpg.p
>     'set t 'p
>     'set grads off'
>     'd t'
>     p = p + 1
>   endwhile
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130828/9f2bb8b0/attachment-0001.html
> 
> ------------------------------
> 
> Message: 2
> Date: Wed, 28 Aug 2013 11:02:25 +0500
> From: uzair manan <uzair_july at hotmail.com>
> Subject: [gradsusr] fprintf query...
> To: grads <gradsusr at gradsusr.org>
> Message-ID: <COL125-W6E307DE0E8DA30C580781EF4B0 at phx.gbl>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Good Morning:
> 
> This is Uzair Mannan from Pakistan.. I was
> searching on how to extract temperature and precipitation variable data
> from GrADS.
> 
> The problem is when I copy and save the fprintf script to fprintf.gs and ran GrADS in order to run the file test_001_SRF.1990010100.nc.ctl it says:-
> 
> ga-> fprintf ts ts.txt
> Unknown command: fprintf
> 
> 
> 
> I'm using Linux Ubuntu 12.04 LTS and GrADS 2.0.a9 and have downloaded the coding of fprintf script from
> 
> http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Saving_GrADS_variable_data_to_a_text_file
> 
> What is the issue?? Where to save the fprintf.gs file in order to get the script workable ???
> 
> Regards
> 
> Uzair Mannan
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130828/d0427df2/attachment-0001.html
> 
> ------------------------------
> 
> Message: 3
> Date: Wed, 28 Aug 2013 07:10:55 -0300
> From: hersala <hersala at gmail.com>
> Subject: Re: [gradsusr] fprintf query...
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID:
>         <CA+0GtdtmC8516PfYMzk=hUjjop+3VKbAJs2CLLx8RDseUiKTVA at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hi Uzair,
> 
> Try revising this 2 points:
> 
> 1) Have you placed fprintf between ' '. I mean in this way:  'fprintf ts
> ts.txt' in your script
> 
> 2) Are you sure you have saved fprintf in the proper directory ?
> 
> I hope this could help.
> Cheers,
> 
> Hern?n
> 
> 
> On 28 August 2013 03:02, uzair manan <uzair_july at hotmail.com> wrote:
> 
> > Good Morning:
> >
> > This is Uzair Mannan from Pakistan.. I was searching on how to extract
> > temperature and precipitation variable data from GrADS.
> >
> > The problem is when I copy and save the fprintf script to *fprintf.gs*and ran GrADS in order to run the file
> > *test_001_SRF.1990010100.nc.ctl* it says:-
> >
> > *ga-> fprintf ts ts.txt
> > Unknown command: fprintf
> >
> > *
> >
> > I'm using Linux Ubuntu 12.04 LTS and GrADS 2.0.a9 and have downloaded the
> > coding of fprintf script from
> >
> >
> > http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Saving_GrADS_variable_data_to_a_text_file
> >
> > What is the issue?? Where to save the *fprintf.gs *file in order to get
> > the script workable ???
> > *
> > Regards
> >
> > Uzair Mannan*
> >
> > _______________________________________________
> > 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/20130828/f71ff1da/attachment-0001.html
> 
> ------------------------------
> 
> Message: 4
> Date: Wed, 28 Aug 2013 17:58:41 +0530
> From: "Jayakrishnan P.R" <prjayakrishnan at gmail.com>
> Subject: Re: [gradsusr] fprintf query...
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID:
>         <CA+P5ZEFejTOcfZ7bqHP0YJcxUUFAA9OnAAf_rzwW+zQ2Nj3POg at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Install open grads instead of grads2.9b. Then it will work.
> 
> 
> --
> Sincerely
> ***********************************************
> Jayakrishnan.P.R
> Teaching Associate (Atmospheric Science)
> Academy of Climate Change Education and Research
> Kerala Agricultural University
> Vellanikkara-680 656
> 
> and also
> 
> Research Fellow (Part Time)
> Department of Atmospheric Sciences
> CUSAT, Cochin-682 016
> Kerala, India.
> Mob: 09496026547
> 
> ***********************************************
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130828/84b0cf41/attachment-0001.html
> 
> ------------------------------
> 
> Message: 5
> Date: Wed, 28 Aug 2013 19:22:00 +0530 (IST)
> From: "M.Mahakur" <mmahakur at tropmet.res.in>
> Subject: Re: [gradsusr] fprintf query...
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID:
>         <226385595.34149.1377697920201.JavaMail.root at cluster1.tropmet.res.in>
> Content-Type: text/plain; charset=utf-8
> 
> Ver. 2.9b? I guess this version is not yet released. fprintf.gs will work for ver-1.9 also. It needs 'gxout print' option which is available since ver. 1.9.
> 
> ----- Original Message -----
> From: Jayakrishnan P.R <prjayakrishnan at gmail.com>
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Sent: Wed, 28 Aug 2013 17:58:41 +0530 (IST)
> Subject: Re: [gradsusr] fprintf query...
> 
> Install open grads instead of grads2.9b. Then it will work.
> 
> 
> --
> Sincerely
> ***********************************************
> Jayakrishnan.P.R
> Teaching Associate (Atmospheric Science)
> Academy of Climate Change Education and Research
> Kerala Agricultural University
> Vellanikkara-680 656
> 
> and also
> 
> Research Fellow (Part Time)
> Department of Atmospheric Sciences
> CUSAT, Cochin-682 016
> Kerala, India.
> Mob: 09496026547
> 
> ***********************************************
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Wed, 28 Aug 2013 11:12:01 -0400
> From: Jennifer Adams <jma at cola.iges.org>
> Subject: Re: [gradsusr] Help multi-panel plots on a page
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID: <18654509-813A-44CC-A581-CDB5D2CE1743 at cola.iges.org>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> 
> On Aug 28, 2013, at 2:00 AM, Zilore Mumba wrote:
> 
> > As my earlier post had no heading, I am reposting the same in the hope that it may be seen and I can get help.
> > I hope someone can find time to explain to me a few things on panel plots.
> > In the panles_demo.gs (snippet below),I do not understand the following:
> >
> > 1. for four plots on a page I loop through p=1 to p=4, why do we display t
> > (I want to display what I have in my file;
> The display of variable 't' in the panels_demo script is only for demonstration purposes. Of course, you can plot any variable or expression you want to.
> > 2. what is the global variable defined by _vpg.p in this script?
> That is a script variable that contains the 'set vpage' command for panel number p.
> 
> > 3. How do I put a title corresponding to the graphic validity time, on each
> > plot?
> One way to do this is to invoke 'q time' and parse the output to get a string that specifies the time that corresponds to your plot and then use 'set string' and 'draw string' to draw it above your plot. Below is a code snippet that I use for this purpose:
> 
> function mydate
>   'query time'
>   sres = subwrd(result,3)
>   wday = subwrd(result,6)
>   i = 1
>   while (substr(sres,i,1)!='Z')
>     i = i + 1
>   endwhile
>   hour = substr(sres,1,i)
>   isav = i
>   i = i + 1
>   while (substr(sres,i,1)>='0' & substr(sres,i,1)<='9')
>     i = i + 1
>   endwhile
>   day = substr(sres,isav+1,i-isav-1)
>   month = substr(sres,i,3)
>   year = substr(sres,i+3,4)
>   return (hour' 'wday' 'day' 'month' 'year)
> 
> --Jennifer
> 
> > Help will be appreciated.
> > Zilore Mumba
> >
> >   rc = gsfallow("on")
> >   if (args='')
> >     say 'Two arguments are required: the # of rows and # of columns'
> >     return
> >   else
> >     nrows = subwrd(args,1)
> >     ncols = subwrd(args,2)
> >   endif
> >
> >   'use wrfout_d01_2013-07-27_00.ctl'
> >   'reset'
> >   panels(args)
> >   p = 1
> >   ptot = nrows * ncols
> >   'set mproj scaled'
> >
> > * Loop through each panel and draw a plot
> >   while (p <= ptot)
> >     _vpg.p
> >     'set t 'p
> >     'set grads off'
> >     'd t'
> >     p = p + 1
> >   endwhile
> > _______________________________________________
> > gradsusr mailing list
> > gradsusr at gradsusr.org
> > http://gradsusr.org/mailman/listinfo/gradsusr
> 
> --
> Jennifer M. Adams
> Center for Ocean-Land-Atmosphere Studies (COLA)
> 111 Research Hall, Mail Stop 2B3
> George Mason University
> 4400 University Drive
> Fairfax, VA 22030
> 
> 
> 
> 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130828/cb500b1a/attachment-0001.html
> 
> ------------------------------
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
> 
> 
> End of gradsusr Digest, Vol 42, Issue 33
> ****************************************
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer M. Adams
Center for Ocean-Land-Atmosphere Studies (COLA)
111 Research Hall, Mail Stop 2B3
George Mason University
4400 University Drive
Fairfax, VA 22030 





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130829/e69eea70/attachment-0003.html 


More information about the gradsusr mailing list