[gradsusr] RMSE for accumulated Rainfall

Amulya Chevuturi amulya.chevuturi at gmail.com
Wed May 15 03:55:16 EDT 2013


Hello,

Another script that I have run and modified for Lyndon files as an example
is given below. Hopefully this might add to what Mr. Jeff has already
stated.

'reinit'
'open obsnudge/observation_nudging.ctl'
'set t 2 5'
 ...........................................................................................(write
whatever time step you want)
'define rn1=(rainc+rainnc)'
'define rn2=(rainc(t-1)+rainnc(t-1))'
'define rnA=rn1-rn2'
'close 1'
'open model/fnl_nonudging.ctl'
t1 = 2
 .......................................................................(change
time step accordingly)
t2 = 5
while (t1 < (t2+1))
'set t ' t1
'define rn3=(rainc+rainnc)'
'define rn4=(rainc(t-1)+rainnc(t-1))'
'define rnb=rn3-rn4'
'define rnB=lterp(rnb,rnA)'   .........................................(if
your grid size of both files is same you can skip this step)
'define A1=(rnA-rnB)'
'define B1=sqrt(aave((A1*A1),lon=115,lon=135,lat=4,lat=25))'
'd B1'

a=subwrd(result,4)
res=write(rmse.csv,a,append)

t1 = t1+1
endwhile

'close 1'


Regards,
Amulya Chevuturi


On Wed, May 15, 2013 at 10:36 AM, Jeff Duda <jeffduda319 at gmail.com> wrote:

> You only use the dots (.) to denote arrays from different files.  Once you
> define new arrays in Grads (as you have done with rn), you do not need to
> use the dots to reference the array.  In fact, that is probably giving you
> an error since you only define rn once anyway (Grads does not assume you
> perform the operation on data with the same name from multiple files as far
> as I'm aware).  Here is what I would suggest if you are looking for text
> output of the area mean RMSE.
>
> 'set t 't1' 't2
> 'define fcstrain = rainc.1 + rainnc.1 - rainc.1(t-1) - rainnc.1(t-1)'
> 'define obsrain = rainc.2 + rainnc.2 - rainc.2(t-1) - rainnc.2(t-1)'
> 'define rainerror = fcstrain - obsrain'
> 'define sqerror = pow(rainerror,2)'
> 'define mse = amean(sqerror,lon=115,lon=135,lat=4,lat=25)'
> 'define rmse = sqrt(mse)'
>
> Here I have assumed you have script variables t1 and t2 defined before
> this section of code and that you are computing the RMSE of a precip
> accumulation interval defined by the difference between two adjacent time
> slices (as is indicated in your code).  I am also assuming you will have
> appropriate means of writing out the values to a file.  What you have done
> above is probably okay, although the way I've coded it, the array rmse will
> be a time series rather than a single value.  To me that sounds more
> efficient, although I'm not sure the write command will correctly write
> each data point out in the file.  You can also look into the script
> fprintf.gs, which you can find through a Google search.
>
> Hope this helps.
>
> Jeff Duda
>
>
> On Tue, May 14, 2013 at 9:32 PM, Lyndon Mark Olaguera <
> olagueralyndonmark429 at gmail.com> wrote:
>
>> Hello fellow grad user,
>>
>> i want to find the rmse for the accumulated rainfall,I pasted my sample
>> script below but it is not working..grads is giving an error.
>>
>> Any help will be appreciated.
>>
>>
>>
>> 'open obsnudge/observation_nudging.ctl'
>> 'open model/fnl_nonudging.ctl'
>> Time_val=2
>> Time_prev=1
>> 'set t 'Time_val
>> 'define rn=(rainc+rainnc)-(rainc(t='Time_prev')-rainnc(t='Time_prev'))'
>> 'd rn'
>> 'define dif=rn.1-rn.2'
>>  'define sq=dif*dif'
>>  'define am=amean(sq,lon=115,lon=135,lat=4,lat=25)'
>>  'define rmse=sqrt(am)'
>>  'd rmse'
>>  a=subwrd(result,4)
>>  output=a
>>  res=write(rmsewind_v.csv,output,append)
>>  'undefine dif'
>>  'undefine sq'
>>  'undefine am'
>>
>> Time_val=Time_val+1
>> Time_prev=Time_prev+1
>> endwhile
>> quit
>>
>>
>>
>> Lyndon
>>
>> _______________________________________________
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130515/02e772b8/attachment-0003.html 


More information about the gradsusr mailing list