meteva

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


字典表

<p>[TOC]</p> <pre><code class="language-python">%load_ext autoreload %autoreload 2 import meteva.base as meb</code></pre> <p>在从micaps第1、2或8类数据文件、或sevp格式文件中、或从gds服务器读取某个站点要素(例如温度)数据时,通常需要首先查阅micaps或其它的帮助文档,从文档中找出要读取的要素在文件中排在第几列。这个过程并不困难,但略为繁琐,而且可能会出现一些错误。为了提高效率,本模块将上述常用的文件或服务器中各要素对应的列号以类变量的形式记录下来,方便在编程时引用。另外也提供了字典形式的检索方式来获取相应的列号或id。其中以类变量的方式记录如下:</p> <h3>MICAPS1的要素列序表</h3> <p><strong>class m1_value_column:</strong> 站号 = 0<br /> 经度 = 1<br /> 纬度 = 2<br /> 拔海高度 = 3<br /> 站点级别 = 4<br /> 总云量 =5<br /> 风向 = 6<br /> 风速 = 7<br /> 气压 = 8<br /> 小时变压 = 9<br /> 过去天气1 = 10<br /> 过去天气2 =11<br /> 降水6小时 =12<br /> 低云状 =13<br /> 低云量 =14<br /> 低云高 =15<br /> 露点 =16<br /> 能见度 =17<br /> 现在天气 =18<br /> 温度 =19<br /> 中云状 =20<br /> 高云状 =21<br /> 标志1 =22<br /> 标志2 =23<br /> 日变温 = 24<br /> 日变压 =25 </p> <p>以字典方式记录如下:</p> <h3>MICAPS1的要素列序字典</h3> <p><strong>m1_element_column_dict</strong> = {<br /> &quot;站号&quot; : 0,<br /> &quot;经度&quot; : 1,<br /> &quot;纬度&quot; : 2,<br /> &quot;拔海高度&quot; : 3,<br /> &quot;站点级别&quot; : 4,<br /> &quot;总云量&quot; : 5,<br /> &quot;风向&quot; : 6,<br /> &quot;风速&quot; : 7,<br /> &quot;气压&quot; : 8,<br /> &quot;小时变压&quot; : 9,<br /> &quot;过去天气1&quot; : 10,<br /> &quot;过去天气2&quot; : 11,<br /> &quot;降水6小时&quot; : 12,<br /> &quot;低云状&quot; : 13,<br /> &quot;低云量&quot; : 14,<br /> &quot;低云高&quot; : 15,<br /> &quot;露点&quot; : 16,<br /> &quot;能见度&quot; : 17,<br /> &quot;现在天气&quot; : 18,<br /> &quot;温度&quot; : 19,<br /> &quot;中云状&quot; : 20,<br /> &quot;高云状&quot; : 21,<br /> &quot;标志1&quot; : 22,<br /> &quot;标志2&quot; : 23,<br /> &quot;日变温&quot; : 24,<br /> &quot;日变压&quot; : 25<br /> }</p> <p><strong>参考示例:</strong> </p> <pre><code class="language-python">column_index = meb.m1_element_column.温度 print(column_index)</code></pre> <pre><code>19</code></pre> <pre><code class="language-python">column_index = meb.m1_element_column_dict["温度"] print(column_index)</code></pre> <pre><code>19</code></pre> <p><strong>很多编辑器(例如,pycharm)有自动弹出的功能,当输入上述类名称m1_element_column.时会自动弹出可选的要素名称,如下图所示:</strong> <img src="https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/dbdc5292816a075d3d07e241db431281" alt="" /> <strong>在不清楚要素具体的名称时,显然上述两种方法中第一种相对更加便利。但如果要循环遍历各种要素,第二种方式更方便一些。 结合后面的IO模块,以下是更为实际的应用示例:</strong> </p> <pre><code class="language-python">sta = meb.io.read_stadata_from_micaps1_2_8(r"H:\test_data\input\meb\m1.txt",meb.m1_element_column.温度) #从micaps1文件中读取温度 print(sta)</code></pre> <pre><code> level time dtime id lon lat data0 0 0 2018-08-01 08:00:00 0 1009 89.49 3.99 27.9 2 0 2018-08-01 08:00:00 0 29645 86.22 55.25 8.1 3 0 2018-08-01 08:00:00 0 28593 74.63 56.10 15.1 5 0 2018-08-01 08:00:00 0 36022 80.33 52.02 9.5 6 0 2018-08-01 08:00:00 0 29209 77.22 57.81 11.0 ... ... ... ... ... ... ... ... 4072 0 2018-08-01 08:00:00 0 48679 103.67 1.63 24.4 4073 0 2018-08-01 08:00:00 0 16364 16.37 38.76 18.4 4074 0 2018-08-01 08:00:00 0 16415 14.87 38.58 24.1 4075 0 2018-08-01 08:00:00 0 16081 9.26 45.46 26.7 4076 0 2018-08-01 08:00:00 0 16314 16.66 40.68 22.9 [3999 rows x 7 columns]</code></pre> <p>本模块还以类似的方式包含了其它micaps的数据</p> <h3>MICAPS2的要素列序表</h3> <p><strong>class m2_value_column:</strong><br /> 站号 = 0<br /> 经度 = 1<br /> 纬度 = 2<br /> 拔海高度 = 3<br /> 站点级别 = 4<br /> 位势高度 = 5<br /> 温度 = 6<br /> 温度露点差 = 7<br /> 风向 = 8<br /> 风速 = 9 </p> <h3>MICAPS2的要素列序字典</h3> <p><strong>m2_element_column_dict</strong> = { &quot;站号&quot; : 0,<br /> &quot;经度&quot; : 1,<br /> &quot;纬度&quot; : 2,<br /> &quot;拔海高度&quot; : 3,<br /> &quot;站点级别&quot; : 4,<br /> &quot;位势高度&quot; : 5,<br /> &quot;温度&quot; : 6,<br /> &quot;温度露点差&quot; : 7,<br /> &quot;风向&quot; : 8,<br /> &quot;风速&quot; : 9,<br /> }</p> <p><strong>参考示例:</strong> </p> <pre><code class="language-python">column_index = meb.m2_element_column.温度 print(column_index)</code></pre> <pre><code>6</code></pre> <pre><code class="language-python">column_index = meb.m2_element_column_dict["温度"] print(column_index)</code></pre> <pre><code>6</code></pre> <h3>MICAPS8的要素列序表</h3> <p><strong>class m8_value_column:</strong><br /> 站号 = 0<br /> 经度 = 1<br /> 纬度 = 2<br /> 拔海高度 = 3<br /> 站点级别 = 4<br /> 位势高度 = 5<br /> 温度 = 6<br /> 温度露点差 = 7<br /> 风向 = 8<br /> 风速 = 9 </p> <h3>MICAPS8的要素列序字典</h3> <p><strong>m8_element_column_dict</strong> = { &quot;站号&quot; : 0,<br /> &quot;经度&quot; : 1,<br /> &quot;纬度&quot; : 2,<br /> &quot;拔海高度&quot; : 3,<br /> &quot;天气现象1&quot; : 4,<br /> &quot;风向1&quot; : 5,<br /> &quot;风速1&quot; : 6,<br /> &quot;最低温度&quot; : 7,<br /> &quot;最高温度&quot; : 8,<br /> &quot;天气现象2&quot; : 9,<br /> &quot;风向2&quot; : 10,<br /> &quot;风速2&quot; : 11 }</p> <p><strong>参考示例:</strong> </p> <pre><code class="language-python">column_index = meb.m8_element_column.最低温度 print(column_index)</code></pre> <pre><code>7</code></pre> <pre><code class="language-python">column_index = meb.m8_element_column_dict["最低温度"] print(column_index)</code></pre> <pre><code>7</code></pre> <h3>sevp的要素id表</h3> <p><strong>class sevp_value_coulumn:</strong><br /> 温度 = 1<br /> 相对湿度 = 2<br /> 风向 = 3<br /> 风速 = 4<br /> 气压 = 5<br /> 降水量 = 6<br /> 总云量 = 7<br /> 低云量 = 8<br /> 天气现象= 9<br /> 能见度 = 10<br /> 最高气温 = 11<br /> 最低气温 = 12<br /> 最大相对湿度 = 13<br /> 最小相对湿度 = 14<br /> 累计降水量_24小时 = 15<br /> 累计降水量_12小时 = 16<br /> 总云量_12小时 = 17<br /> 低云量_12小时 = 18<br /> 天气现象_12小时 = 19<br /> 风向_12小时 = 20<br /> 风速_12小时 = 21 </p> <h3>sevp的要素id字典</h3> <p><strong>sevp_element_id_dict</strong> = { &quot;温度&quot;:1,<br /> &quot;相对湿度&quot;:2,<br /> &quot;风向&quot;:3,<br /> &quot;风速&quot;:4,<br /> &quot;气压&quot;:5,<br /> &quot;降水量&quot;:6,<br /> &quot;总云量&quot;:7,<br /> &quot;低云量&quot;:8,<br /> &quot;天气现象&quot;:9,<br /> &quot;能见度&quot;:10,<br /> &quot;最高气温&quot;:11,<br /> &quot;最低气温&quot;:12,<br /> &quot;最大相对湿度&quot;:13,<br /> &quot;最小相对湿度&quot;:14,<br /> &quot;累计降水量_24小时&quot;:15,<br /> &quot;累计降水量_12小时&quot;:16,<br /> &quot;总云量_12小时&quot;:17,<br /> &quot;低云量_12小时&quot;:18,<br /> &quot;天气现象_12小时&quot;:19,<br /> &quot;风向_12小时&quot;:20,<br /> &quot;风速_12小时&quot;:21,<br /> }</p> <p><strong>参考示例:</strong> </p> <pre><code class="language-python">id_index = meb.sevp_element_id.最高气温 print(id_index)</code></pre> <pre><code>11</code></pre> <pre><code class="language-python">id_index = meb.sevp_element_id_dict["最高气温"] print(id_index)</code></pre> <pre><code>11</code></pre> <h3>gds的要素id表</h3> <p><strong>class gds_element_id:</strong><br /> 经度 = 1<br /> 纬度 = 2<br /> <a href="https://www.showdoc.cc/meteva?page_id=3975619960434939"><font face="黑体" color=blue size=5>...</font></a></p> <h3>gds的要素id字典</h3> <p><strong>gds_element_dict</strong> =<br /> {<br /> &quot;经度&quot;: 1,<br /> &quot;纬度&quot;: 2,<br /> <a href="https://www.showdoc.cc/meteva?page_id=3975620251623682"><font face="黑体" color=blue size=5>...</font></a><br /> }</p> <p><strong>参考示例:</strong></p> <pre><code class="language-python">id_index = meb.gds_element_id.最高气温 print(id_index)</code></pre> <pre><code>603</code></pre> <pre><code class="language-python">id_index = meb.gds_element_id_dict["最高气温"] print(id_index)</code></pre> <pre><code>603</code></pre> <h3>MICAPS41的要素列序表</h3> <p><strong>class m41_element_column</strong>:<br /> id = 0<br /> time = 1<br /> 单位代码 = 2<br /> 闪电的种类 = 3<br /> lon = 4<br /> lat = 5<br /> alt = 6<br /> 回击数 = 7<br /> 上升时间 = 8<br /> 衰减时间 = 9<br /> 归一化电流强度值 = 10<br /> 闪电能量 = 11<br /> 误差 = 12<br /> 算法代码 = 13<br /> 陡度 = 14 </p> <h3>MICAPS41的要素列序字典</h3> <p>m41_element_column_dict_environment={ 'id' : 0,<br /> 'time' : 1,<br /> '单位代码' : 2,<br /> '闪电的种类' : 3,<br /> 'lon' : 4,<br /> 'lat' : 5,<br /> 'alt' : 6,<br /> '回击数' : 7,<br /> '上升时间' : 8,<br /> '衰减时间' : 9,<br /> '归一化电流强度值' : 10,<br /> '闪电能量' : 11,<br /> '误差' : 12,<br /> '算法代码' : 13,<br /> '陡度' : 14,<br /> }</p> <p><strong>参考示例:</strong> </p> <pre><code class="language-python">id_index = meb.m41_element_column.归一化电流强度值 print(id_index)</code></pre> <pre><code>10</code></pre> <pre><code class="language-python">print(meb.m41_element_column_dict_environment["归一化电流强度值"])</code></pre> <pre><code>10</code></pre> <h3>MICAPS7(台风)的要素列序表</h3> <p><strong>class m7_element_column:</strong><br /> year = 0<br /> month = 1<br /> day = 2<br /> hour = 3<br /> dtime = 4<br /> lon = 5<br /> lat = 6<br /> 中心气压 = 7<br /> 最大风速 = 8<br /> 七级风圈半径 = 9<br /> 十级风圈半径 = 10<br /> 移向 = 11<br /> 移速 = 12 </p> <h3>MICAPS7(台风)的要素列序字典</h3> <p>m7_element_column_dict = {<br /> &quot;year&quot;: 0,<br /> &quot;month&quot; : 1,<br /> &quot;day&quot; : 2,<br /> &quot;hour&quot; : 3,<br /> &quot;dtime&quot; : 4,<br /> &quot;lon&quot; : 5,<br /> &quot;lat&quot; : 6,<br /> &quot;中心气压&quot; : 7,<br /> &quot;最大风速&quot; : 8,<br /> &quot;七级风圈半径&quot; : 9,<br /> &quot;十级风圈半径&quot; : 10,<br /> &quot;移向&quot; : 11,<br /> &quot;移速&quot; : 12<br /> } </p> <p><strong>参考示例:</strong> </p> <h3>内置地图选项</h3> <p><strong>class shpfile</strong>:<br /> world = &quot;worldmap&quot;<br /> china = &quot;NationalBorder&quot;<br /> province = &quot;Province&quot;<br /> county = &quot;BOUNT_poly&quot;<br /> river = &quot;hyd1_4p&quot; </p> <p><strong>参考示例:</strong> </p> <pre><code class="language-python">shp = meb.shpfile.river print(shp)</code></pre> <pre><code>hyd1_4p</code></pre>

页面列表

ITEM_HTML