reducing accumulated precipitation to hourly

Ming Pan (mpan@Princeton.EDU) mpan at PRINCETON.EDU
Sat Aug 16 21:10:40 EDT 2008


Theo ...

I was trying to do exactly the same thing a while ago. Here is my trick (a little confusing though) --

Say your control file is "wrf.ctl". Make a duplicate copy "wrf2.ctl" and change the TDEF such that it starts 1 hour later (leave everything else untouched). Open "wrf.ctl" and "wrf2.ctl", then "APCPsfc.1-APCPsfc.2" would be the hourly precipitation (for all t>1). When t=1, you fall back to "APCPsfc.1". This trick works only if the data files are not hourly.

ming

----- Original Message -----
From: Mark Sponsler <msponsler at COMCAST.NET>
Date: Saturday, August 16, 2008 8:43 pm
Subject: Re: reducing accumulated precipitation to hourly
To: GRADSUSR at LIST.CINECA.IT

> Thio,
> Perhaps a clumsy way to do it is to write the value out to a text
> file, then read it in again with each loop of the script.
> The other option is to create another variable (x_prev) and write
> the value there then read it in as required.
> If you want to save it for all previous values then create x1, x2,
> x3 etc and
> if time = 1 ; x1 = value ; endif
> if time = 2 ; x2 =  value ; endif
> if time = 3 ; x3 = value ; endif
> etc...
> A poor mans array.
> --
> Thanks,
> Mark
>
> -------------- Original message --------------
> From: Theo Carter <thibidottwo at HOTMAIL.COM>
> Hi to all,
>
> I have just started using the WRF-ARW (after using WRF-NMM) and it
> outputsprecip as an accumulated total through the forecast period.
>
> I need to display in hourly amounts using grads. My display field
> (calledby a menu button from the main script) outputs 10m wind
> along with SLP and
> precipitation every hour for 48 forecast hours.
>
> The time is set to _x earlier on in the run script and I wrote the
> following:
>
> ####################################################
> function rain()
> # printing out the first hour's precipitation
> if _x = 1
>  'set gxout contour'
>  'set cthick 2'
>  'set cmin 0.3'
>  'set ccolor rainbow'
>  'd APCPsfc'
>  'set cthick 3'
>  'set ccolor 4'
>  'set cmax 0.0001'
>  'set cint 0.1'
>  'd APCPsfc'
> # printing out all the following hours precipitation
> else
>  'define current = APCPsfc'
>  _x = _x - 1
>  'define last = APCPsfc'
>  _x = _x + 1
>  'define hourly = current-last'
>  'set gxout contour'
>  'set cthick 2'
>  'set cmin 0.3'
>  'set ccolor rainbow'
>  'd hourly'
>  'set cthick 3'
>  'set ccolor 4'
>  'set cmax 0.0001'
>  'set cint 0.1'
>  'd hourly'
>  'undefine last'
>  'undefine current'
>  'undefine hourly'
> endif
> return
> ######################################
>
> I have been struggling with this for a week, and reading through the
> script writing section, it appears that one cannot attach new
> values to
> a 'global variable' such as _x. How then else are you able to step
> backone hour so that you can retrieve that data to subtract it from
> thecurrent hour?
>
> Thanks for any help,
> Theo



More information about the gradsusr mailing list