[gradsusr] How to combine ctl files in grads?

James T. Potemra jimp at hawaii.edu
Wed Oct 21 19:57:33 EDT 2015


It looks like you have both issues to deal with.  First, you have one 
time-step in each file, and one descriptor file per binary file.  
Second, you want to sum different times together.  For the template 
you'd have to modify the ctl file like

dset ^wrfprs_d01.%h2
options template

This will substitute the file names based on 2-digit hour (again, see 
http://www.iges.org/grads/gadoc/templates.html for the details).  Your 
file names don't actually have this, but rather +48, so I'm not sure how 
you want to get around this.

Next you need to change your tdef line (it has an increment of 1 month, 
and I think you want 3 hours).  If you had files with 03, 06, 09... in 
the name, the above would work with this:

tdef 3 linear 03Z23oct2015 3hr

After this you should be able to access different times, and then 
proceed with Jennifer's suggestion.  Alternately, you could use multiple 
descriptor files, but would have to address variables based on the 
appropriate ctl file (e.g., var.1, var.2, etc.).  Finally, you could 
concatenate all your binary files into one, then have a single 
descriptor file.

Jim


On 10/21/15 10:12 AM, giacomo tricarico wrote:
> Hi James, I've used Jennifer's script. Her answer was:
> "It sounds like what you want to do is change a 3-hourly time series 
> to a 6-hourly time series. And that you have to do with brute-force 
> coding by writing out a new file, one time step at a time, that adds 
> two 3hr accumulations to get the 6hr accumulation. Something generally 
> like this:"
>
> This is my actual situation:
> WRF-NMM gives me 48 hours of forecast, with steps of 3 hours (so 17 
> files precisely). So I can only have rain accumulated for 3 hours: 
> what I'm trying to do is having rain accumulated in 6 hours, or maybe 
> also 12h and 24h.
>
> WRF's files are processed by unipost and UPP, so that I have 17 files 
> that can be used by grads. An example is
> wrfprs_d01_00.ctl, like wrfprs_d01_03.ctl and so on 
> until wrfprs_d01_48.ctl.
>
> This is for example wrfprs_d01_48.ctl (+48h):
>
> dset ^wrfprs_d01.48
> index ^wrfprs_d01.48.idx
> undef 9.999E+20
> title wrfprs_d01.48
> *  produced by grib2ctl v0.9.13
> * command line options: -verf wrfprs_d01.48
> dtype grib 255
> pdef 93 87 lccr 40.251000 16.141000 1 1 40.805000 40.805000 16.914000 
> 1391 1430
> xdef 93 linear 16.141000 0.0165685317281457
> ydef 87 linear 40.251000 0.013
> tdef 1 linear 12Z23oct2015 1mo
> *  z has 26 levels, for prs
> zdef 26 levels
> 1000 975 950 925 900 875 850 825 800 775 750 700 650 600 550 500 450 
> 400 375 350 300 250 200 150 100 50
> vars 130
> ...
> ...
> *APCPsfc  0 61,1,0  ** surface Total precipitation [kg/m^2]*
> ...
> ...
> APCPsfc tough only gives me 3h accumulated precipitation, as I've said.
>
> So I'm trying to find the best solution for this :)
>
> Thanks Again
> ------------------------------------------------------------------------
> To: gradsusr at gradsusr.org
> From: jimp at hawaii.edu
> Date: Wed, 21 Oct 2015 09:32:36 -1000
> Subject: Re: [gradsusr] How to combine ctl files in grads?
>
> Giacomo,
>
> I'm now confused as to what you are trying to do.  You originally 
> wanted to combine two GrADS data descriptor files, so I presumed you 
> wanted to use the template option whereby you have one control file 
> for many binary files.  It now appears that you want to do some sort 
> of time integration (or summing?).  It might help if you give more 
> information on your descriptor files (ctl files) and binary files, for 
> example how is time defined in the ctl file and how do you define the 
> data file (DSET)? The message below suggests you might be trying to 
> access a time that is not defined.
>
> Jim
>
> On 10/21/15 9:10 AM, giacomo tricarico wrote:
>
>     Thanks Jennifer :)
>
>     I've put this:
>     'clear'
>     'set gxout fwrite'
>     'set fwrite -ap 'provafile
>     t=3
>     while (t<=tlast)
>     'set t 't
>     'd APCPsfc+APCPsfc(t-1)'
>     t=t+2
>     endwhile
>     'disable fwrite'
>
>     but I get:
>     Data Request Warning:  Request is completely outside file limits
>     Data Request Warning:  Request is completely outside file limits
>     Data Request Warning:  Request is completely outside file limits
>     Data Request Warning:  Request is completely outside file limits
>     Data Request Warning:  Request is completely outside file limits
>     Data Request Warning:  Request is completely outside file limits
>     Data Request Warning:  Request is completely outside file limits
>     Data Request Warning:  Request is completely outside file limits
>     ....
>
>     ------------------------------------------------------------------------
>     From: jma at cola.iges.org <mailto:jma at cola.iges.org>
>     Date: Wed, 21 Oct 2015 11:14:38 -0400
>     To: gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>     Subject: Re: [gradsusr] How to combine ctl files in grads?
>
>     It sounds like what you want to do is change a 3-hourly time
>     series to a 6-hourly time series. And that you have to do with
>     brute-force coding by writing out a new file, one time step at a
>     time, that adds two 3hr accumulations to get the 6hr accumulation.
>     Something generally like this:
>
>     ’set gxout fwrite’
>     ‘set fwrite -ap 'outfilename
>     * don’t forget to remove the outfile before you begin, otherwise
>     you’ll append to an existing file
>     t=3
>     while (t<=tlast)
>       ‘set t ‘t
>       'd p+p(t-1)’
>       t=t+2
>     endwhile
>     ‘disable fwrite’
>
>     —Jennifer
>
>
>
>
>     On Oct 20, 2015, at 3:46 PM, giacomo tricarico <mino-98 at hotmail.it
>     <mailto:mino-98 at hotmail.it>> wrote:
>
>         Hi, since in my GRADS's files (produced by WRF-NMM Unipost)
>         rain is in 3h steps, I would like to combine for example 2 ctl
>         files, so that in one I have 6h rain:
>         how could I do this?
>
>         Thanks,
>         Giacomo
>         _______________________________________________
>         gradsusr mailing list
>         gradsusr at gradsusr.org <mailto: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
>
>
>
>
>
>
>     _______________________________________________ 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 <mailto:gradsusr at gradsusr.org>
>     http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
> _______________________________________________ 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20151021/13b8646e/attachment-0001.html 


More information about the gradsusr mailing list