Hi Jimmy,
Ferret is all about creating definitions for the entire region that's
in effect when an action is taken. All of the LET commands simply make
definitions,
none of which are applied until we load the data into memory. This
happens on a plotting command, a LOAD command, or a command to list or
save data to a file.
You can also force evaluation when the result is going to be a
constant, by using -the grave accent syntax. This would evaluate the
expression, and put the scalar result in a1:
let a1 = `a[i=1:199@sum,j=1:199@sum,k=1,l=1]`
I don't see anything wrong with your commands, but it's hard to spot
possible problems without seeing the data. One way to debug scripts
like this is to make plots as you go along, or use the STAT command.
After defining a mask or variable, try commands like
stat mask
shade a
Another helpful hint is that if you do not specify an ELSE, then a mask
takes on the bad value. This can sometimes be useful. Compare
let mask = IF apcp[i=1:199,j=1:199,k=1,d=1] GE 100 then 1 else 0 ;
shade mask
let mask = IF apcp[i=1:199,j=1:199,k=1,d=1] GE 100 then 1 ; shade
mask
jimmyc@iastate.edu wrote:
Hi all-
I am doing some meteorological verification, computing equitable threat
score. I want to use multiple thresh-holds. my jnl file is attached.
As of now, I specify the thresh-hold I want to compute the Equitable
threat score. How can I repeat this calculation for a series of
thresh-holds and plot the result as a line plot (value vs thresh-hold)?
Can you store the values one at a time in an array variable?
Comments or help would be appreciated.
Thanks
!obs file stage4
use $1
!model file from WRF
use $2
!define threshhold mask
let mask = IF apcp[i=1:199,j=1:199,k=1,d=1] GE $3 AND apcp[i=1:199,j=1:199,k=1,d=1] LT 500 then 1 else 0
!let mask1 = IF rainnc[i=1:200,j=1:200,l=1]+rainc[i=1:200,j=1:200,l=1] GE $3 then 1
let mask1 = IF e065[i=1:199,j=1:199,l=1,d=2] GE $3 then 1 else 0
!a is hits yes-yes
let a = IF mask EQ mask1 AND mask EQ 1 then 1
let a1 = a[i=1:199@sum,j=1:199@sum]
!b is forecast yes obs no
let b = IF mask1 EQ 1 AND mask EQ 0 then 1
let b1 = b[i=1:199@sum,j=1:199@sum]
!c is forecast no obs yes
let c = IF mask1 EQ 0 AND mask EQ 1 then 1
let c1 = c[i=1:199@sum,j=1:199@sum]
!d is no no
let d = IF mask EQ mask1 AND mask EQ 0 then 1
let d1 = d[i=1:199@sum,j=1:199@sum]
!ar is a+b * a+c / a +b +c +d
let ar = ((a1+b1)*(a1+c1))/(a1+b1+c1+d1)
let ets = (a1-ar)/(a1+b1+c1-ar)
let bias = (a1+b1)/(a1+c1)
! bias and ETS are calculated
message/continue "ETS and bias are calculated"
|