数值型检验指标
<p>[TOC]</p>
<pre><code class="language-python">%matplotlib inline
%load_ext autoreload
%autoreload 2
import meteva.method as mem
import numpy as np</code></pre>
<p><strong><em>通过随机函数生成测试数据,用于后续检验函数调用示例</em></strong></p>
<pre><code class="language-python">ob = np.random.rand(1000,10)
fo1 = np.random.rand(1000,10)
fo2 = np.random.rand(5,1000,10)</code></pre>
<h1>检验样本数</h1>
<p><strong><font face="黑体" color=blue size = 5>sample_count(ob, fo)</font></strong><br />
计算检验的样本数 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong> </p>
<pre><code class="language-python">mem.sample_count(ob,fo1) </code></pre>
<pre><code>10000</code></pre>
<pre><code class="language-python">mem.sample_count(ob,fo2)</code></pre>
<pre><code>10000</code></pre>
<h1>观测和预报的最大值</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_max(ob, fo,count = 1)</font></strong><br />
计算观测和预报的各自的最大值 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><strong>count</strong></td>
<td style="text-align: left;">大于或等于1的整数,count大于1时返回前count个最大值</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">若count = 1,返回一维数组,shape = (1+预报成员数据),其中第一个元素为观测的最小值,其余为预报的最小值;若count大于1,则返回2维数组,shape = (1+预报成员数,count)。</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.ob_fo_max(ob,fo1,count = 3) #单个预报时,返回size =2的数组</code></pre>
<pre><code>array([[0.99988582, 0.99981483, 0.99980289],
[0.99998054, 0.99994775, 0.99993407]])</code></pre>
<pre><code class="language-python">mem.ob_fo_max(ob,fo2,count = 3) #多个预报是 返回数组的size = 1+预报成员</code></pre>
<pre><code>array([[0.99988582, 0.99981483, 0.99980289],
[0.99999871, 0.99988283, 0.99979082],
[0.99994363, 0.99991286, 0.99990508],
[0.99974477, 0.99972238, 0.99968939],
[0.99993622, 0.99991401, 0.99990169],
[0.99994147, 0.99992098, 0.9999015 ]])</code></pre>
<h1>观测和预报的最小值</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_min(ob, fo,count = 1)</font></strong><br />
计算观测和预报的各自的最小值 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><strong>count</strong></td>
<td style="text-align: left;">大于或等于1的整数,count大于1时返回前count个最小值</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">若count = 1,返回一维数组,shape = (1+预报成员数据),其中第一个元素为观测的最小值,其余为预报的最小值;若count大于1,则返回2维数组,shape = (1+预报成员数,count)。</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.ob_fo_min(ob,fo1,count = 3) #单个预报时,返回size =2的数组</code></pre>
<pre><code>array([[1.21428261e-04, 1.72775537e-04, 1.94394798e-04],
[8.18321324e-05, 1.33914580e-04, 2.61665147e-04]])</code></pre>
<pre><code class="language-python">mem.ob_fo_min(ob,fo2,count = 3) #多个预报是 返回数组的size = 1+预报成员</code></pre>
<pre><code>array([[1.21428261e-04, 1.72775537e-04, 1.94394798e-04],
[2.16698219e-04, 2.95885269e-04, 3.38157557e-04],
[3.27280152e-05, 5.76060794e-05, 1.12827908e-04],
[2.45048371e-05, 2.94289585e-05, 8.90038443e-05],
[2.51692683e-05, 1.95430889e-04, 4.04739724e-04],
[4.02664963e-05, 1.14183596e-04, 2.39029090e-04]])</code></pre>
<h1>观测和预报的分位值</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_quantile(ob,fo,grade_list=[0.5])</font></strong><br />
将观测或预报按从小到大的顺序排序,再取排序位于某个百分比的数值</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><strong>grade_list</strong></td>
<td style="text-align: left;">分位列表,分位0.5 对应取值排序为50%的数值,分位0.1排序为10%的数值,即最小的10%位置的取值,0.9对应最大的10%位置的取值</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">若count = 1,返回一维数组,shape = (1+预报成员数据),其中第一个元素为观测的最小值,其余为预报的最小值;若count大于1,则返回2维数组,shape = (1+预报成员数,count)。</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">ob_s = np.arange(99,-1,-1)
fo_s = np.arange(0,100,1)
mem.ob_fo_quantile(ob_s,fo_s,grade_list = [0.1,0.5,0.9])</code></pre>
<pre><code>array([[10, 50, 90],
[10, 50, 90]])</code></pre>
<h1>观测和预报的累计值</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_sum(ob, fo)</font></strong><br />
计算观测和预报的各自的平均值 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一维数组,shape = (1+预报成员数据),其中第一个元素为观测的累计值,其余为预报的累计值</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.ob_fo_sum(ob,fo1) #单个预报时,返回size =2的数组</code></pre>
<pre><code>array([5000.19153365, 4966.41663316])</code></pre>
<pre><code class="language-python">mem.ob_fo_mean(ob,fo2) #多个预报是 返回数组的size = 1+预报成员</code></pre>
<pre><code>array([0.50001915, 0.4990528 , 0.49939082, 0.50014093, 0.50110047,
0.50023776])</code></pre>
<h1>观测和预报的平均值</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_mean(ob, fo)</font></strong><br />
计算观测和预报的各自的平均值 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一维数组,shape = (1+预报成员数据),其中第一个元素为观测的平均值,其余为预报的平均值</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.ob_fo_mean(ob,fo1) #单个预报时,返回size =2的数组</code></pre>
<pre><code>array([0.50001915, 0.49664166])</code></pre>
<pre><code class="language-python">mem.ob_fo_mean(ob,fo2) #多个预报是 返回数组的size = 1+预报成员</code></pre>
<pre><code>array([0.50001915, 0.4990528 , 0.49939082, 0.50014093, 0.50110047,
0.50023776])</code></pre>
<h1>观测和预报的降水强度</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_precipitation_strenght(Ob, Fo)</font></strong><br />
计算观测和预报各自的降水强度, 降水强度的计算步骤为:</p>
<ol>
<li>将降水量小于0.1的部分重置为0</li>
<li>降水强度=累计降水量/有降水的样本数 </li>
</ol>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一维数组,shape = (1+预报成员数据),其中第一个元素为观测的平均降水强度,其余为预报的平均降水强度</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">rain01_ob = np.random.randn(1000)
rain01_ob[rain01_ob&lt;0] = 0
rain01_fo = np.random.randn(2,1000)
rain01_fo[rain01_fo&lt;0] = 0</code></pre>
<pre><code class="language-python">print(&quot;观测和预报的平均降水强度分别是:&quot;)
mem.ob_fo_precipitation_strenght(rain01_ob,rain01_fo) #多个预报时 返回数组的size = 1+预报成员</code></pre>
<pre><code>观测和预报的平均降水强度分别是:
array([0.83612916, 0.8813213 , 0.88099958])</code></pre>
<h1>观测和预报的标准差</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_std(Ob, Fo)</font></strong><br />
计算观测和预报的各自数据集的标准差 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一维数组,shape = (1+预报成员数据),其中第一个元素为观测的标准差,其余为预报的标准差</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.ob_fo_std(ob,fo1) #单个预报时,返回size =2的数组</code></pre>
<pre><code>array([0.287553 , 0.28732152])</code></pre>
<pre><code class="language-python">mem.ob_fo_std(ob,fo2) #多个预报是 返回数组的size = 1+预报成员</code></pre>
<pre><code>array([0.287553 , 0.28866137, 0.29170466, 0.29000675, 0.28601637,
0.28751598])</code></pre>
<h1>观测和预报的标准差</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_cv(Ob, Fo)</font></strong><br />
计算观测和预报的各自数据集的离差 = 标准差 / 平均值</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一维数组,shape = (1+预报成员数据),其中第一个元素为观测的离差,其余为预报的离差</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.ob_fo_cv(ob,fo1) #单个预报时,返回size =2的数组</code></pre>
<pre><code>array([0.57508397, 0.57852884])</code></pre>
<h1>观测和预报的降水强度</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_precipitation_strength(Ob, Fo)</font></strong><br />
计算观测和预报的各自数据集的离差 = 标准差 / 平均值</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一维数组,shape = (1+预报成员数据),其中第一个元素为观测的降水强度,其余为预报的降水强度</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.ob_fo_precipitation_strength(ob,fo1) #单个预报时,返回size =2的数组</code></pre>
<pre><code>array([0.54912065, 0.54853963])</code></pre>
<h1>准确率</h1>
<p><strong><font face="黑体" color=blue size = 5>correct_rate(ob,fo,grade_list = [2])</font></strong><br />
根据设定的阈值,计算两组数据的误差绝对值小于阈值的比例 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>grade_list</font></strong></td>
<td style="text-align: left;">判断为准确的误差阈值列表,误差绝对值小于等于阈值的样本记为正确,可以在grade_list 同时设置多个阈值进行检验</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),当grade_list 长度为1时返回结果为实数,长度不为1时返回一维数组;如果fo比ob高出一维,当grade_list长度为1时则返回1维数组,size等于预报成员数,当grade_list长度不为1时,返回2维数组 shape = (预报成员数,阈值数)。每个元素是0到1的实数,最优值为1,</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.correct_rate(ob,fo1,[0.5]) #单个预报时,返回实数</code></pre>
<pre><code>0.751</code></pre>
<pre><code class="language-python">mem.correct_rate(ob,fo2,[0.5,1]) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([[0.7447, 1. ],
[0.7447, 1. ],
[0.7444, 1. ],
[0.7547, 1. ],
[0.7539, 1. ]])</code></pre>
<h1>错误率</h1>
<p><strong><font face="黑体" color=blue size = 5>wrong_rate(ob,fo,grade_list = [2],unit = 1)</font></strong><br />
根据设定的阈值,计算两组数据的误差绝对值大于阈值的比例 , 它等于1 - 准确率 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>grade_list</font></strong></td>
<td style="text-align: left;">判断为错误的误差阈值列表,误差绝对值大于阈值的样本记为错误,可以在grade_list 同时设置多个阈值进行检验</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>unit</font></strong></td>
<td style="text-align: left;">该值为缺省值1时,返回0-1的结果,当unit = "%"时,返回0-100的结果,即返回值的单位是%,设置unit="%"更加适合用于制作需要填值的绘图场景,因为"45" 比"0.45"的节省了2个字符</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),当grade_list 长度为1时返回结果为实数,长度不为1时返回一维数组;如果fo比ob高出一维,当grade_list长度为1时则返回1维数组,size等于预报成员数,当grade_list长度不为1时,返回2维数组 shape = (预报成员数,阈值数)。每个元素是0到1的实数(unit=1)或者0-100的实数(unit = "%"),最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong> </p>
<pre><code class="language-python">mem.wrong_rate(ob,fo1,[0.5,1]) #单个预报时,返回实数</code></pre>
<pre><code>array([[0.249, 0. ]])</code></pre>
<h1>平均误差</h1>
<p><strong><font face="黑体" color=blue size = 5>me(ob,fo,weight = None)</font></strong><br />
计算两组数据的误差平均值 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;">weight</td>
<td style="text-align: left;">每个数据样本的权重,weight.shape和ob.shape完全一致,在进行格点数据检验时通常需要以格点代表的实际面积作为权重进行统计。如果用户透视分析模块进行网格预报的检验,其中middle_df_grd会自动设置权重参数,用户一般情况下不需要手动设置该参数</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是负无穷到正无穷的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.me(ob,fo1) #单个预报是返回实时</code></pre>
<pre><code>-0.0033774900487793815</code></pre>
<pre><code class="language-python">mem.me(ob,fo2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([-0.00096636, -0.00062833, 0.00012178, 0.00108132, 0.00021861])</code></pre>
<h1>平均绝对误差</h1>
<p><strong><font face="黑体" color=blue size = 5>mae(ob,fo,weight = None)</font></strong><br />
计算两组数据平均绝对值误差 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是0到正无穷的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.mae(ob,fo1) #单个预报是返回实时</code></pre>
<pre><code>0.3307996002230266</code></pre>
<pre><code class="language-python">mem.mae(ob,fo2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([0.33646781, 0.33743355, 0.33710381, 0.33054487, 0.33278019])</code></pre>
<h1>均方误差</h1>
<p><strong><font face="黑体" color=blue size = 5>mse(Ob,Fo,weight = None)</font></strong><br />
计算两组数据误差平方的平均 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;">weight</td>
<td style="text-align: left;">每个数据样本的权重,weight.shape和ob.shape完全一致,在进行格点数据检验时通常需要以格点代表的实际面积作为权重进行统计。如果用户透视分析模块进行网格预报的检验,其中middle_df_grd会自动设置权重参数,用户一般情况下不需要手动设置该参数</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是0到正无穷的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.mse(ob,fo1) #单个预报是返回实时</code></pre>
<pre><code>0.1642407332902462</code></pre>
<pre><code class="language-python">mem.mse(ob,fo2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([0.1684721 , 0.17021608, 0.1692365 , 0.16439587, 0.16609746])</code></pre>
<h1>均方根误差</h1>
<p><strong><font face="黑体" color=blue size = 5>rmse(ob,fo,weight = None)</font></strong><br />
计算两组数据的均方根误差 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;">weight</td>
<td style="text-align: left;">每个数据样本的权重,weight.shape和ob.shape完全一致,在进行格点数据检验时通常需要以格点代表的实际面积作为权重进行统计。如果用户透视分析模块进行网格预报的检验,其中middle_df_grd会自动设置权重参数,用户一般情况下不需要手动设置该参数</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是0到正无穷的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.rmse(ob,fo1) #单个预报是返回实时</code></pre>
<pre><code>0.4052662498780847</code></pre>
<pre><code class="language-python">mem.rmse(ob,fo2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([0.41045353, 0.41257252, 0.41138364, 0.40545761, 0.40755056])</code></pre>
<h1>最大绝对误差</h1>
<p><strong><font face="黑体" color=blue size = 5>max_abs_error(ob,fo)</font></strong><br />
计算两组数据误差绝对值的最大值 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是0到正无穷的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.max_abs_error(ob,fo2)</code></pre>
<pre><code>array([0.99694802, 0.99197974, 0.99501739, 0.99223593, 0.98665917])</code></pre>
<h1>最大误差</h1>
<p><strong><font face="黑体" color=blue size = 5>max_error(ob,fo)</font></strong><br />
计算两组数据误差的最大值 </p>
<h1>最小误差</h1>
<p><strong><font face="黑体" color=blue size = 5>min_error(ob,fo)</font></strong><br />
计算两组数据误差的最大值 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是负无穷到正无穷的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.max_error(ob,fo2)</code></pre>
<pre><code>array([0.97565559, 0.98459515, 0.98610858, 0.99223593, 0.98186309])</code></pre>
<pre><code class="language-python">mem.min_error(ob,fo2)</code></pre>
<pre><code>array([-0.99694802, -0.99197974, -0.99501739, -0.98200709, -0.98665917])</code></pre>
<h1>均值偏差</h1>
<p><strong><font face="黑体" color=blue size = 5>bias_m(ob,fo)</font></strong><br />
计算两组数据的平均值之比 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是0到正无穷的实数,最优值为1</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.bias_m(ob,fo1) #单个预报是返回实时</code></pre>
<pre><code>0.9932452786537236</code></pre>
<pre><code class="language-python">mem.bias_m(ob,fo2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([0.99806736, 0.99874338, 1.00024354, 1.00216256, 1.0004372 ])</code></pre>
<h1>相关系数</h1>
<p><strong><font face="黑体" color=blue size = 5>corr(ob,fo,weight = None)</font></strong><br />
计算两组数据相关系数 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;">weight</td>
<td style="text-align: left;">每个数据样本的权重,weight.shape和ob.shape完全一致,在进行格点数据检验时通常需要以格点代表的实际面积作为权重进行统计。如果用户透视分析模块进行网格预报的检验,其中middle_df_grd会自动设置权重参数,用户一般情况下不需要手动设置该参数</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是-1到1的实数,最优值为1</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.corr(ob,fo1) #单个预报是返回实时</code></pre>
<pre><code>0.006118730891288423</code></pre>
<pre><code class="language-python">mem.corr(ob,fo2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([-0.01481259, -0.01452869, -0.01466466, 0.00059206, -0.00450701])</code></pre>
<h1>秩相关</h1>
<p><strong><font face="黑体" color=blue size = 5>corr_rank(ob,fo)</font></strong><br />
分别计算观测和预报数据的数据秩(每个元素在数组中的排序序号),然后计算观测数据秩和预报数据秩的相关系数。秩相关系数对大的异常值不敏感。 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是-1到1的实数,最优值为1</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.corr_rank(ob,fo1) #单个预报是返回实时</code></pre>
<pre><code>0.0062353689503537035</code></pre>
<pre><code class="language-python">mem.corr_rank(ob,fo2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([-0.01493915, -0.01457154, -0.01466411, 0.00062558, -0.00453371])</code></pre>
<h1>残差率</h1>
<p><font face="黑体" color=blue size = 5>residual_error_rate(ob,fo)</font><br />
计算线性回归的残差率,等于 (1 - corr * corr) ^0.5 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是0到1的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.residual_error_rate(ob,fo1) #单个预报是返回实时</code></pre>
<pre><code>0.9999812803909282</code></pre>
<h1>残差</h1>
<p><strong><font face="黑体" color=blue size = 5>residual_error(ob,fo)</font></strong><br />
计算基于预报对实况进行回归后所得残差, = 残差率 * 观测数据的标准差 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是0到无穷大的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.residual_error(ob,fo1) #单个预报是返回实时</code></pre>
<pre><code>0.28754761822327024</code></pre>
<h1>定量相对误差</h1>
<p><strong><font face="黑体" color=blue size = 5>mre(ob,fo)</font></strong><br />
对每一对观测和预报不同时为0的数据计算(预报-观测)/(预报+观测)取绝对值后再做平均</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是0到1的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.mre(ob,fo1) #单个预报是返回实时</code></pre>
<pre><code>0.38498205655121037</code></pre>
<pre><code class="language-python">mem.mre(ob,fo2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([0.38990022, 0.39068891, 0.39000513, 0.3837708 , 0.38506937])</code></pre>
<h1>纳什系数</h1>
<p><strong><font face="黑体" color=blue size = 5>nse(ob,fo)</font></strong><br />
水文中常用的降水检验方法,计算方法为:1 - 均方误差/观测方差 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是负无穷到1的实数,最优值为1</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.nse(ob,fo1) #单个预报是返回实时</code></pre>
<pre><code>-0.9863010229355293</code></pre>
<pre><code class="language-python">mem.nse(ob,fo2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([-1.03747446, -1.05856593, -1.04671902, -0.98817726, -1.00875597])</code></pre>
<h1>均方根倍差</h1>
<p><strong><font face="黑体" color=blue size = 5>rmsf(ob,fo)</font></strong><br />
对于观测和预报之间比值偏离1的程度进行综合度量,计算方法为:</p>
<p>$RMSF =exp(\sqrt[]{\frac{1}{N}\sum_{i=1}^N{[log(\frac{F_i}{O_i})^2]}}) $ </p>
<p>上述公式中仅统计观测和预报降水量都达到0.1mm的样本对,或者观测预报有一者达到1.0mm的样本对,入选的样本对中如果观测或预报小于0.1mm,则会被强制设置为0.1mm。</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是1到无穷的实数</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong> </p>
<pre><code class="language-python">mem.rmsf(ob,fo1) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>2.2837481426081268</code></pre>
<pre><code class="language-python">mem.rmsf(ob,fo2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([2.30992783, 2.31484303, 2.3037976 , 2.28786635, 2.28161919])</code></pre>
<h1>跨量级降水预报评分PAS</h1>
<p><strong><font face="黑体" color=blue size = 5>pas(ob,fo,grade_list = [0.1])</font></strong><br />
针对传统和改进的降水评分方法中存在降水量阈值的划分导致评分失真,以及邻域空间检验方法的尺度设定带来主观性风险增大等问题,通过直接分析降水预报量和实况量的接近程度,构建了一套新的降水预报跨量级通用综合评价方法(General Comprehensive Evaluation Method for Cross-scale Precipitation Forecasts,GCEM),适用于评估包括一般和极端等各类降水事件,可以全面反映降水预报的性能和特征,其降水准确度评分(Precipitation Accuracy Score,PAS)方法与当今主流的TS、ETS降水检验方法相比有明显优势和推广应用价值。具体评分算法参考文献 <a href="https://gmd.copernicus.org/articles/17/4579/2024/">https://gmd.copernicus.org/articles/17/4579/2024/</a></p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><strong>grade_list</strong></td>
<td style="text-align: left;">样本过滤降水量阈值参数,总样本中实况>=降水量阈值 或 预报>=降水量阈值 的站点(格点)样本会被保留,否则会被作为无关样本在检验中剔除,当同时计算多种降水量阈值对应的pas评分时,grade_list中的元素就是多种降水量阈值的列表</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报)当仅有一个等级,则返回结果为实数,当有多个等级,则返回1维数组,shape = (等级数);如果fo比ob高出一维,则返回2维数组,shape = (预报成员数,等级数)。其中每个元素为0到1的实数,完美预报对应值为1,如果达到某个降水阈值的实况和预报样本数都为0,则该等级对应的pas评分为缺省值999999</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong> </p>
<pre><code class="language-python">mem.pas(ob,fo1) #单个预报,单个等级是返回实数</code></pre>
<pre><code>0.9248574154275861</code></pre>
<pre><code class="language-python">mem.pas(ob,fo1,grade_list = [0.1,10]) #单个预报,多个等级时返回数组,size = 预报成员数</code></pre>
<pre><code>array([9.24857415e-01, 9.99999000e+05])</code></pre>
<pre><code class="language-python">mem.pas(ob,fo2,grade_list = [0.1,10]) #多个预报,多个等级时返回二维数组,shape=[预报成员数,等级数]</code></pre>
<pre><code>array([[9.25417223e-01, 9.99999000e+05],
[9.24821636e-01, 9.99999000e+05],
[9.24465740e-01, 9.99999000e+05],
[9.26896927e-01, 9.99999000e+05],
[9.25940413e-01, 9.99999000e+05]])</code></pre>
<h1>跨量级降水预报晴雨准确率PASC</h1>
<p><strong><font face="黑体" color=blue size = 5>pasc(ob,fo)</font></strong><br />
降水预报跨量级通用综合评价方法(General Comprehensive Evaluation Method for Cross-scale Precipitation Forecasts,GCEM),下的改进的晴雨准确率,评分取值范围是0至1,最优值为1。具体评分算法参考文献 <a href="https://gmd.copernicus.org/articles/17/4579/2024/">https://gmd.copernicus.org/articles/17/4579/2024/</a></p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是1到无穷的实数</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong> </p>
<pre><code class="language-python">mem.pasc(ob,fo1) #单个预报,单个等级是返回实数</code></pre>
<pre><code>0.9256388983071392</code></pre>
<pre><code class="language-python">mem.pasc(ob,fo2) #多个预报时返回一维数组,shape=[预报成员数]</code></pre>
<pre><code>array([0.92627493, 0.92554335, 0.9251531 , 0.92755486, 0.92658473])</code></pre>
<h1>跨量级降水预报欠量评分</h1>
<p><strong><font face="黑体" color=blue size = 5>ipi(ob,fo)</font></strong><br />
降水预报跨量级通用综合评价方法(General Comprehensive Evaluation Method for Cross-scale Precipitation Forecasts,GCEM),下评价降水偏弱程度的评分,评分取值范是-1到0,最优值为0。具体评分算法参考文献 <a href="https://gmd.copernicus.org/articles/17/4579/2024/">https://gmd.copernicus.org/articles/17/4579/2024/</a></p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是1到无穷的实数</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong> </p>
<pre><code class="language-python">mem.ipi(ob,fo1) #单个预报,单个等级是返回实数</code></pre>
<pre><code>-0.07644072528546321</code></pre>
<h1>跨量级降水预报过量评分</h1>
<p><strong><font face="黑体" color=blue size = 5>epi(ob,fo)</font></strong><br />
降水预报跨量级通用综合评价方法(General Comprehensive Evaluation Method for Cross-scale Precipitation Forecasts,GCEM),下评价降水偏强程度的评分,评分取值范是0到1,最优值为0。具体评分算法参考文献 <a href="https://gmd.copernicus.org/articles/17/4579/2024/">https://gmd.copernicus.org/articles/17/4579/2024/</a></p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是1到无穷的实数</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong> </p>
<pre><code class="language-python">mem.epi(ob,fo1) #单个预报,单个等级是返回实数</code></pre>
<pre><code>0.07379906365759209</code></pre>
<h1>跨量级降水预报偏量评分</h1>
<p><strong><font face="黑体" color=blue size = 5>iepi(ob,fo)</font></strong><br />
降水预报跨量级通用综合评价方法(General Comprehensive Evaluation Method for Cross-scale Precipitation Forecasts,GCEM)下评价降水强度偏离实况程度的评分,IEPI小于0表示样本整体为欠量预报,大于0表示样本整体为过量预报,评分取值范是-1到1,最优值为0。具体评分算法参考文献 <a href="https://gmd.copernicus.org/articles/17/4579/2024/">https://gmd.copernicus.org/articles/17/4579/2024/</a></p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比Ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">如果fo和ob的shape一致(即只有一种预报),返回结果为实数;如果fo比ob高出一维,则返回1维数组,长度等于预报成员数。每个元素是1到无穷的实数</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong> </p>
<pre><code class="language-python">mem.iepi(ob,fo1) #单个预报,单个等级是返回实数</code></pre>
<pre><code>-0.0026112897933373035</code></pre>
<p>在以上示例中,观测和预报的数据都直接输入到评分函数中进行计算,然而有些情况下待检验的数据太大不能整体存入一个numpy数组中,或者不方便整体存入一个numpy数组中,此时就不能调用上面的方式调用评分函数。为此本程序库设计了一套可分块计算的检验程序。<br />
其检验步骤如下:<br />
<strong><em>步骤1:根据需要将分块数据逐一输入到中间结果计算函数</em></strong><br />
<strong><em>步骤2:将中间结果进行累加或合并</em></strong><br />
<strong><em>步骤3:根据累加或合并的中间结果计算检验指标</em></strong><br />
通常上述计算中步骤1是最耗费计算资源,为了提高效率步骤1也可以采用<strong>并行</strong>的方式执行。此外,步骤1执行的结果也可<strong>输出到文件</strong>中,在后续的检验可以从中读入部分中间结果执行后续步骤,从而可以实现各种方式的分组检验,大大提高检验计算效率。</p>
<h1>总样本数、正确的样本数</h1>
<p><strong><font face="黑体" color=blue size = 5>tc_count(ob,fo,grade_list = [2])</font></strong><br />
用来计算准确率和错误率等检验指标的中间量 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>grade_list</font></strong></td>
<td style="text-align: left;">判断为准确的误差阈值列表,误差绝对值小于等于阈值的样本记为正确,可以在grade_list 同时设置多个阈值进行检验</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一个numpy数组,fo.shape 比ob.shape多一维时,即fo包含多个预报成员时,array.shape= (预报成员数,1+等级数),fo.shape与ob.shape相同时结果为size=1+等级数 的一维数组,其中最后一维内容依次为总样本数、各阈值等级对应的正确的样本数</td>
</tr>
</tbody>
</table>
<h1>总样本数、误差总和、绝对误差总和、误差平方总和</h1>
<p><strong><font face="黑体" color=blue size = 5>tase(ob,fo,weight = None)</font></strong><br />
用来计算me、mae、mse、rmse、nse等检验指标的中间量 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;">weight</td>
<td style="text-align: left;">每个数据样本的权重,weight.shape和ob.shape完全一致,在进行格点数据检验时通常需要以格点代表的实际面积作为权重进行统计。如果用户透视分析模块进行网格预报的检验,其中middle_df_grd会自动设置权重参数,用户一般情况下不需要手动设置该参数</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一个numpy数组,fo.shape 比ob.shape多一维时,即fo包含多个预报成员时,array.shape= (预报成员数,4),fo.shape与ob.shape相同时结果为size=4的一维数组,其中最后一维内容依次为内容依次为总样本数、误差总和、绝对误差总和、误差平方总和</td>
</tr>
</tbody>
</table>
<h1>预报和观测值之和大于0样本数、相对误差绝对值总和</h1>
<p><strong><font face="黑体" color=blue size = 5>toar(ob,fo)</font></strong><br />
用来计算mre等检验指标的中间量 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一个numpy数组,fo.shape 比ob.shape多一维时,即fo包含多个预报成员时,array.shape= (预报成员数,2),fo.shape与ob.shape相同时结果为size=2的一维数组,其中最后一维内容依次为预报和观测值之和大于0样本数、相对误差绝对值总和</td>
</tr>
</tbody>
</table>
<h1>样本数、观测平均值、预报平均值、观测方差、预报方差、协方差</h1>
<p><strong><font face="黑体" color=blue size = 5>tmmsss(ob,fo,weight = None)</font></strong><br />
用来计算bias、corr、nse等检验指标的中间量 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;">weight</td>
<td style="text-align: left;">每个数据样本的权重,weight.shape和ob.shape完全一致,在进行格点数据检验时通常需要以格点代表的实际面积作为权重进行统计。如果用户透视分析模块进行网格预报的检验,其中middle_df_grd会自动设置权重参数,用户一般情况下不需要手动设置该参数</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一个numpy数组,fo.shape 比ob.shape多一维时,即fo包含多个预报成员时,array.shape= (预报成员数,6),fo.shape与ob.shape相同时结果为size=6的一维数组,其中最后一维内容依次为样本数、观测平均值、预报平均值、观测方差、预报方差、协方差</td>
</tr>
</tbody>
</table>
<h1>tmmsss逐一合并函数</h1>
<p><strong><font face="黑体" color=blue size = 5>tmmsss_merge(tmmsss0,tmmsss1)</font></strong><br />
用来将tmmsss计算得到的分块中间统计量进行合并,得到两块数据并集对应的统计量 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tmmsss0</font></strong></td>
<td style="text-align: left;">任意维numpy数组,最后一维size = 6,内容包括(样本数、观测平均值、预报平均值、观测方差、预报方差、协方差)</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tmmsss1</font></strong></td>
<td style="text-align: left;">shape和内容含义和tmmsss0一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">合并后的中间统计量,shape和内容含义和tmmsss0一致</td>
</tr>
</tbody>
</table>
<h1>tmmsss整体合并函数</h1>
<p><strong><font face="黑体" color=blue size = 5>tmmsss_merge_all(tmmsss_array)</font></strong><br />
如果有大量的分块中间量tmmsss需要合并,采用tmmsss_merge进行逐一合并的速度还是不够,此时可以采用tmmsss_merge_all来进行合并,效率可以大大提高。但是tmmsss_merge_all输入输入tmmsss_array只能是2维。</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tmmsss_array</font></strong></td>
<td style="text-align: left;">2维numpy数组,第一维代表不同分块,第2维size = 6,内容包括(样本数、观测平均值、预报平均值、观测方差、预报方差、协方差)</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">合并后的中间统计量,是一个包含(样本数、观测平均值、预报平均值、观测方差、预报方差、协方差)的一维数组</td>
</tr>
</tbody>
</table>
<h1>总样本数、倍差对数和</h1>
<p><strong><font face="黑体" color=blue size = 5>tlfo(ob,fo)</font></strong><br />
用来计算rmsf等检验指标的中间量 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一个numpy数组,fo.shape 比ob.shape多一维时,即fo包含多个预报成员时,array.shape= (预报成员数,2),fo.shape与ob.shape相同时结果为size=2的一维数组,其中最后一维内容依次为内容依次为符合计算rmsf的样本数、log(fo/ob)^2的总和</td>
</tr>
</tbody>
</table>
<h1>降水强度中间量</h1>
<p><strong><font face="黑体" color=blue size = 5>cscs(ob,fo)</font></strong><br />
用来计算rmsf等检验指标的中间量 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>ob</font></strong></td>
<td style="text-align: left;">实况数据, 任意维numpy数组</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>fo</font></strong></td>
<td style="text-align: left;">fo比ob.shape多一维或者保持一致,fo.shape低维与ob.shape保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一个numpy数组,fo.shape 比ob.shape多一维时,即fo包含多个预报成员时,array.shape= (预报成员数,2),fo.shape与ob.shape相同时结果为size=4的一维数组,其中最后一维内容依次为观测大于0.1mm的站次、观测降水量累加、预报大于0.1mm的站次、预报降水量累加</td>
</tr>
</tbody>
</table>
<pre><code class="language-python">#假设在本示例中ob和fo的数据不能或不便整体输入到检验函数中,可以采用如下方式分块计算检验的中间结果。
#再把中间结果进行相加或合并。
tase_array1 = np.zeros(4) #声明长度为4的数组存储最终合并后的中间统计量
tms_array1 = np.zeros(6) #声明长度为6的数组存储最终合并后的中间统计量
toar_array1 = np.zeros(2) #声明长度为2的数组存储最终合并后的中间统计量
tc_array1 = np.zeros(2)
tlfo_array1 = np.zeros(2)
cscs_array1 = np.zeros(4)
tms_array_list = []
for i in range(ob.shape[1]):
ob1 = ob[:,i] #获取分块数据
fo_piece1 = fo1[:,i]
tase1 = mem.tase(ob1,fo_piece1) #调用函数计算分块数据的中间统计量
tase_array1 += tase1 #通过数组累加可直接获得tase的合并结果
tms1 = mem.tmmsss(ob1,fo_piece1) #调用函数计算分块数据的中间统计量
tms_array1 = mem.tmmsss_merge(tms_array1,tms1) #需调用合并函数获得tmmsss的合并结果
tms_array_list.append(tms1)
toar1 = mem.toar(ob1,fo_piece1) #调用函数计算分块数据的中间统计量
toar_array1 += toar1 #通过数组累加可直接获得tase的合并结果
tc1 = mem.tc_count(ob1,fo_piece1,[0.5]) #调用函数计算分块数据的中间统计量
tc_array1 += tc1 #通过数组累加可直接获得tc_count的合并结果
tlfo1 = mem.tlfo(ob1,fo_piece1)
tlfo_array1 += tlfo1
cscs1 = mem.cscs(ob1,fo_piece1)
cscs_array1 += cscs1</code></pre>
<pre><code class="language-python">#存储中间结果的数组也可以是高维的,示例如下:
tase_array2 = np.zeros((5,4)) #声明长度为4的数组存储最终合并后的中间统计量
tms_array2 = np.zeros((5,6)) #声明长度为6的数组存储最终合并后的中间统计量)
toar_array2 = np.zeros((5,2)) #声明长度为2的数组存储最终合并后的中间统计量)
tc_array2 = np.zeros((5,2))
tlfo_array2 = np.zeros((5,2))
for i in range(ob.shape[1]):
ob1 = ob[:,i] #获取分块数据
fo_piece2 = fo2[...,i]
tase1 = mem.tase(ob1,fo_piece2) #调用函数计算分块数据的中间统计量
tase_array2 += tase1 #通过数组累加可直接获得tase的合并结果
tms1 = mem.tmmsss(ob1,fo_piece2) #调用函数计算分块数据的中间统计量
tms_array2 = mem.tmmsss_merge(tms_array2,tms1) #需调用合并函数获得tmmsss的合并结果
toar1 = mem.toar(ob1,fo_piece2) #调用函数计算分块数据的中间统计量
toar_array2 += toar1 #通过数组累加可直接获得tase的合并结果
tc1 = mem.tc_count(ob1,fo_piece2,[0.5]) #调用函数计算分块数据的中间统计量
tc_array2 += tc1 #通过数组累加可直接获得tc_count的合并结果
tlfo1 = mem.tlfo(ob1,fo_piece2)
tlfo_array2 += tlfo1</code></pre>
<pre><code class="language-python">#逐一合并的中间量(样本数、观测平均值、预报平均值、观测方差、预报方差、协方差)结果
tms_array1</code></pre>
<pre><code>array([1.00000000e+04, 5.00019153e-01, 4.96641663e-01, 8.26867284e-02,
8.25536585e-02, 5.05530566e-04])</code></pre>
<pre><code class="language-python">#整体合并的中间量(样本数、观测平均值、预报平均值、观测方差、预报方差、协方差)结果
tms_test = mem.tmmsss_merge_all(np.array(tms_array_list))
tms_test</code></pre>
<pre><code>array([1.00000000e+04, 5.00019153e-01, 4.96641663e-01, 8.26867284e-02,
8.25536585e-02, 5.05530566e-04])</code></pre>
<p>从上面的结果可以看出逐一合并和整体合并的计算结果是一样的。</p>
<p><strong>以下为根据合并后的中间统计量计算最终检验指标的函数:</strong> </p>
<h1>准确率(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>correct_rate_tc(tc_count_array)</font></strong><br />
计算两组数据误差小于阈值的比例 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tc_count_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为2,分别记录了总样本数和正确样本数,它通常是tc_count函数的计算结果,或者计算结果的累加</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比tc_count_array少了最后一维。其中每个元素为0到1的实数,最优值为1</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.correct_rate_tc(tc_array1) #单个预报是返回实时</code></pre>
<pre><code>0.751</code></pre>
<pre><code class="language-python">mem.correct_rate_tc(tc_array2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([0.7447, 0.7447, 0.7444, 0.7547, 0.7539])</code></pre>
<h1>错误率(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>wrong_rate_tc(tc_count_array,unit = 1)</font></strong><br />
计算两组数据误差大于阈值的比例 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tc_count_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为2,分别记录了总样本数和正确样本数,它通常是tc_count函数的计算结果,或者计算结果的累加</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>unit</font></strong></td>
<td style="text-align: left;">该值为缺省值1时,返回0-1的结果,当unit = "%"时,返回0-100的结果,即返回值的单位是%,设置unit="%"更加适合用于制作需要填值的绘图场景,因为"45" 比"0.45"的节省了2个字符</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比tc_count_array少了最后一维。每个元素是0到1的实数(unit=1)或者0-100的实数(unit = "%")</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.wrong_rate_tc(tc_array1) #单个预报是返回实时</code></pre>
<pre><code>0.249</code></pre>
<h1>平均误差(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>me_tase(tase_array)</font></strong><br />
计算两组数据的误差平均值 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tase_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为4,分别记录了样本数,误差和、绝对误差和,误差平方和,它通常是tase函数的计算结果,或者计算结果的累加</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比tase_array少了最后一维。其中每个元素为负无穷到正无穷的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.me_tase(tase_array1) #单个预报是返回实时</code></pre>
<pre><code>-0.0033774900487793824</code></pre>
<pre><code class="language-python">mem.me_tase(tase_array2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([-0.00096636, -0.00062833, 0.00012178, 0.00108132, 0.00021861])</code></pre>
<h1>平均绝对误差(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>mae_tase(tase_array)</font></strong><br />
计算两组数据平均绝对值误差 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tase_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为4,分别记录了样本数,误差和、绝对误差和,误差平方和,它通常是tase函数的计算结果,或者计算结果的累加</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比tase_array少了最后一维。其中每个元素为0到正无穷的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.mae_tase(tase_array1) #单个预报是返回实时</code></pre>
<pre><code>0.33079960022302674</code></pre>
<pre><code class="language-python">mem.mae_tase(tase_array2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([0.33646781, 0.33743355, 0.33710381, 0.33054487, 0.33278019])</code></pre>
<h1>均方误差(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>mse_tase(tase_array)</font></strong><br />
计算两组数据均方误差 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tase_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为4,分别记录了样本数,误差和、绝对误差和,误差平方和,它通常是tase函数的计算结果,或者计算结果的累加</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比tase_array少了最后一维。其中每个元素为0到正无穷的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.mse_tase(tase_array1) #单个预报是返回实时</code></pre>
<pre><code>0.1642407332902462</code></pre>
<pre><code class="language-python">mem.mse_tase(tase_array2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([0.1684721 , 0.17021608, 0.1692365 , 0.16439587, 0.16609746])</code></pre>
<h1>平均绝对误差(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>rmse_tase(tase_array)</font></strong><br />
计算两组数据均方根误差 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tase_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为4,分别记录了样本数,误差和、绝对误差和,误差平方和,它通常是tase函数的计算结果,或者计算结果的累加</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比tase_array少了最后一维。其中每个元素为0到正无穷的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.rmse_tase(tase_array1) #单个预报是返回实时</code></pre>
<pre><code>0.4052662498780847</code></pre>
<pre><code class="language-python">mem.rmse_tase(tase_array2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([0.41045353, 0.41257252, 0.41138364, 0.40545761, 0.40755056])</code></pre>
<h1>均值偏差(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>bias_cmmsss(cmmsss_array)</font></strong><br />
计算求预测数据和实况数据的平均值之比</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>cmmsss_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为6,分别记录了样本数、观测平均值、预报平均值、观测方差、预报方差、协方差,它通常是cmmsss函数的计算结果,或者再经tmmsss_merge函数合并的结果</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比cmmsss_array少了最后一维。其中每个元素为0到正无穷,最优值为1</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.bias_tmmsss(tms_array1) #单个预报是返回实时</code></pre>
<pre><code>0.9932452786537237</code></pre>
<pre><code class="language-python">mem.bias_tmmsss(tms_array2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([1.00193638, 1.0012582 , 0.99975652, 0.99784211, 0.99956299])</code></pre>
<h1>相关系数(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>corr_tmmsss(tmmsss_array)</font></strong><br />
计算求预测数据和实况数据的相关系数</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>cmmsss_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为6,分别记录了样本数、观测平均值、预报平均值、观测方差、预报方差、协方差,它通常是cmmsss函数的计算结果,或者再经tmmsss_merge函数合并的结果</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比cmmsss_array少了最后一维。其中每个元素为-1到1的实数,最优值为1</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.corr_tmmsss(tms_array1) #单个预报是返回实时</code></pre>
<pre><code>0.006118730891288417</code></pre>
<pre><code class="language-python">mem.corr_tmmsss(tms_array2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([-0.01481259, -0.01452869, -0.01466466, 0.00059206, -0.00450701])</code></pre>
<h1>残差率(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>residual_error_rate_tmmsss(tmmsss_array)</font></strong><br />
计算求预测数据和实况数据的线性回归后的残差率 = (1 - corr^2) ^0.5</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tmmsss_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为6,分别记录了样本数、观测平均值、预报平均值、观测方差、预报方差、协方差,它通常是tmmsss函数的计算结果,或者再经tmmsss_merge函数合并的结果</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比tmmsss_array少了最后一维。其中每个元素为0到1的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.residual_error_rate_tmmsss(tms_array1)</code></pre>
<pre><code>0.9999812803909282</code></pre>
<h1>残差(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>residual_error_rate_tmmsss(tmmsss_array)</font></strong><br />
计算求预测数据和实况数据的线性回归后的残差 = 残差率 * 观测数据的标准差</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tmmsss_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为6,分别记录了样本数、观测平均值、预报平均值、观测方差、预报方差、协方差,它通常是cmmsss函数的计算结果,或者再经tmmsss_merge函数合并的结果</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比tmmsss_array少了最后一维。其中每个元素为0到1的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.residual_error_tmmsss(tms_array1)</code></pre>
<pre><code>0.28754761822327024</code></pre>
<h1>纳什系数(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>nse_tmmsss(tmmsss_array)</font></strong><br />
水文中常用的降水检验方法,计算方法为:1 - 均方误差/观测方差 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tmmsss_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为6,分别记录了样本数、观测平均值、预报平均值、观测方差、预报方差、协方差,它通常是cmmsss函数的计算结果,或者再经tmmsss_merge函数合并的结果。除最后一维之外,其余维度需和tase_array保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比tmmsss_array少了最后一维。每个元素是负无穷到1的实数,最优值为1</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.nse_tmmsss(tms_array1) #单个预报是返回实时</code></pre>
<pre><code>-0.9863010229355298</code></pre>
<pre><code class="language-python">mem.nse_tmmsss(tms_array2) #多个预报时返回数组,size = 预报成员数</code></pre>
<pre><code>array([-1.03747446, -1.05856593, -1.04671902, -0.98817726, -1.00875597])</code></pre>
<h1>观测和预报的累计值(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_sum_tmmsss(tmmsss_array)</font></strong><br />
计算观测和预报的各自的累计值</p>
<h1>观测和预报的平均值(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_mean_tmmsss(tmmsss_array)</font></strong><br />
计算观测和预报的各自的平均值 </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tmmsss_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为6,分别记录了样本数、观测平均值、预报平均值、观测方差、预报方差、协方差,它通常是cmmsss函数的计算结果,或者再经tmmsss_merge函数合并的结果。除最后一维之外,其余维度需和tase_array保持一致</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">一维数组,shape = (1+预报成员数据),其中第一个元素为观测的累计值,其余为预报的累计值(平均值)</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.ob_fo_sum_tmmsss(tms_array1) #单个预报是返回实时</code></pre>
<pre><code>array([[5000.19153365],
[4966.41663316]])</code></pre>
<pre><code class="language-python">mem.ob_fo_mean_tmmsss(tms_array1) #单个预报是返回实时</code></pre>
<pre><code>array([[0.50001915],
[0.49664166]])</code></pre>
<h1>定量相对误差(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>mre_toar(toar_array)</font></strong><br />
对每一对观测和预报不同时为0的数据计算(预报-观测)/(预报+观测)取绝对值后再做平均</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>toar_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为2,其内容依次为预报和观测值之和大于0样本数、相对误差绝对值总和,它通常是toar函数的计算结果或结果的累加</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比cmmsss_array少了最后一维。其中每个元素为0到1的实数,最优值为0</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.mre_toar(toar_array1) #单个预报是返回实时</code></pre>
<pre><code>0.38498205655121037</code></pre>
<pre><code class="language-python">mem.mre_toar(toar_array2) #单个预报是返回实时</code></pre>
<pre><code>array([0.38990022, 0.39068891, 0.39000513, 0.3837708 , 0.38506937])</code></pre>
<h1>均方根倍差(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>rmsf_tlfo(tlfo_array)</font></strong><br />
对于观测和预报之间比值偏离1的程度进行综合度量,计算方法为:</p>
<p>$RMSF =exp(\sqrt[]{\frac{1}{N}\sum_{i=1}^N{[log(\frac{F_i}{O_i})^2]}}) $ </p>
<p>上述公式中仅统计观测和预报降水量都达到0.1mm的样本对,或者观测预报有一者达到1.0mm的样本对,入选的样本对中如果观测或预报小于0.1mm,则会被强制设置为0.1mm。</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>tlfo_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为2,其内容依次符合计算rmsf的样本数、log(fo/ob)^2的总和,它通常是tlfo函数的计算结果或结果的累加</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">整数或数组,它比tlfo_array少了最后一维。其中每个元素为1到无穷大的实数,最优值为1</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.rmsf_tlfo(tlfo_array1) #单个预报是返回实时</code></pre>
<pre><code>2.2837481426081268</code></pre>
<pre><code class="language-python">mem.rmsf_tlfo(tlfo_array2) #单个预报是返回实时</code></pre>
<pre><code>array([2.30992783, 2.31484303, 2.3037976 , 2.28786635, 2.28161919])</code></pre>
<h1>观测预报降水强度(并行)</h1>
<p><strong><font face="黑体" color=blue size = 5>ob_fo_precipitation_strength_cscs(cscs_array)</font></strong> </p>
<p>基于中间量计算观测和预报的降水强度(降水量>=0.1mm的站点上降水量的均值)</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=blue size = 5>cscs_array</font></strong></td>
<td style="text-align: left;">包含检验中间结果的多维数组,其中最后一维长度为4,内容依次为观测大于0.1mm的站次、观测降水量累加、预报大于0.1mm的站次、预报降水量累加。cscs_array它通常是cscs函数的计算结果或结果的累加</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: left;">实数或数组,它比cscs_array少了最后一维</td>
</tr>
</tbody>
</table>
<p><strong>调用示例:</strong></p>
<pre><code class="language-python">mem.ob_fo_precipitation_strength_cscs(cscs_array1) #单个预报是返回实时</code></pre>
<pre><code>array([[0.54912065],
[0.54853963]])</code></pre>
<p>以上只是展示了分类检验的维度为1的情况,实际上上述思路可以扩展至任意高维的情况。熟练使用中间统计量计算和合并方法,基于中间统计量整体计算分类问题下的检验指标数组,是提高代码编写效果的关键。上述检验函数的内部也都采用了numpy的整体计算方式实现,在计算效率上进行了最大程度的优化。</p>
<pre><code class="language-python"></code></pre>