Re: How to calculate Threat Score in NCL

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 02 2011 - 05:59:33 MDT

    TS = hits / (hits + misses + false alarms)

No need for a function. You can compute the counts
of each category via num or dim_num_n (dim_num).

Note that either the numerator or the denominator
must be converted to type float (tofloat) to avoid
integer division which would always return 0.

    hits = num(...) ; dim_num_n(...)
    misses = num(...) ; dim_num_n(...)
    false_alarms = num(...) ; dim_num_n(...)

    TS = tofloat(hits)/(hits + misses + false alarms)
    TS@long_name = "Threat Score"

You can create your own function.

function threat_score (...)
begin
     :
    return(TS)
end

http://www.ncl.ucar.edu/Document/Functions/Built-in/num.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_num_n.shtml

Good luck

On 11/1/11 3:00 AM, ChenFeng wrote:
> Dear all,
>
> Is there any function can be used for calculating the Threat Score(TS)?
>
> Best Wishes!
>
> Feng
> 2011-11-01
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Nov 2 05:59:40 2011

This archive was generated by hypermail 2.1.8 : Fri Nov 04 2011 - 08:43:41 MDT