swirlspy.ver package

Submodules

swirlspy.ver.crosstab module

swirlspy.ver.crosstab.contingency(threshold, forecast, observed)

Generates contingency table statistics for traditional binary verification

Parameters:
  • threshold (float) – Threshold value of variable for verification.
  • forecast (xarray) – An xarray containing forecasted values of variable
  • observed (xarray) – An xarray containing observed values of variable
Returns:

contingency – tuple structure is (hit, miss, false_alarm, corrneg)

Return type:

tuple

Notes

hit: int
number of hits
miss: int
number of misses
false_alarm: int
number of false alarms
corrneg: int
number of correct negatives

swirlspy.ver.metric module

swirlspy.ver.metric.FSS(threshold, forecast, observed, winsize)

Generates FSS

Parameters:
  • threshold (float) – Threshold value of variable for verification.
  • forecast (numpy array) – An xarray containing forecasted values of variable
  • observed (numpy array) – An xarray containing observed values of variable
  • winsize (int) – Window size
Returns:

fss – FSS score

Return type:

float

swirlspy.ver.metric.accuracy(cont)

Calculates accuracy

Parameters:cont (tuple) – contingency tuple (refer to swirlspy.ver.crosstab)
Returns:accuracy – accuracy = (hit+corrneg)/total and total = hit+miss+false_alarm+corrneg
Return type:float
swirlspy.ver.metric.csi(cont)

Calculates Critical Success Index

Parameters:cont (tuple) – contingency tuple (refer to swirlspy.ver.crosstab)
Returns:critical success index – csi = hit/(hit+false_alarm+miss)
Return type:float
swirlspy.ver.metric.ets(cont)

Returns Equitable Threat Score[0 = no skill][1 = perfect]

Parameters:cont (tuple) – contingency tuple (refer to swirlspy.ver.crosstab)
Returns:equitable threat score – ets = (hit - hit_expected)/(hit+miss+false_alarm-hit_expected) where hit_expected = hit+miss)*(hit+false_alarm)/total and total = hit + miss + false_alarm + corrneg
Return type:float
swirlspy.ver.metric.far(cont)

Calculates False Alarm Ratio

Parameters:cont (tuple) – contingency tuple (refer to swirlspy.ver.crosstab)
Returns:false alarm ratio – far = false_alarm/(hit+false_alarm)
Return type:float
swirlspy.ver.metric.freq_bias(cont)

Calculates Frequency Bias

Parameters:cont (tuple) – contingency tuple (refer to swirlspy.ver.crosstab)
Returns:frequency bias – freq_bias = (hit+false_alarm)/(hit+miss)
Return type:float or int
swirlspy.ver.metric.hss(cont)

Calculates Heidke Skill Score [0 = no skill][1=perfect]

Parameters:cont (tuple) – contingency tuple (refer to swirlspy.ver.crosstab)
Returns:Heidke Success Score – hss = (hit+corrneg-hit_corrneg_expected)/(total-hit_corrneg_expected) and hit_corrneg_expected = ((hit+miss)*(hit+false_alarm) (false_alarm+corrneg) * (miss+corrneg)) / total
Return type:int or float
swirlspy.ver.metric.pod(cont)

Calculates Probability of Detection

Parameters:cont (tuple) – contingency tuple (refer to swirlspy.ver.crosstab)
Returns:probability of detection – pod = hit/(hit+miss)
Return type:float
swirlspy.ver.metric.pofd(cont)

Calculates Probability of False Detection

Parameters:cont (tuple) – contingency tuple (refer to swirlspy.ver.crosstab)
Returns:probability of false detection – pofd = false_alarm/(false_alarm + corrneg)
Return type:float