球谐功率谱
<p>[TOC]</p>
<pre><code class="language-python">%matplotlib inline
%load_ext autoreload
%autoreload 2
import pandas as pd
import meteva.method as mem
import meteva.base as meb
import meteva.product as mpd
import meteva.perspact as mps # 透视分析模块
import datetime
import meteva
import numpy as np
import os
import copy</code></pre>
<h2>球谐功率谱检验方法概述</h2>
<p>根据球谐变换方法获取实况和预报场(全球范围等经纬度网格场)的功率谱,绘制在图像中进行对比</p>
<h1>单时刻球谐功率谱计算</h1>
<p>spectrum_Spherical_Harmonic_one_field(grd)
根据单个网格场计算球谐功率谱数据</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: center;">说明</th>
<th style="text-align: left;">备注</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=Blue size=5>grd</font></strong></td>
<td style="text-align: center;">等经纬度网格数据</td>
<td style="text-align: left;"><a href="https://www.showdoc.com.cn/meteva?page_id=3975600815874861">网格数据格式</a></td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: center;">n一维umpy数组</td>
</tr>
</tbody>
</table>
<p><strong>调用示例</strong></p>
<pre><code class="language-python">path =r&quot;H:\test_data\input\mem\sp\era5_u200_2023122312.012.nc&quot;
grid1 = meteva.base.grid([0,359.75,0.25],[-89.875,89.875,0.25])
grd = meb.read_griddata_from_nc(path,grid1)
sp = mem.spectrum_Spherical_Harmonic_one_field(grd)
print(sp)</code></pre>
<pre><code>[1.86278592e+02 2.56786466e-01 4.53116742e-01 5.84524926e-01
5.24859032e+00 7.87086995e-01 1.81535254e+00 2.90280028e-01
1.42669185e+00 3.35984585e-01 3.11131343e-01 1.55205136e-01
3.21778862e-01 1.33507857e-01 1.16056048e-01 1.03717309e-01
6.70673029e-02 4.10252983e-02 5.04439286e-02 2.75826699e-02
2.26675983e-02 1.67881505e-02 1.36603428e-02 1.67939904e-02
1.12208920e-02 9.53676518e-03 7.08794914e-03 4.74747560e-03
7.41370815e-03 7.17844346e-03 2.87235499e-03 4.16722050e-03
2.95935896e-03 2.29104275e-03 2.43927638e-03 1.88648832e-03
1.76074493e-03 1.33267743e-03 8.68476797e-04 1.11580811e-03
7.77484226e-04 8.33521633e-04 9.50490851e-04 8.00833747e-04
7.35625351e-04 8.11700339e-04 6.61898836e-04 6.91546919e-04
5.59106690e-04 5.64969318e-04 3.96396331e-04 4.41167730e-04
4.00484210e-04 4.37786332e-04 3.34882424e-04 2.92370097e-04
3.32244430e-04 2.70494016e-04 2.17134827e-04 2.08952039e-04
2.10767534e-04 2.02946649e-04 2.05720550e-04 1.42406393e-04
1.76650447e-04 1.51518077e-04 1.17302116e-04 1.45260637e-04
1.18165988e-04 1.27879182e-04 1.31587350e-04 1.00946514e-04
8.73048980e-05 9.31636384e-05 8.30030355e-05 7.63427596e-05
6.92482533e-05 7.29720105e-05 6.10105355e-05 6.62463711e-05
5.12220950e-05 6.38368207e-05 6.33691138e-05 5.50851831e-05
3.99323096e-05 4.79869234e-05 4.05453439e-05 4.81492094e-05
3.68425767e-05 3.26518682e-05 3.34641034e-05 3.57283465e-05
2.28399958e-05 3.03693859e-05 3.07362519e-05 2.36151199e-05
2.44295710e-05 2.24603138e-05 2.35491760e-05 2.21181584e-05
2.14573283e-05 2.03879857e-05 1.71513239e-05 1.68778957e-05
1.57402308e-05 1.42162640e-05 1.78862968e-05 1.50000507e-05
1.17856954e-05 1.21908070e-05 1.22242470e-05 1.25481001e-05
1.06317973e-05 1.14613544e-05 1.11916974e-05 9.52175496e-06
7.70919422e-06 8.76311649e-06 7.56025060e-06 8.75921704e-06
6.46666662e-06 6.81223815e-06 8.63045796e-06 7.32806142e-06
6.61950228e-06 6.87458414e-06 6.11627551e-06 5.98070203e-06
6.16678881e-06 5.16198936e-06 5.76144472e-06 4.40970488e-06
4.98912067e-06 4.92862736e-06 4.16460186e-06 4.13431978e-06
4.41345561e-06 3.57938683e-06 3.97538301e-06 3.86157246e-06
3.42438157e-06 3.49597886e-06 3.03532915e-06 3.31038307e-06
3.23016515e-06 2.78722772e-06 3.07265329e-06 2.53954564e-06
2.71409366e-06 2.33852648e-06 2.23764202e-06 2.27962670e-06
2.17977892e-06 1.83649697e-06 1.67354932e-06 1.94852262e-06
1.47720425e-06 1.83818599e-06 1.55992516e-06 1.27424034e-06
1.23052516e-06 1.45416933e-06 1.28059315e-06 1.30298529e-06
1.06867626e-06 9.59839493e-07 9.14184215e-07 9.11990839e-07
9.07405233e-07 8.96292184e-07 8.20904958e-07 8.18397251e-07
7.32881010e-07 7.87835920e-07 7.28965820e-07 7.85374768e-07
5.96935554e-07 6.10308737e-07 5.22395997e-07 5.65173493e-07
5.01024643e-07 5.54435610e-07 5.02371316e-07 5.12053784e-07
4.28229876e-07 4.07462507e-07 3.97333928e-07 4.11722513e-07
3.31035850e-07 4.71491072e-07 3.24665091e-07 3.83745225e-07
3.18924110e-07 3.29326397e-07 2.75677630e-07 2.83214189e-07
2.69526034e-07 2.40738042e-07 2.44378792e-07 2.17171455e-07
2.38250614e-07 2.05561281e-07 2.13208371e-07 1.92613039e-07
1.69597435e-07 1.87018090e-07 1.79443957e-07 1.48821132e-07
1.69526483e-07 1.43208046e-07 1.30243736e-07 1.61854690e-07
1.06206112e-07 1.30255554e-07 1.17018193e-07 1.18320717e-07
1.08909981e-07 1.24031241e-07 1.12113144e-07 1.02241521e-07
9.10785320e-08 9.92777270e-08 8.92672277e-08 7.93476155e-08
9.72614685e-08 8.45662593e-08 8.14717498e-08 8.11008051e-08
6.60933737e-08 7.77171062e-08 6.87710895e-08 6.76335305e-08
7.03685820e-08 6.30694829e-08 5.34151197e-08 5.74398450e-08
5.15079340e-08 6.23486051e-08 4.75352542e-08 5.50153381e-08
4.29345791e-08 5.54070100e-08 4.04606383e-08 5.10433639e-08
4.03174306e-08 4.58834028e-08 3.86495203e-08 4.37421456e-08
3.44083208e-08 4.11268635e-08 3.44695643e-08 4.34893815e-08
3.47624599e-08 3.57747777e-08 3.07537375e-08 3.48575468e-08
3.23519483e-08 3.66278199e-08 3.10983749e-08 3.26893203e-08
2.82960427e-08 2.89287102e-08 2.56827765e-08 3.00541723e-08
2.35993934e-08 2.94621486e-08 2.26451830e-08 2.49814911e-08
2.25605001e-08 2.37871685e-08 1.89114453e-08 2.63602161e-08
2.17613574e-08 2.40222698e-08 1.83774153e-08 2.38573156e-08
1.77481571e-08 1.95122210e-08 1.96321065e-08 1.96135459e-08
1.64984553e-08 1.78344310e-08 1.64379084e-08 1.84064016e-08
1.44534945e-08 1.73375722e-08 1.45648590e-08 1.87543383e-08
1.37713833e-08 1.68517740e-08 1.54967033e-08 1.63185929e-08
1.37993708e-08 1.67206248e-08 1.36174629e-08 1.47521785e-08
1.48007237e-08 1.53420918e-08 1.25947754e-08 1.38115638e-08
1.25252643e-08 1.46966314e-08 1.17669315e-08 1.40826095e-08
1.21751517e-08 1.20817043e-08 1.19309655e-08 1.26291910e-08
1.10366372e-08 1.25126402e-08 1.09105513e-08 1.27073861e-08
9.01968699e-09 1.11056829e-08 1.03355964e-08 1.20051419e-08
1.00737962e-08 1.11764612e-08 8.82896438e-09 1.02086302e-08
9.72477762e-09 1.02391979e-08 8.11502445e-09 9.15853874e-09
8.74605026e-09 9.15177053e-09 7.92665876e-09 9.38735563e-09
9.16379161e-09 8.62758566e-09 8.24024900e-09 8.73395550e-09
7.83603357e-09 8.32356735e-09 8.55630963e-09 8.49447015e-09
7.48358559e-09 8.95750415e-09 6.74419542e-09 7.52987734e-09
6.47270702e-09 7.30615179e-09 7.23543304e-09 7.71026307e-09
6.61007327e-09 7.71120078e-09 6.39424432e-09 6.83288205e-09
6.74653964e-09 6.70256786e-09 6.62680890e-09 7.05869876e-09
6.00454778e-09 5.92398133e-09 6.07109098e-09 6.99689620e-09
5.68186895e-09 5.95035694e-09 6.61347185e-09 6.31805986e-09]</code></pre>
<h1>任意时段球谐功率谱计算</h1>
<p>spectrum_Spherical_Harmonic(para,plot = None,save_path = None,title = None)
批量读取一段时间的时刻和预报数据,绘制球谐功率谱对比图</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: center;">说明</th>
<th style="text-align: left;">备注</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=Blue size=5>para</font></strong></td>
<td style="text-align: center;">待统计的观测和预报数据和检验参数描述</td>
<td style="text-align: left;">字典形式,内容见下面的示例</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: center;">包含实况和各类预报的功率谱数据的字典</td>
<td style="text-align: left;">字典,关键词时obs和预报数据名称</td>
</tr>
</tbody>
</table>
<p><strong>调用示例</strong></p>
<pre><code class="language-python">para = {
&quot;grid&quot;: meteva.base.grid([0,359.75,0.25],[-89.875,89.875,0.25]), # 检验区域
&quot;begin_time&quot;: datetime.datetime(2018, 9, 1, 0), # 时段开始时刻(基于起报时间)
&quot;end_time&quot;: datetime.datetime(2018, 9, 1, 0), # 时段结束时刻(基于起报时间)
&quot;time_step&quot;: 12, # 起报时间间隔
&quot;dtime&quot;: 12, # 预报时效
&quot;time_type&quot;: &quot;BT&quot;, # 最终检验结果呈现时,采用北京时还是世界时,UT代表世界时,BT代表北京时
&quot;ob_data&quot;: {
&quot;dir_ob&quot;: r&quot;\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\YYYYMMDDHH\YYYYMMDDHH.012.nc&quot;, # 实况场数据路径
&quot;hour&quot;: None,
&quot;read_method&quot;: meb.read_griddata_from_nc, # 读取数据的函数
&quot;operation&quot;: None, # 预报数据读取后处理函数
&quot;operation_para&quot;: {}, # 预报数据读取后处理参数,用于对单位进行变换的操作
&quot;read_para&quot;: {}, # 读取数据的函数参数
&quot;time_type&quot;: &quot;BT&quot;, # 数据文件中的时间类型,UT代表世界时
},
&quot;fo_data&quot;: {
&quot;FST&quot;: {
&quot;dir_fo&quot;: r&quot;\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\YYYYMMDDHH\YYYYMMDDHH.TTT.nc&quot;, # 数据路径
&quot;read_method&quot;: meb.read_griddata_from_nc, # 读取数据的函数
&quot;read_para&quot;: {}, # 读取数据的函数参数
&quot;reasonable_value&quot;: [0, 1000], # 合理的预报值的取值范围,超出范围观测将被过滤掉
&quot;operation&quot;: None, # 预报数据读取后处理函数,用于对单位进行变换的操作
&quot;operation_para&quot;: {}, # #预报数据读取后处理参数
&quot;time_type&quot;: &quot;BT&quot;, # 预报数据时间类型是北京时,即08时起报
&quot;move_fo_time&quot;: 0 # 是否对预报的时效进行平移,12 表示将1月1日08时的36小时预报转换成1月1日20时的24小时预报后参与对比
},
},
&quot;output_dir&quot;: None # 观测站点合并数据的输出路径,设置为None时不输出收集数据的中间结果
}
</code></pre>
<pre><code class="language-python">result = mem.spectrum_Spherical_Harmonic(para,save_path=r&quot;H:\test_data\output\method\space\spectrum\test1.png&quot;,show = True)</code></pre>
<pre><code>\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090112\2018090112.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090112\2018090112.012.nc
\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090100\2018090100.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090100\2018090100.012.nc
\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090200\2018090200.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090200\2018090200.012.nc
\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090112\2018090112.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090112\2018090112.012.nc
H:\test_data\output\method\space\spectrum\test1.png
png result has been output to H:\test_data\output\method\space\spectrum\test1.png</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=563633747c866fa5d4c35b16bbd759e9&amp;file=file.png" alt="" /></p>
<h1>任意时段动能谱计算</h1>
<p>spectrum_Spherical_Harmonic(para, target_members=None,
save_path=None, title=None, show=False)
批量读取一段时间的时刻和预报数据,绘制球谐动能谱对比图</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: center;">说明</th>
<th style="text-align: left;">备注</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=Blue size=5>para</font></strong></td>
<td style="text-align: center;">待统计的观测和预报数据和检验参数描述</td>
<td style="text-align: left;">字典形式,内容见下面的示例</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: center;">包含实况和各类预报的功率谱数据的字典</td>
<td style="text-align: left;">字典,关键词时obs和预报数据名称</td>
</tr>
</tbody>
</table>
<p><strong>调用示例</strong></p>
<pre><code class="language-python"> para = {
&quot;grid&quot;: meteva.base.grid([0,359.75,0.25],[-89.875,89.875,0.25]), # 检验区域
&quot;begin_time&quot;: datetime.datetime(2018, 9, 1, 0), # 时段开始时刻(基于起报时间)
&quot;end_time&quot;: datetime.datetime(2018, 9, 2, 0), # 时段结束时刻(基于起报时间)
&quot;time_step&quot;: 12, # 起报时间间隔
&quot;dtime&quot;: 12, # 预报时效
&quot;time_type&quot;: &quot;BT&quot;, # 最终检验结果呈现时,采用北京时还是世界时,UT代表世界时,BT代表北京时
&quot;need_Rotational_Divergent&quot;:True,
&quot;vline&quot;:[5,10],
&quot;ob_data&quot;: {
&quot;data_name&quot;:&quot;ERA5&quot;,
&quot;u&quot;:{
&quot;dir_ob&quot;: r&quot;\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\YYYYMMDDHH\YYYYMMDDHH.012.nc&quot;, # 实况场数据路径
&quot;hour&quot;: None,
&quot;read_method&quot;: meb.read_griddata_from_nc, # 读取数据的函数
&quot;operation&quot;: None, # 预报数据读取后处理函数
&quot;operation_para&quot;: {}, # 预报数据读取后处理参数,用于对单位进行变换的操作
&quot;read_para&quot;: {}, # 读取数据的函数参数
&quot;time_type&quot;: &quot;BT&quot;, # 数据文件中的时间类型,UT代表世界时
},
&quot;v&quot;:{
&quot;dir_ob&quot;: r&quot;\\10.28.16.234\data2\AI\Fengwu_ERA5\V\200\YYYYMMDDHH\YYYYMMDDHH.012.nc&quot;, # 实况场数据路径
&quot;hour&quot;: None,
&quot;read_method&quot;: meb.read_griddata_from_nc, # 读取数据的函数
&quot;operation&quot;: None, # 预报数据读取后处理函数
&quot;operation_para&quot;: {}, # 预报数据读取后处理参数,用于对单位进行变换的操作
&quot;read_para&quot;: {}, # 读取数据的函数参数
&quot;time_type&quot;: &quot;BT&quot;, # 数据文件中的时间类型,UT代表世界时
}
},
&quot;fo_data&quot;: {
&quot;FENGWU&quot;: {
&quot;u&quot;:{
&quot;dir_fo&quot;: r&quot;\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\YYYYMMDDHH\YYYYMMDDHH.TTT.nc&quot;, # 数据路径
&quot;read_method&quot;: meb.read_griddata_from_nc, # 读取数据的函数
&quot;read_para&quot;: {}, # 读取数据的函数参数
&quot;reasonable_value&quot;: [0, 1000], # 合理的预报值的取值范围,超出范围观测将被过滤掉
&quot;operation&quot;: None, # 预报数据读取后处理函数,用于对单位进行变换的操作
&quot;operation_para&quot;: {}, # #预报数据读取后处理参数
&quot;time_type&quot;: &quot;BT&quot;, # 预报数据时间类型是北京时,即08时起报
&quot;move_fo_time&quot;: 0 # 是否对预报的时效进行平移,12 表示将1月1日08时的36小时预报转换成1月1日20时的24小时预报后参与对比
},
&quot;v&quot;:{
&quot;dir_fo&quot;: r&quot;\\10.28.16.234\data2\AI\Fengwu_ERA5\V\200\YYYYMMDDHH\YYYYMMDDHH.TTT.nc&quot;, # 数据路径
&quot;read_method&quot;: meb.read_griddata_from_nc, # 读取数据的函数
&quot;read_para&quot;: {}, # 读取数据的函数参数
&quot;reasonable_value&quot;: [0, 1000], # 合理的预报值的取值范围,超出范围观测将被过滤掉
&quot;operation&quot;: None, # 预报数据读取后处理函数,用于对单位进行变换的操作
&quot;operation_para&quot;: {}, # #预报数据读取后处理参数
&quot;time_type&quot;: &quot;BT&quot;, # 预报数据时间类型是北京时,即08时起报
&quot;move_fo_time&quot;: 0 # 是否对预报的时效进行平移,12 表示将1月1日08时的36小时预报转换成1月1日20时的24小时预报后参与对比
}
},
&quot;FUXI&quot;: {
&quot;u&quot;: {
&quot;dir_fo&quot;: r&quot;\\10.28.16.234\data2\AI\fuxi_ERA5\U\200\YYYYMMDDHH\YYYYMMDDHH.TTT.nc&quot;, # 数据路径
&quot;read_method&quot;: meb.read_griddata_from_nc, # 读取数据的函数
&quot;read_para&quot;: {}, # 读取数据的函数参数
&quot;reasonable_value&quot;: [0, 1000], # 合理的预报值的取值范围,超出范围观测将被过滤掉
&quot;operation&quot;: None, # 预报数据读取后处理函数,用于对单位进行变换的操作
&quot;operation_para&quot;: {}, # #预报数据读取后处理参数
&quot;time_type&quot;: &quot;BT&quot;, # 预报数据时间类型是北京时,即08时起报
&quot;move_fo_time&quot;: 0 # 是否对预报的时效进行平移,12 表示将1月1日08时的36小时预报转换成1月1日20时的24小时预报后参与对比
},
&quot;v&quot;: {
&quot;dir_fo&quot;: r&quot;\\10.28.16.234\data2\AI\fuxi_ERA5\V\200\YYYYMMDDHH\YYYYMMDDHH.TTT.nc&quot;, # 数据路径
&quot;read_method&quot;: meb.read_griddata_from_nc, # 读取数据的函数
&quot;read_para&quot;: {}, # 读取数据的函数参数
&quot;reasonable_value&quot;: [0, 1000], # 合理的预报值的取值范围,超出范围观测将被过滤掉
&quot;operation&quot;: None, # 预报数据读取后处理函数,用于对单位进行变换的操作
&quot;operation_para&quot;: {}, # #预报数据读取后处理参数
&quot;time_type&quot;: &quot;BT&quot;, # 预报数据时间类型是北京时,即08时起报
&quot;move_fo_time&quot;: 0 # 是否对预报的时效进行平移,12 表示将1月1日08时的36小时预报转换成1月1日20时的24小时预报后参与对比
}
},
},
&quot;output_dir&quot;: None # 观测站点合并数据的输出路径,设置为None时不输出收集数据的中间结果
}
</code></pre>
<pre><code class="language-python"># 1. 计算动能谱
sp_dict = mem.kinetic_energy_spectrum(para)</code></pre>
<pre><code>\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090112\2018090112.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090112\2018090112.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\V\200\2018090112\2018090112.012.nc
\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090100\2018090100.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090100\2018090100.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\V\200\2018090100\2018090100.012.nc
\\10.28.16.234\data2\AI\fuxi_ERA5\U\200\2018090100\2018090100.012.nc
success read from \\10.28.16.234\data2\AI\fuxi_ERA5\U\200\2018090100\2018090100.012.nc
success read from \\10.28.16.234\data2\AI\fuxi_ERA5\V\200\2018090100\2018090100.012.nc
\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090200\2018090200.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090200\2018090200.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\V\200\2018090200\2018090200.012.nc
\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090112\2018090112.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090112\2018090112.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\V\200\2018090112\2018090112.012.nc
\\10.28.16.234\data2\AI\fuxi_ERA5\U\200\2018090112\2018090112.012.nc
success read from \\10.28.16.234\data2\AI\fuxi_ERA5\U\200\2018090112\2018090112.012.nc
success read from \\10.28.16.234\data2\AI\fuxi_ERA5\V\200\2018090112\2018090112.012.nc
\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090212\2018090212.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090212\2018090212.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\V\200\2018090212\2018090212.012.nc
\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090200\2018090200.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090200\2018090200.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\V\200\2018090200\2018090200.012.nc
\\10.28.16.234\data2\AI\fuxi_ERA5\U\200\2018090200\2018090200.012.nc
success read from \\10.28.16.234\data2\AI\fuxi_ERA5\U\200\2018090200\2018090200.012.nc
success read from \\10.28.16.234\data2\AI\fuxi_ERA5\V\200\2018090200\2018090200.012.nc
\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090300\2018090300.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090300\2018090300.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\V\200\2018090300\2018090300.012.nc
\\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090212\2018090212.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\U\200\2018090212\2018090212.012.nc
success read from \\10.28.16.234\data2\AI\Fengwu_ERA5\V\200\2018090212\2018090212.012.nc
\\10.28.16.234\data2\AI\fuxi_ERA5\U\200\2018090212\2018090212.012.nc
success read from \\10.28.16.234\data2\AI\fuxi_ERA5\U\200\2018090212\2018090212.012.nc
success read from \\10.28.16.234\data2\AI\fuxi_ERA5\V\200\2018090212\2018090212.012.nc</code></pre>
<h1>绘制动能谱</h1>
<p>plot_kinetic_energy_spectrum(sp_dict,para, target_members=None,
save_path=None, title=None, show=False)
将spectrum_Spherical_Harmonic 函数返回结果绘制成图形</p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数</th>
<th style="text-align: center;">说明</th>
<th style="text-align: left;">备注</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=Blue size=5>sp_dict</font></strong></td>
<td style="text-align: center;">动能谱统计返回的结果</td>
<td style="text-align: left;">字典形式</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=Blue size=5>para</font></strong></td>
<td style="text-align: center;">统计动能谱时采用的参数字典</td>
<td style="text-align: left;">字典形式</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=Blue size=5>target_members</font></strong></td>
<td style="text-align: center;">需要绘制在动能谱图中的实况和预报名称</td>
<td style="text-align: left;">字符串的列表</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=Blue size=5>save_path</font></strong></td>
<td style="text-align: center;">图片保存路径</td>
<td style="text-align: left;">字符串</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=Blue size=5>title</font></strong></td>
<td style="text-align: center;">图片标题</td>
<td style="text-align: left;">字符串</td>
</tr>
<tr>
<td style="text-align: left;"><strong><font face="黑体" color=Blue size=5>show</font></strong></td>
<td style="text-align: center;">是否在屏幕上显示图片</td>
<td style="text-align: left;">None,True 或 False</td>
</tr>
<tr>
<td style="text-align: left;"><font face="黑体" color=blue size=5>return</font></td>
<td style="text-align: center;">包含实况和各类预报的功率谱数据的字典</td>
<td style="text-align: left;">字典,关键词时obs和预报数据名称</td>
</tr>
</tbody>
</table>
<p><strong>调用示例</strong></p>
<pre><code class="language-python"></code></pre>
<pre><code class="language-python">
#2 所有成员在一张图
mem.plot_kinetic_energy_spectrum(
sp_dict=sp_dict,
para=para,
target_members=None, # None表示绘制所有成员
save_path=r&quot;H:\test_data\output\method\space\spectrum\kes_all.png&quot;,
title=&quot;Kinetic Energy Spectrum - All Members&quot;,
show = True
)</code></pre>
<pre><code>Saving figure to: H:\test_data\output\method\space\spectrum\kes_all.png</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=ab6b6f70878cf6498f9df996606b722e&amp;file=file.png" alt="" /></p>
<pre><code class="language-python"> # 2. 绘制各种图表
# 2.1 仅绘制观测
mem.plot_kinetic_energy_spectrum(
sp_dict=sp_dict,
para=para,
target_members=[&quot;ERA5&quot;],
save_path=r&quot;H:\test_data\output\method\space\spectrum\kes_obs.png&quot;,
title=&quot;Kinetic Energy Spectrum - Observations&quot;,
show = True
)</code></pre>
<pre><code>Saving figure to: H:\test_data\output\method\space\spectrum\kes_obs.png</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=076ae61a2e62d5a094aa575f60305828&amp;file=file.png" alt="" /></p>
<pre><code class="language-python">
# 2.2 仅绘制单个试验组
mem.plot_kinetic_energy_spectrum(
sp_dict=sp_dict,
para=para,
target_members=[&quot;FENGWU&quot;],
save_path=r&quot;H:\test_data\output\method\space\spectrum\kes_single_CMA_GFS.png&quot;,
title=&quot;Kinetic Energy Spectrum - CMA_GFS&quot;,
show = True
)</code></pre>
<pre><code>Saving figure to: H:\test_data\output\method\space\spectrum\kes_single_CMA_GFS.png</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=8599de8318a61954dc50d13fb38d36f3&amp;file=file.png" alt="" /></p>
<pre><code class="language-python"> # 2.3 绘制多个试验组对比
mem.plot_kinetic_energy_spectrum(
sp_dict=sp_dict,
para=para,
target_members=[&quot;ERA5&quot;, &quot;FENGWU&quot;],
save_path=r&quot;H:\test_data\output\method\space\spectrum\kes_comparison_ERA5_CMA_GFS.png&quot;,
title=&quot;Kinetic Energy Spectrum - ERA5 vs CMA_GFS&quot;,
show = True
)</code></pre>
<pre><code>Saving figure to: H:\test_data\output\method\space\spectrum\kes_comparison_ERA5_CMA_GFS.png</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=7b093cb926dc8857dcc180e213e33171&amp;file=file.png" alt="" /></p>
<pre><code class="language-python"> # 2.5 绘制旋转分量和辐散分量
mem.plot_kinetic_energy_spectrum(
sp_dict=sp_dict,
para=para,
target_members=[&quot;ERA5_rot&quot;, &quot;ERA5_div&quot;, &quot;FENGWU_rot&quot;, &quot;FENGWU_div&quot;],
save_path=r&quot;H:\test_data\output\method\space\spectrum\kes_rot_div.png&quot;,
title=&quot;Kinetic Energy Spectrum - Rotational and Divergent Components&quot;,
show = True
)</code></pre>
<pre><code>Saving figure to: H:\test_data\output\method\space\spectrum\kes_rot_div.png</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=0df984a060b9e4fc6503d046af7337ee&amp;file=file.png" alt="" /></p>