meteva

提供气象产品检验相关python程序


数值型检验指标

<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">sample_count = 1000 member_count = 20 ob = 0.003 * np.arange(sample_count) #生成一批观测样本数据 ensemble_mean = ob + np.random.randn(sample_count) #设观测值随机出现在集合平均的周围,误差标准差为1 fo = np.zeros((sample_count,member_count)) for i in range(member_count): fo[:,i] = ensemble_mean + np.random.randn(sample_count) * 0.5 #集合成员随机出现在集合平均的周围,集合发散标准差为0.5</code></pre> <pre><code class="language-python">ob = np.random.randn(10,10) fo1 = np.random.randn(5,10,10)</code></pre> <h1>一致性比例</h1> <p><strong>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt;cr(ob,fo,grade_list=[1e-300]) &lt;/font&gt;</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>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt;ob&lt;/font&gt;</strong></td> <td style="text-align: left;">实况数据, 任意维numpy数组</td> </tr> <tr> <td style="text-align: left;"><strong>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt;fo&lt;/font&gt;</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;">多个阈值同时检验时的等级参数</td> </tr> <tr> <td style="text-align: left;">&lt;font face=&quot;黑体&quot; color=blue size=5&gt;return&lt;/font&gt;</td> <td style="text-align: left;">当len(grade_list) =1时,返回实数,否则返回一维数组, 其元素为0-1的实数,最优值为1</td> </tr> </tbody> </table> <p><strong>调用示例:</strong>  </p> <pre><code class="language-python">mem.cr(ob,fo1) #缺省等级参数,len(grade_list) = 1</code></pre> <pre><code>0.010309278350515464</code></pre> <pre><code class="language-python">mem.cr(ob,fo1,grade_list=[0,0.3,0.5]) #指定多个等级</code></pre> <pre><code>array([0.01030928, 0. , 0. ])</code></pre> <h1>连续分级概率评分</h1> <p><strong>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt; crps(ob, fo)&lt;/font&gt;</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>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt;ob&lt;/font&gt;</strong></td> <td style="text-align: left;">实况数据, 任意维numpy数组</td> </tr> <tr> <td style="text-align: left;"><strong>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt;fo&lt;/font&gt;</strong></td> <td style="text-align: left;">fo比Ob.shape多一维,fo.shape低维与ob.shape保持一致</td> </tr> <tr> <td style="text-align: left;">&lt;font face=&quot;黑体&quot; color=blue size=5&gt;return&lt;/font&gt;</td> <td style="text-align: left;">返回一个实数</td> </tr> </tbody> </table> <p><strong>调用示例:</strong>  </p> <pre><code class="language-python">mem.crps(ob,fo1)</code></pre> <pre><code>1.0296400765955034</code></pre> <h1>集合离散度和集合平均的均方误差</h1> <p><strong>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt; variance_mse(ob, fo)&lt;/font&gt;</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>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt;ob&lt;/font&gt;</strong></td> <td style="text-align: left;">实况数据, 任意维numpy数组</td> </tr> <tr> <td style="text-align: left;"><strong>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt;fo&lt;/font&gt;</strong></td> <td style="text-align: left;">fo比Ob.shape多一维,fo.shape低维与ob.shape保持一致</td> </tr> <tr> <td style="text-align: left;">&lt;font face=&quot;黑体&quot; color=blue size=5&gt;return&lt;/font&gt;</td> <td style="text-align: left;">返回两个数值构成的元组,内容分别是集合成员之间的内方差,集合平均相对观测的均方误差</td> </tr> </tbody> </table> <p><strong>调用示例:</strong>  </p> <pre><code class="language-python">mem.variance_mse(ob,fo1)</code></pre> <pre><code>(0.8885455797890305, 0.8615710640608103)</code></pre> <h1>集合离散度和集合平均的均方误差之比</h1> <p><strong>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt; variance_divide_by_mse(ob, fo)&lt;/font&gt;</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>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt;ob&lt;/font&gt;</strong></td> <td style="text-align: left;">实况数据, 任意维numpy数组</td> </tr> <tr> <td style="text-align: left;"><strong>&lt;font face=&quot;黑体&quot; color=blue size = 5&gt;fo&lt;/font&gt;</strong></td> <td style="text-align: left;">fo比Ob.shape多一维,fo.shape低维与ob.shape保持一致</td> </tr> <tr> <td style="text-align: left;">&lt;font face=&quot;黑体&quot; color=blue size=5&gt;return&lt;/font&gt;</td> <td style="text-align: left;">返回一个数值</td> </tr> </tbody> </table> <p><strong>调用示例:</strong>  </p> <pre><code class="language-python">mem.variance_divide_by_mse(ob,fo1)</code></pre> <pre><code>1.0313085209722368</code></pre> <pre><code class="language-python"></code></pre>

页面列表

ITEM_HTML