metradar 0.1.6__py3-none-any.whl → 0.1.8.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metradar/__init__.py +4 -2
- metradar/config.py +53 -0
- metradar/core/__init__.py +9 -0
- metradar/{get_cross_section_from_pyart.py → core/get_cross_section.py} +5 -157
- metradar/{mosaic_merge.py → core/mosaic_merge.py} +3 -1
- metradar/{oa_dig_func.py → core/oa_dig_func.py} +83 -333
- metradar/graph/__init__.py +9 -0
- metradar/{mosaic_quickdraw.py → graph/draw_comp_mosaic.py} +71 -68
- metradar/{draw_mosaic_new.py → graph/draw_latlon_func.py} +177 -173
- metradar/graph/draw_radar_aws.py +212 -0
- metradar/{draw_radar_comp_func.py → graph/draw_radar_comp_func.py} +319 -248
- metradar/graph/parse_pal.py +157 -0
- metradar/io/__init__.py +9 -0
- metradar/{cnrad_level2.py → io/cnrad_level2.py} +45 -2
- metradar/{decode_fmt_pyart.py → io/decode_fmt_pyart.py} +20 -3
- metradar/{decode_pup_rose.py → io/decode_pup_rose.py} +241 -684
- metradar/{read_new_mosaic_func.py → io/read_new_mosaic_func.py} +30 -2
- metradar/io/read_swan.py +250 -0
- metradar/{rose_structer.py → io/rose_structer.py} +2 -0
- metradar/project/__init__.py +9 -0
- metradar/project/make_mosaic/__init__.py +9 -0
- metradar/project/make_mosaic/batch_draw_mosaic.py +32 -0
- metradar/{make_mosaic_mp_archive.py → project/make_mosaic/make_mosaic_func.py} +144 -175
- metradar/project/make_mosaic/make_mosaic_mp.ini +29 -0
- metradar/project/make_mosaic/make_mosaic_mp.py +70 -0
- metradar/project/make_vpr_aws/__init__.py +9 -0
- metradar/project/make_vpr_aws/construct_aws_refvpr_mainprog.ini +39 -0
- metradar/project/make_vpr_aws/construct_aws_refvpr_mainprog.py +565 -0
- metradar/project/make_vpr_aws/make_mosaic_20230731_daxing.ini +29 -0
- metradar/project/make_vpr_aws/make_mosaic_basefile.ini +29 -0
- metradar/project/nowcasting/__init__.py +9 -0
- metradar/project/nowcasting/nowcast_by_pysteps.py +214 -0
- metradar/{trans_nc_pgmb.py → project/nowcasting/trans_mosaic_pgmb.py} +19 -17
- metradar/project/qpe/Archive /346/250/241/345/274/217/350/257/264/346/230/216.txt" +2 -0
- metradar/project/qpe/__init__.py +9 -0
- metradar/project/qpe/archive_main_qpe_cfg.ini +91 -0
- metradar/project/qpe/do_s1.sh +6 -0
- metradar/project/qpe/do_s2.sh +6 -0
- metradar/project/qpe/do_s3.sh +6 -0
- metradar/project/qpe/do_s4.sh +6 -0
- metradar/project/qpe/do_s5.sh +6 -0
- metradar/project/qpe/exec_all.sh +11 -0
- metradar/project/qpe/get_rainrate_func.py +80 -0
- metradar/project/qpe/main_qpe_cfg.ini +85 -0
- metradar/project/qpe/s1_download_radar_region_cmadaas.py +123 -0
- metradar/project/qpe/s2_pre_process_single_radar.py +183 -0
- metradar/project/qpe/s3_trans_rainrate_to_qpe.py +499 -0
- metradar/project/qpe/s4_mosaic_qpe.py +523 -0
- metradar/project/qpe/s5_draw_qpe_mosaic.py +308 -0
- metradar/project/wind_retrieval/__init__.py +9 -0
- metradar/project/wind_retrieval/config_3dwind.ini +45 -0
- metradar/{main_pydda.py → project/wind_retrieval/main_pydda.py} +152 -149
- metradar/util/__init__.py +9 -0
- metradar/{comm_func.py → util/comm_func.py} +1 -41
- metradar/util/exceptions.py +50 -0
- metradar/util/geo_transforms_pyart.py +627 -0
- metradar/{get_tlogp_from_sharppy.py → util/get_tlogp_from_sharppy.py} +16 -5
- metradar/{parse_pal.py → util/parse_pal.py} +147 -147
- metradar/util/radar_common.py +16 -0
- metradar/{trans_new_mosaic_nc.py → util/trans_new_mosaic_nc.py} +1 -1
- metradar-0.1.8.2.dist-info/METADATA +90 -0
- metradar-0.1.8.2.dist-info/RECORD +69 -0
- {metradar-0.1.6.dist-info → metradar-0.1.8.2.dist-info}/WHEEL +1 -1
- metradar-0.1.8.2.dist-info/licenses/LICENSE +21 -0
- {metradar-0.1.6.dist-info → metradar-0.1.8.2.dist-info}/top_level.txt +0 -1
- cfg/config.py +0 -90
- metradar/grid.py +0 -281
- metradar/grid_data.py +0 -64
- metradar/oa_couhua.py +0 -166
- metradar/read_new_mosaic.py +0 -33
- metradar/retrieve_cmadaas.py +0 -3126
- metradar/retrieve_micaps_server.py +0 -2061
- metradar-0.1.6.dist-info/METADATA +0 -37
- metradar-0.1.6.dist-info/RECORD +0 -34
- /metradar/{pgmb_io.py → io/pgmb_io.py} +0 -0
- /metradar/{exceptions.py → project/make_vpr_aws/exceptions.py} +0 -0
- /metradar/{geo_transforms_pyart.py → project/make_vpr_aws/geo_transforms_pyart.py} +0 -0
- /metradar/{make_gif.py → util/make_gif.py} +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
# _*_ coding: utf-8 _*_
|
|
3
|
+
|
|
1
4
|
'''
|
|
2
|
-
|
|
3
|
-
ZhuWJ
|
|
5
|
+
快速绘制三维雷达组网拼图
|
|
4
6
|
|
|
5
7
|
'''
|
|
6
8
|
|
|
@@ -17,10 +19,20 @@ from matplotlib.font_manager import FontProperties
|
|
|
17
19
|
import pandas as pd
|
|
18
20
|
from pyart.graph import common
|
|
19
21
|
from datetime import datetime,timedelta
|
|
20
|
-
from parse_pal import parse_pro
|
|
22
|
+
from metradar.util.parse_pal import parse_pro,parse
|
|
21
23
|
import xarray as xr
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
from metradar.config import CONFIG
|
|
26
|
+
|
|
27
|
+
# 资源文件路径
|
|
28
|
+
RESOURCES_PATH = CONFIG.get('SETTING','RESOURCES_PATH')
|
|
29
|
+
FONT_FILE = RESOURCES_PATH + '/fonts/YaHeiConsolasHybrid_1.12.ttf'
|
|
30
|
+
COLOR_FILE=RESOURCES_PATH + '/gr2_colors/default_BR_PUP2.pal'
|
|
31
|
+
MAP_PATH = RESOURCES_PATH + '/国省市县审图号(GS (2019) 3082号/'
|
|
32
|
+
STATION_FILE = RESOURCES_PATH + '/stations/cma_city_station_info.dat'
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def add_china_map_2cartopy(ax, name='province', facecolor='none',transform=None,
|
|
24
36
|
edgecolor='c', lw=2, **kwargs):
|
|
25
37
|
"""
|
|
26
38
|
Draw china boundary on cartopy map.
|
|
@@ -34,40 +46,56 @@ def add_china_map_2cartopy(ax, name='province', facecolor='none',
|
|
|
34
46
|
"""
|
|
35
47
|
|
|
36
48
|
# map name
|
|
37
|
-
names = {'nation': "
|
|
38
|
-
'
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
names = {'nation': "BOUL_G", 'province': "BOUL_S",
|
|
50
|
+
'city': "BOUL_D", 'county': "BOUL_X",}
|
|
51
|
+
|
|
52
|
+
# add 省界
|
|
53
|
+
if transform is None:
|
|
54
|
+
transform = ccrs.PlateCarree()
|
|
55
|
+
|
|
56
|
+
if name == 'county':
|
|
57
|
+
# 添加县边界
|
|
58
|
+
shpfile = MAP_PATH + os.sep + names[name] + ".shp"
|
|
59
|
+
ax.add_geometries(
|
|
60
|
+
Reader(shpfile).geometries(), transform,
|
|
61
|
+
path_effects=[path_effects.Stroke(linewidth=lw, foreground=[1,1,1]),path_effects.Normal()],
|
|
62
|
+
facecolor=facecolor, edgecolor=edgecolor, lw=lw-0.5, **kwargs)
|
|
63
|
+
|
|
64
|
+
if name == 'city':
|
|
65
|
+
# 添加市边界
|
|
66
|
+
shpfile = MAP_PATH + os.sep + names[name] + ".shp"
|
|
67
|
+
ax.add_geometries(
|
|
68
|
+
Reader(shpfile).geometries(), transform,
|
|
69
|
+
path_effects=[path_effects.Stroke(linewidth=lw+0.2, foreground=[1,1,1]),path_effects.Normal()],
|
|
70
|
+
facecolor=facecolor, edgecolor=edgecolor, lw=lw-0.2, **kwargs)
|
|
71
|
+
|
|
72
|
+
# 添加省边界
|
|
73
|
+
if name == 'province':
|
|
74
|
+
shpfile = MAP_PATH + os.sep + names[name] + ".shp"
|
|
75
|
+
ax.add_geometries(
|
|
76
|
+
Reader(shpfile).geometries(), transform,
|
|
77
|
+
path_effects=[path_effects.Stroke(linewidth=lw+0.5, foreground=[1,1,1]),path_effects.Normal()],
|
|
78
|
+
facecolor=facecolor, edgecolor=edgecolor, lw=lw+0.2, **kwargs)
|
|
49
79
|
|
|
50
80
|
def draw_gisinfo(ax,slat,nlat,wlon,elon):
|
|
51
81
|
|
|
52
82
|
# 添加中文地名
|
|
53
83
|
|
|
54
|
-
|
|
84
|
+
city_file = STATION_FILE
|
|
55
85
|
|
|
56
|
-
|
|
57
|
-
header=0,skiprows=0,index_col=None,
|
|
58
|
-
)
|
|
86
|
+
cities = pd.read_csv(city_file, delimiter=r"\s+") # cma_city_station_info
|
|
59
87
|
|
|
60
88
|
gis_lats=[]
|
|
61
89
|
gis_lons=[]
|
|
62
90
|
gis_name=[]
|
|
63
|
-
for ng in range(len(
|
|
64
|
-
gis_lons.append(
|
|
65
|
-
gis_lats.append(
|
|
66
|
-
gis_name.append(
|
|
91
|
+
for ng in range(len(cities['lon'])):
|
|
92
|
+
gis_lons.append(cities['lon'][ng])
|
|
93
|
+
gis_lats.append(cities['lat'][ng])
|
|
94
|
+
gis_name.append(cities['city_name'][ng])
|
|
67
95
|
|
|
68
96
|
|
|
69
|
-
|
|
70
|
-
font2=FontProperties(fname=
|
|
97
|
+
|
|
98
|
+
font2=FontProperties(fname=FONT_FILE, size=8)
|
|
71
99
|
geodetic_transform = ccrs.Geodetic()._as_mpl_transform(ax)
|
|
72
100
|
text_transform = offset_copy(geodetic_transform, units='dots', x=-5)
|
|
73
101
|
aa = (np.array(gis_lats)<nlat) & (np.array(gis_lats) > slat)
|
|
@@ -127,14 +155,7 @@ def quick_draw_mosaic_cross(grid:pyart.core.Grid,params):
|
|
|
127
155
|
vmin = 0
|
|
128
156
|
vmax = 75
|
|
129
157
|
|
|
130
|
-
cmapname = '
|
|
131
|
-
|
|
132
|
-
#
|
|
133
|
-
#cmapname = 'pyart_NWSVel'
|
|
134
|
-
#cmapname = 'pyart_NWS_SPW'
|
|
135
|
-
#cmapname = 'pyart_RefDiff'
|
|
136
|
-
#cmapname = 'pyart_NWS_SPW'
|
|
137
|
-
#cmapname = 'pyart_NWS_SPW'
|
|
158
|
+
cmapname = 'NWSRef'
|
|
138
159
|
|
|
139
160
|
# Panel 1: PPI plot of the second tilt.
|
|
140
161
|
ax1 = fig.add_axes(map_panel_axes, projection=projection)
|
|
@@ -168,17 +189,6 @@ def quick_draw_mosaic_cross(grid:pyart.core.Grid,params):
|
|
|
168
189
|
plt.close()
|
|
169
190
|
|
|
170
191
|
|
|
171
|
-
|
|
172
|
-
def draw_topo(ax=None):
|
|
173
|
-
# 读取地形数据
|
|
174
|
-
filename = '/Users/wenjianzhu/Downloads/srtm_southchina.nc'
|
|
175
|
-
topo = xr.open_dataset(filename)
|
|
176
|
-
# ax = plt.axes()
|
|
177
|
-
if ax is None:
|
|
178
|
-
ax = plt.gca()
|
|
179
|
-
ax.contour(topo['longitude'].values,topo['latitude'].values,topo['topo'],levels=[250,500,750,1000],colors='gray')
|
|
180
|
-
|
|
181
|
-
pass
|
|
182
192
|
def draw_composite_operational(gridfile,outpath='.',level=4,vmin=0,vmax=75,colorfile=None):
|
|
183
193
|
|
|
184
194
|
if not os.path.exists(gridfile):
|
|
@@ -192,15 +202,14 @@ def draw_composite_operational(gridfile,outpath='.',level=4,vmin=0,vmax=75,color
|
|
|
192
202
|
if not os.path.exists(outpath):
|
|
193
203
|
os.makedirs(outpath)
|
|
194
204
|
|
|
195
|
-
fontname='/Users/wenjianzhu/Library/CloudStorage/OneDrive-个人/PythonCode/MyWork/nmc_met_radar/resources/fonts/msyhbd.ttc'
|
|
196
205
|
(filepath,filename) = os.path.split(gridfile)
|
|
197
206
|
tstr = filename[7:19]
|
|
198
207
|
tt = datetime.strptime(tstr,'%Y%m%d%H%M') + timedelta(hours=8)
|
|
199
208
|
|
|
200
209
|
tstr_date = '%04d年%02d月%02d日'%(tt.year,tt.month,tt.day)
|
|
201
210
|
tstr_time = '%02d时%02d分(北京时)'%(tt.hour,tt.minute)
|
|
202
|
-
font_large=FontProperties(fname=
|
|
203
|
-
font_mid=FontProperties(fname=
|
|
211
|
+
font_large=FontProperties(fname=FONT_FILE, size=14)
|
|
212
|
+
font_mid=FontProperties(fname=FONT_FILE, size=10)
|
|
204
213
|
|
|
205
214
|
min_ref=10
|
|
206
215
|
am = grid.fields['reflectivity']['data'].mask
|
|
@@ -248,29 +257,23 @@ def draw_composite_operational(gridfile,outpath='.',level=4,vmin=0,vmax=75,color
|
|
|
248
257
|
|
|
249
258
|
field = 'reflectivity'
|
|
250
259
|
if colorfile is None:
|
|
251
|
-
cmapname = '
|
|
260
|
+
cmapname = 'NWSRef'
|
|
252
261
|
cmap = common.parse_cmap(cmapname, field)
|
|
253
262
|
else:
|
|
254
|
-
|
|
255
|
-
#
|
|
256
|
-
|
|
257
|
-
outdic
|
|
258
|
-
cmap=outdic['cmap']
|
|
259
|
-
norm=outdic['norm']
|
|
263
|
+
cmap,norm=parse(colorfile)
|
|
264
|
+
# outdic= parse(colorfile)
|
|
265
|
+
# cmap=outdic['cmap']
|
|
266
|
+
# norm=outdic['norm']
|
|
260
267
|
|
|
261
268
|
display.plot_grid(field, level, vmin=vmin, vmax=vmax,
|
|
262
269
|
ax=ax_main,colorbar_flag=False,title_flag=False,
|
|
263
270
|
projection=projection,axislabels_flag=False,title=None,
|
|
264
271
|
cmap=cmap,norm=norm)
|
|
265
|
-
|
|
266
|
-
# add_china_map_2cartopy(ax_main, name='province', facecolor='none',edgecolor=None, lw=1)
|
|
272
|
+
add_china_map_2cartopy(ax_main, name='province', facecolor='none',edgecolor=None, lw=1)
|
|
267
273
|
draw_gisinfo(ax_main,slat=ylim_south,nlat=ylim_north,wlon=xlim_west,elon=xlim_east)
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
# ax_main.plot(point_lon,point_lat,marker='o',color='k',markersize=6,transform=ccrs.PlateCarree())
|
|
272
|
-
infostr = '中央气象台-天气预报技术研发室 制作(试验产品)'
|
|
273
|
-
# infostr = '贵州省气象台制作(试验产品)'
|
|
274
|
+
|
|
275
|
+
infostr = '基于 metradar 制作'
|
|
276
|
+
|
|
274
277
|
fig.text(0.05,0.03, infostr, va="center", ha="left", font=font_mid )
|
|
275
278
|
|
|
276
279
|
ax_main.set_ylim([ylim_south, ylim_north])
|
|
@@ -319,20 +322,20 @@ def draw_composite_operational(gridfile,outpath='.',level=4,vmin=0,vmax=75,color
|
|
|
319
322
|
plt.close()
|
|
320
323
|
# plt.show()
|
|
321
324
|
# create axis
|
|
322
|
-
|
|
325
|
+
print('save figure to ' + outpath + os.sep + filename.replace('.nc','.png'))
|
|
323
326
|
pass
|
|
324
327
|
|
|
325
328
|
if __name__ == "__main__":
|
|
326
329
|
|
|
327
330
|
|
|
328
|
-
path = '/
|
|
329
|
-
outpath = '/
|
|
331
|
+
path = '/mnt/e/metradar_test/vpr/mosaic/20230731_daxing'
|
|
332
|
+
outpath = '/mnt/e/metradar_test/vpr/mosaic/20230731_daxing/mosac_pic'
|
|
330
333
|
|
|
331
|
-
|
|
334
|
+
print(os.listdir(path))
|
|
332
335
|
for file in os.listdir(path):
|
|
333
336
|
if not file.endswith('.nc'):
|
|
334
337
|
continue
|
|
335
|
-
draw_composite_operational(path + os.sep + file,outpath,colorfile=
|
|
338
|
+
draw_composite_operational(path + os.sep + file,outpath,colorfile=None)
|
|
336
339
|
pass
|
|
337
340
|
|
|
338
341
|
|