[gradsusr] RMSE for accumulated Rainfall
Jeff Duda
jeffduda319 at gmail.com
Wed May 15 01:06:32 EDT 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130515/9d59acb9/attachment-0003.html
More information about the gradsusr
mailing list