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,13 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
# _*_ coding: utf-8 _*_
|
|
4
|
+
|
|
1
5
|
'''
|
|
2
6
|
画雷达综合图主程序
|
|
3
7
|
|
|
4
8
|
'''
|
|
5
9
|
|
|
10
|
+
|
|
11
|
+
from metradar.io.decode_fmt_pyart import read_cnrad_fmt
|
|
6
12
|
import pyart
|
|
7
13
|
import os
|
|
8
14
|
import numpy as np
|
|
9
15
|
import numpy.ma as MA
|
|
10
|
-
|
|
16
|
+
from metradar.io.decode_pup_rose import READ_ROSE
|
|
11
17
|
import matplotlib.pyplot as plt
|
|
12
18
|
import cartopy.crs as ccrs
|
|
13
19
|
|
|
@@ -18,28 +24,36 @@ from matplotlib.font_manager import FontProperties
|
|
|
18
24
|
import pandas as pd
|
|
19
25
|
from metpy.calc import wind_components
|
|
20
26
|
from metpy.units import units
|
|
21
|
-
from parse_pal import parse_pro
|
|
27
|
+
from metradar.util.parse_pal import parse_pro
|
|
22
28
|
from matplotlib.colorbar import ColorbarBase
|
|
23
29
|
import matplotlib.patheffects as path_effects
|
|
24
30
|
from matplotlib import patheffects
|
|
25
31
|
import matplotlib.transforms as transforms
|
|
26
32
|
from matplotlib.transforms import offset_copy
|
|
27
|
-
from oa_dig_func import Object_Analyst
|
|
33
|
+
from metradar.core.oa_dig_func import Object_Analyst
|
|
28
34
|
import warnings
|
|
29
35
|
warnings.filterwarnings('ignore')
|
|
30
36
|
import matplotlib as mpl
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
|
|
38
|
+
from metradar.core.get_cross_section import get_cross_radar
|
|
33
39
|
import matplotlib
|
|
34
|
-
matplotlib.use('Agg')
|
|
35
|
-
|
|
40
|
+
# matplotlib.use('Agg')
|
|
41
|
+
|
|
36
42
|
from matplotlib import ticker
|
|
37
43
|
import xarray as xr
|
|
44
|
+
from metradar.config import CONFIG
|
|
45
|
+
|
|
46
|
+
# 资源文件路径
|
|
47
|
+
RESOURCES_PATH = CONFIG.get('SETTING','RESOURCES_PATH')
|
|
48
|
+
MAP_PATH = RESOURCES_PATH + '/maps'
|
|
49
|
+
|
|
38
50
|
|
|
39
51
|
# 初始化参数字典,用于存储绘图所需的所有参数
|
|
40
52
|
def ini_params():
|
|
41
53
|
param={'radarfile_path':None, # 雷达文件路径
|
|
42
54
|
'radarfile_name':None, # 雷达文件名
|
|
55
|
+
'rose_cr_path':None, # ROSE组合反射率因子文件路径
|
|
56
|
+
'rose_cr_name':None, # ROSE组合反射率因子文件名
|
|
43
57
|
'mosaicfile_path':None,# 反射率拼图文件路径
|
|
44
58
|
'mosaicfile_name':None, # 反射率拼图文件名
|
|
45
59
|
'pic_path':None, # 图片保存路径
|
|
@@ -48,12 +62,14 @@ def ini_params():
|
|
|
48
62
|
'aws_min_file_name':None, # aws分钟数据文件名
|
|
49
63
|
'aws_hour_file_path':None, # aws小时数据文件路径
|
|
50
64
|
'aws_hour_file_name':None,# aws小时数据文件名
|
|
51
|
-
|
|
65
|
+
'rose_cr_path':None, # ROSE组合反射率因子文件路径
|
|
66
|
+
'rose_cr_name':None, # ROSE组合反射率因子文件名
|
|
52
67
|
'aws_min_delta_t_file_path':None, # aws小时变温数据文件路径
|
|
53
68
|
'aws_min_delta_t_file_name':None,# aws小时变温数据文件名
|
|
54
69
|
'aws_min_delta_p_file_path':None, # aws小时变压数据文件路径
|
|
55
70
|
'aws_min_delta_p_file_name':None,# aws小时变压数据文件名
|
|
56
|
-
|
|
71
|
+
'wind_bar_width_inner':None,#wind bar 里线宽
|
|
72
|
+
'wind_bar_width_outter':None,#wind bar 外线宽
|
|
57
73
|
'gis_name':None, # 站点名称
|
|
58
74
|
'gis_lats':None, # 站点纬度
|
|
59
75
|
'gis_lons':None, # 站点经度
|
|
@@ -87,7 +103,6 @@ def ini_params():
|
|
|
87
103
|
'thred_ref':0, # 回波强度阈值
|
|
88
104
|
'radarname': 'XX',# 雷达站名
|
|
89
105
|
|
|
90
|
-
|
|
91
106
|
}
|
|
92
107
|
return param
|
|
93
108
|
|
|
@@ -107,6 +122,8 @@ class DRAW_RADAR_OTHER:
|
|
|
107
122
|
pass
|
|
108
123
|
self.radarfile_path=params['radarfile_path']
|
|
109
124
|
self.radarfile_name=params['radarfile_name']
|
|
125
|
+
self.rose_cr_path=params['rose_cr_path']
|
|
126
|
+
self.rose_cr_name=params['rose_cr_name']
|
|
110
127
|
self.mosaicfile_path=params['mosaicfile_path']
|
|
111
128
|
self.mosaicfile_name=params['mosaicfile_name']
|
|
112
129
|
self.aws_min_file_path=params['aws_min_file_path']
|
|
@@ -126,6 +143,8 @@ class DRAW_RADAR_OTHER:
|
|
|
126
143
|
self.nlat=params['nlat']
|
|
127
144
|
self.wlon=params['wlon']
|
|
128
145
|
self.elon=params['elon']
|
|
146
|
+
self.wind_bar_width_inner=params['wind_bar_width_inner']
|
|
147
|
+
self.wind_bar_width_outter=params['wind_bar_width_outter']
|
|
129
148
|
self.ref_colorfile=params['ref_colorfile']
|
|
130
149
|
self.vel_colorfile=params['vel_colorfile']
|
|
131
150
|
self.cc_colorfile=params['cc_colorfile']
|
|
@@ -177,18 +196,16 @@ class DRAW_RADAR_OTHER:
|
|
|
177
196
|
|
|
178
197
|
self.ratio = (self.nlat - self.slat)/(self.elon-self.wlon)
|
|
179
198
|
|
|
180
|
-
# self.paintsize_y=(self.paintsize_x*self.ratio)
|
|
181
|
-
|
|
182
199
|
|
|
183
200
|
# 设置坐标轴字体大小
|
|
184
|
-
|
|
185
|
-
# matplotlib.rc('ytick', labelsize=self.fontsize_tick)
|
|
201
|
+
|
|
186
202
|
mpl.rcParams['font.size'] = self.fontsize_tick
|
|
187
203
|
mpl.rcParams['font.weight'] = 'bold'
|
|
188
|
-
mpl.rcParams['font.family'] = 'Times New Roman'
|
|
204
|
+
# mpl.rcParams['font.family'] = 'Times New Roman'
|
|
189
205
|
mpl.rcParams['xtick.direction'] = 'in' # 'out' 'inout'
|
|
190
206
|
mpl.rcParams['ytick.direction'] = 'in' # 'out' 'inout'
|
|
191
207
|
|
|
208
|
+
|
|
192
209
|
self.cref=None
|
|
193
210
|
self.voltime = None
|
|
194
211
|
|
|
@@ -223,7 +240,7 @@ class DRAW_RADAR_OTHER:
|
|
|
223
240
|
if not os.path.exists(self.radarfile_path + os.sep + self.radarfile_name):
|
|
224
241
|
print(self.radarfile_path + os.sep + self.radarfile_name + ' not exists!')
|
|
225
242
|
return False
|
|
226
|
-
self.radar =
|
|
243
|
+
self.radar = read_cnrad_fmt(self.radarfile_path + os.sep + self.radarfile_name)
|
|
227
244
|
# self.radar.fields.keys()
|
|
228
245
|
self.display = pyart.graph.RadarMapDisplay(self.radar)
|
|
229
246
|
self.gatefilter_ref = pyart.correct.GateFilter(self.radar)
|
|
@@ -253,12 +270,9 @@ class DRAW_RADAR_OTHER:
|
|
|
253
270
|
# st = time.time()
|
|
254
271
|
if self.radar is None:
|
|
255
272
|
return False
|
|
256
|
-
|
|
257
|
-
# self.gatefilter_ref.exclude_below('reflectivity', thred, exclude_masked=True, op='and', inclusive=True)
|
|
273
|
+
|
|
258
274
|
self.crs_data = get_cross_radar(self.radar,param_crs)
|
|
259
275
|
pass
|
|
260
|
-
# et = time.time()
|
|
261
|
-
# print('get cross data costs %.1f seconds!'%(et-st))
|
|
262
276
|
|
|
263
277
|
def draw_crs(self,subdir='垂直剖面',varname=None,brefresh=False,thred=None,):
|
|
264
278
|
# check
|
|
@@ -287,8 +301,7 @@ class DRAW_RADAR_OTHER:
|
|
|
287
301
|
return False
|
|
288
302
|
|
|
289
303
|
colordata = parse_pro(colorfile)
|
|
290
|
-
|
|
291
|
-
# self.crs_ratio = self.crs_data['vertical_km'] / self.crs_data['horizontal_km'] * 0.8
|
|
304
|
+
|
|
292
305
|
self.crs_ratio = 0.6
|
|
293
306
|
self.crs_paintsize_y = self.crs_paintsize_x * self.crs_ratio
|
|
294
307
|
self.crs_fig = plt.figure(figsize=(self.crs_paintsize_x,self.crs_paintsize_y))
|
|
@@ -328,29 +341,26 @@ class DRAW_RADAR_OTHER:
|
|
|
328
341
|
def draw_title_crs(self,varname='reflectivity'):
|
|
329
342
|
if not self.bdraw_title_crs:
|
|
330
343
|
return None
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
[
|
|
336
|
-
self.
|
|
337
|
-
self.
|
|
338
|
-
self.
|
|
339
|
-
self.crs_endlon = end_lon
|
|
344
|
+
x,y,z=pyart.core.antenna_to_cartesian(self.crs_start_range, self.crs_start_azi, elevations=0)
|
|
345
|
+
start_lon,start_lat=pyart.core.cartesian_to_geographic_aeqd(x,y,self.g_rad_lon,self.g_rad_lat)
|
|
346
|
+
x,y,z=pyart.core.antenna_to_cartesian(self.crs_end_range, self.crs_end_azi, elevations=0)
|
|
347
|
+
end_lon,end_lat=pyart.core.cartesian_to_geographic_aeqd(x,y,self.g_rad_lon,self.g_rad_lat)
|
|
348
|
+
self.crs_startlat = start_lat[0]
|
|
349
|
+
self.crs_startlon = start_lon[0]
|
|
350
|
+
self.crs_endlat = end_lat[0]
|
|
351
|
+
self.crs_endlon = end_lon[0]
|
|
340
352
|
titlestr = 'A(%.2f,%.2f)->B(%.2f,%.2f) '%(self.crs_startlon,self.crs_startlat,self.crs_endlon,self.crs_endlat)
|
|
341
353
|
tstr=''
|
|
342
354
|
if self.voltime is None:
|
|
343
355
|
tstr = self.timestr
|
|
344
356
|
else:
|
|
345
357
|
tstr = self.voltime
|
|
346
|
-
# titlestr += tstr + ' UTC'
|
|
347
358
|
plt.title('%s'%(titlestr),fontproperties=self.font_title,loc='right',verticalalignment='top')
|
|
348
359
|
|
|
349
360
|
def draw_crs_colorbar(self,fig=None,colorfile=None,tickstep=5,orientation = 'vertical',cb_ratio=0.618):
|
|
350
361
|
# 画色标
|
|
351
362
|
ax_pos = self.crs_ax.get_position().bounds
|
|
352
363
|
cbar_axes = [ax_pos[0]+ ax_pos[2]+0.005,(ax_pos[1]+ax_pos[1]+ax_pos[3])/2-ax_pos[3]*cb_ratio/2,0.02,ax_pos[3]*cb_ratio]
|
|
353
|
-
# cbar_axes = self.crs_cbaxes_pos
|
|
354
364
|
cb_ax = self.crs_fig.add_axes(cbar_axes)
|
|
355
365
|
colordata = parse_pro(colorfile)
|
|
356
366
|
|
|
@@ -366,15 +376,12 @@ class DRAW_RADAR_OTHER:
|
|
|
366
376
|
cb_ax.hlines(tick_pos, colordata['norm'].vmin, colordata['norm'].vmin + 0.3*xrange, color="black",linewidth=0.5)
|
|
367
377
|
cb_ax.hlines(tick_pos, colordata['norm'].vmin + 0.7*xrange, colordata['norm'].vmax, color="black",linewidth=0.5)
|
|
368
378
|
|
|
369
|
-
|
|
370
|
-
# path_effects=[path_effects.Stroke(linewidth=self.stroke_line_width, foreground='black'),
|
|
371
|
-
# path_effects.Normal()],
|
|
372
|
-
# va="center", ha="left",font=self.font_colorbar)
|
|
379
|
+
|
|
373
380
|
|
|
374
381
|
cb_ax.text(1.04,tick_pos, str(int(tick_pos)),va="center", ha="left",fontsize=5) # font=self.font_colorbar
|
|
375
382
|
|
|
376
383
|
cb_ax.text(1.8, 1.035, colordata['units'], transform=cb_ax.transAxes,va="center", ha="center", fontsize=5 ) # font=self.font_colorbar
|
|
377
|
-
|
|
384
|
+
|
|
378
385
|
|
|
379
386
|
|
|
380
387
|
def add_crs_line(self,ax=None):
|
|
@@ -387,23 +394,24 @@ class DRAW_RADAR_OTHER:
|
|
|
387
394
|
print('warning: ax is None in function add_crs_line!')
|
|
388
395
|
return False
|
|
389
396
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
self.crs_startlat = start_lat
|
|
395
|
-
self.crs_startlon = start_lon
|
|
396
|
-
self.crs_endlat = end_lat
|
|
397
|
-
self.crs_endlon = end_lon
|
|
397
|
+
x,y,z=pyart.core.antenna_to_cartesian(self.crs_start_range, self.crs_start_azi, elevations=0)
|
|
398
|
+
start_lon,start_lat=pyart.core.cartesian_to_geographic_aeqd(x,y,self.g_rad_lon,self.g_rad_lat)
|
|
399
|
+
x,y,z=pyart.core.antenna_to_cartesian(self.crs_end_range, self.crs_end_azi, elevations=0)
|
|
400
|
+
end_lon,end_lat=pyart.core.cartesian_to_geographic_aeqd(x,y,self.g_rad_lon,self.g_rad_lat)
|
|
401
|
+
self.crs_startlat = start_lat[0]
|
|
402
|
+
self.crs_startlon = start_lon[0]
|
|
403
|
+
self.crs_endlat = end_lat[0]
|
|
404
|
+
self.crs_endlon = end_lon[0]
|
|
398
405
|
|
|
399
406
|
simble_color=[0,0,0]
|
|
400
|
-
ax.plot([start_lon,end_lon],[start_lat,end_lat],color='k',linewidth=0.75)
|
|
401
|
-
ax.plot([start_lon,end_lon],[start_lat,end_lat],color=simble_color,linewidth=0.5)
|
|
402
|
-
ax.text(start_lon,start_lat,'A',color=simble_color,font=self.font_colorbar,
|
|
407
|
+
ax.plot([start_lon[0],end_lon[0]],[start_lat[0],end_lat[0]],color='k',linewidth=0.75)
|
|
408
|
+
ax.plot([start_lon[0],end_lon[0]],[start_lat[0],end_lat[0]],color=simble_color,linewidth=0.5)
|
|
409
|
+
ax.text(start_lon[0],start_lat[0],'A',color=simble_color,font=self.font_colorbar,
|
|
403
410
|
path_effects=[path_effects.Stroke(linewidth=0.25, foreground='black'),path_effects.Normal()])
|
|
404
|
-
ax.text(end_lon,end_lat,'B',color=simble_color,font=self.font_colorbar,
|
|
411
|
+
ax.text(end_lon[0],end_lat[0],'B',color=simble_color,font=self.font_colorbar,
|
|
405
412
|
path_effects=[path_effects.Stroke(linewidth=0.25, foreground='black'),path_effects.Normal()])
|
|
406
413
|
|
|
414
|
+
# 从拼图文件中读取组合反射率
|
|
407
415
|
def get_cref_from_mosaicfile(self,):
|
|
408
416
|
|
|
409
417
|
data = None
|
|
@@ -425,21 +433,49 @@ class DRAW_RADAR_OTHER:
|
|
|
425
433
|
|
|
426
434
|
return True
|
|
427
435
|
|
|
436
|
+
# 从ROSE产品中读取组合反射率因子数据
|
|
437
|
+
def get_cref_from_rose(self,):
|
|
438
|
+
|
|
439
|
+
rose_reader = READ_ROSE()
|
|
440
|
+
data = None
|
|
441
|
+
if not os.path.exists(self.rose_cr_path + os.sep + self.rose_cr_name):
|
|
442
|
+
print(self.rose_cr_path + os.sep + self.rose_cr_name + ' does not exists!')
|
|
443
|
+
return False
|
|
444
|
+
try:
|
|
445
|
+
data = rose_reader.read_cr(self.rose_cr_path, self.rose_cr_name)
|
|
446
|
+
except:
|
|
447
|
+
print(self.rose_cr_path + os.sep + self.rose_cr_name + ' read error!')
|
|
448
|
+
self.cref=None
|
|
449
|
+
return False
|
|
450
|
+
cref = data.data
|
|
451
|
+
|
|
452
|
+
self.cref = cref.transpose()
|
|
453
|
+
self.cref = MA.masked_array(self.cref, mask=self.cref==-32)
|
|
454
|
+
self.grid_lat,self.grid_lon=np.meshgrid(data.lat.data,data.lon.data)
|
|
428
455
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
self.
|
|
456
|
+
return True
|
|
457
|
+
|
|
458
|
+
# 从单站雷达基数据中获取组合反射率因子,先进行三维插值,再求CR
|
|
459
|
+
def get_cref_from_radar(self,xlimits=[-50,50], ylimits=[-50,50], zlimits=[1,15], xreso=1000, yreso=1000, zreso=500, grid_origin=None):
|
|
460
|
+
print('enter get_cref_from_radar function!')
|
|
461
|
+
|
|
462
|
+
self.xlims=xlimits # km
|
|
463
|
+
self.ylims=ylimits # km
|
|
464
|
+
self.zlims=zlimits # km
|
|
465
|
+
self.xreso=xreso #m
|
|
466
|
+
self.yreso=yreso #m
|
|
467
|
+
self.zreso=zreso #m
|
|
436
468
|
self.g_xlim = (self.xlims[0]*1000,self.xlims[1]*1000)
|
|
437
469
|
self.g_ylim = (self.ylims[0]*1000,self.ylims[1]*1000)
|
|
438
470
|
self.g_zlim = (self.zlims[0]*1000,self.zlims[1]*1000)
|
|
439
471
|
self.g_numx = int(len(range(self.xlims[0],self.xlims[1]))*1000/self.xreso+1) # x方向格点数
|
|
440
472
|
self.g_numy = int(len(range(self.ylims[0],self.ylims[1]))*1000/self.yreso+1) # y方向格点数
|
|
441
473
|
self.g_numz = int(len(range(self.zlims[0],self.zlims[1]))*1000/self.zreso+1) # z方向格点数
|
|
442
|
-
|
|
474
|
+
if grid_origin is None:
|
|
475
|
+
grid_origin = (self.radar.latitude['data'][0], self.radar.longitude['data'][0])
|
|
476
|
+
print('grid shape:',(self.g_numz, self.g_numy, self.g_numx))
|
|
477
|
+
print('grid limits:',(self.g_zlim, self.g_ylim, self.g_xlim))
|
|
478
|
+
print('grid origin:',grid_origin)
|
|
443
479
|
self.grid=pyart.map.grid_from_radars(
|
|
444
480
|
(self.radar,),
|
|
445
481
|
grid_origin=grid_origin,
|
|
@@ -452,7 +488,9 @@ class DRAW_RADAR_OTHER:
|
|
|
452
488
|
|
|
453
489
|
self.cref = np.nanmax(xrdata.reflectivity.data[0],axis=0)
|
|
454
490
|
self.cref = self.cref.transpose()
|
|
455
|
-
self.grid_lat
|
|
491
|
+
self.grid_lat = xrdata.lat.data
|
|
492
|
+
self.grid_lon = xrdata.lon.data
|
|
493
|
+
|
|
456
494
|
|
|
457
495
|
def draw_cref(self,):
|
|
458
496
|
cmapdic= parse_pro(self.ref_colorfile)
|
|
@@ -554,10 +592,6 @@ class DRAW_RADAR_OTHER:
|
|
|
554
592
|
plt.setp(cntr.labelTexts, path_effects=[
|
|
555
593
|
patheffects.withStroke(linewidth=2, foreground="w")])
|
|
556
594
|
|
|
557
|
-
# for txobj in cntr.labelTexts:
|
|
558
|
-
# pos = txobj.get_position()
|
|
559
|
-
# txt = txobj.get_text()
|
|
560
|
-
# print(pos, txt)
|
|
561
595
|
|
|
562
596
|
# 画露点温度场客观分析等值线
|
|
563
597
|
def draw_drewpoint(self,zorder=2):
|
|
@@ -597,7 +631,6 @@ class DRAW_RADAR_OTHER:
|
|
|
597
631
|
|
|
598
632
|
dpt2m = oa_class.do_oa_base(params)
|
|
599
633
|
|
|
600
|
-
# levels = list(range(-40, 50, 0.5))
|
|
601
634
|
levels = np.arange(-40,50,0.5)
|
|
602
635
|
|
|
603
636
|
cntr = self.ax1.contour(dpt2m.lon.values,dpt2m.lat.values,dpt2m.dpt2m.values,
|
|
@@ -623,7 +656,6 @@ class DRAW_RADAR_OTHER:
|
|
|
623
656
|
aws_lons=awsdata['Lon'].values
|
|
624
657
|
aws_2minspd=awsdata['WIN_S_Avg_2mi'].values
|
|
625
658
|
aws_2mindir=awsdata['WIN_D_Avg_2mi'].values
|
|
626
|
-
# u,v=wind_components(aws_2minspd,aws_2mindir)
|
|
627
659
|
|
|
628
660
|
validflag=[]
|
|
629
661
|
for nn in range(len(aws_lats)):
|
|
@@ -641,14 +673,13 @@ class DRAW_RADAR_OTHER:
|
|
|
641
673
|
|
|
642
674
|
cntr = self.ax1.contour(vtx_div.lon.values,vtx_div.lat.values,vtx_div.vtx_10m.values,
|
|
643
675
|
levels=levels,colors='k',zorder=zorder)
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
676
|
+
for artist in cntr.get_children():
|
|
677
|
+
if isinstance(artist, matplotlib.collections.PathCollection):
|
|
678
|
+
artist.set_path_effects([patheffects.withStroke(linewidth=self.linewidth_cntr, foreground="w")])
|
|
679
|
+
clbls = self.ax1.clabel(artist,fmt="%2.1f",use_clabeltext=True,fontsize=self.fontsize_colorbar)
|
|
680
|
+
|
|
649
681
|
plt.setp(cntr.labelTexts, path_effects=[
|
|
650
|
-
patheffects.withStroke(linewidth=
|
|
651
|
-
|
|
682
|
+
patheffects.withStroke(linewidth=self.linewidth_cntr, foreground="w")])
|
|
652
683
|
|
|
653
684
|
def draw_ppi(self,fieldname='reflectivity',tilt=0,colorfile=None,**kwargs):
|
|
654
685
|
cmapdic = parse_pro(colorfile)
|
|
@@ -659,11 +690,12 @@ class DRAW_RADAR_OTHER:
|
|
|
659
690
|
print('tilt should be int and >=0')
|
|
660
691
|
return False
|
|
661
692
|
|
|
693
|
+
|
|
662
694
|
self.display.plot_ppi_map(fieldname, tilt,cmap=cmapdic['cmap'],gatefilter=self.gatefilter_ref,
|
|
663
695
|
min_lon=self.wlon, max_lon=self.elon, norm=cmapdic['norm'],ax=self.ax1,
|
|
664
|
-
min_lat=self.slat, max_lat=self.nlat,
|
|
665
|
-
fig=self.fig, lat_0=self.g_rad_lat,colorbar_flag=False,
|
|
666
|
-
|
|
696
|
+
min_lat=self.slat, max_lat=self.nlat,title_flag=False,
|
|
697
|
+
fig=self.fig, lat_0=self.g_rad_lat,lon_0=self.g_rad_lon,colorbar_flag=False,
|
|
698
|
+
**kwargs)
|
|
667
699
|
|
|
668
700
|
def draw_wind_barb(self,zorder=1):
|
|
669
701
|
# 画风场
|
|
@@ -687,8 +719,8 @@ class DRAW_RADAR_OTHER:
|
|
|
687
719
|
if aws_2minspd[nn] > 999000 or aws_2mindir[nn] > 999000 or aws_2minspd[nn] < 1:
|
|
688
720
|
continue
|
|
689
721
|
u,v=wind_components(float(2)*units('m/s'),int(aws_2mindir[nn])*units.deg)
|
|
690
|
-
plt.barbs(aws_lons[nn],aws_lats[nn],u.magnitude*2.5,v.magnitude*2.5,length=5,barbcolor='black',linewidth=
|
|
691
|
-
plt.barbs(aws_lons[nn],aws_lats[nn],u.magnitude*2.5,v.magnitude*2.5,length=5,barbcolor='white',linewidth=
|
|
722
|
+
plt.barbs(aws_lons[nn],aws_lats[nn],u.magnitude*2.5,v.magnitude*2.5,length=5,barbcolor='black',linewidth=self.wind_bar_width_outter,zorder=zorder)
|
|
723
|
+
plt.barbs(aws_lons[nn],aws_lats[nn],u.magnitude*2.5,v.magnitude*2.5,length=5,barbcolor='white',linewidth=self.wind_bar_width_inner,zorder=zorder)
|
|
692
724
|
|
|
693
725
|
|
|
694
726
|
def draw_wind_quiver(self,zorder=1):
|
|
@@ -765,18 +797,14 @@ class DRAW_RADAR_OTHER:
|
|
|
765
797
|
for tick_pos in tick_poss:
|
|
766
798
|
ax2.vlines(tick_pos, 0, 0.2, transform=trans, color="black")
|
|
767
799
|
ax2.vlines(tick_pos, 0.85, 1, transform=trans, color="black")
|
|
768
|
-
|
|
769
|
-
# ax2.text(tick_pos, 0.5, str(int(tick_pos)),color=[1,1,1],path_effects=[path_effects.Stroke(linewidth=1, foreground='black'),path_effects.Normal()],
|
|
770
|
-
# va="center", ha="center", transform=trans, fontsize = self.fontsize1)
|
|
800
|
+
|
|
771
801
|
ax2.text(tick_pos, 1.4, str(int(tick_pos)),va="center", ha="center", transform=trans, fontsize = self.fontsize_colorbar)
|
|
772
|
-
|
|
773
|
-
# color=[1,1,1],path_effects=[path_effects.Stroke(linewidth=1, foreground='black'),path_effects.Normal()],fontsize = self.fontsize_colorbar)
|
|
802
|
+
|
|
774
803
|
ax2.text(1.02, 0.5, cmapdic['units'], transform=ax2.transAxes,va="center", ha="center",fontsize = self.fontsize_colorbar)
|
|
775
804
|
|
|
776
805
|
|
|
777
806
|
# 垂直色标
|
|
778
807
|
if orientation == 'vertical':
|
|
779
|
-
# cbar_axes = [self.map_panel_axes[0]+ self.map_panel_axes[2] + 0.01,self.map_panel_axes[1],0.03,self.map_panel_axes[3]]
|
|
780
808
|
ax_pos = self.ax1.get_position().bounds
|
|
781
809
|
cbar_axes = [ax_pos[0]+ ax_pos[2]+0.01,(ax_pos[1]+ax_pos[1]+ax_pos[3])/2-ax_pos[3]*cb_ratio/2,0.02,ax_pos[3]*cb_ratio]
|
|
782
810
|
cb_ax = self.fig.add_axes(cbar_axes)
|
|
@@ -784,8 +812,6 @@ class DRAW_RADAR_OTHER:
|
|
|
784
812
|
|
|
785
813
|
cbar = ColorbarBase(cb_ax, orientation=orientation, norm=colordata['norm'], cmap=colordata['cmap'],extend='both')
|
|
786
814
|
cbar.set_ticks([])
|
|
787
|
-
# cb_ax.axis('tight')
|
|
788
|
-
|
|
789
815
|
trans = transforms.blended_transform_factory(cb_ax.transData, cb_ax.transAxes)
|
|
790
816
|
tick_poss=np.arange(colordata['norm'].vmin, colordata['norm'].vmax, tickstep)
|
|
791
817
|
xrange = colordata['norm'].vmax - colordata['norm'].vmin
|
|
@@ -794,15 +820,11 @@ class DRAW_RADAR_OTHER:
|
|
|
794
820
|
cb_ax.hlines(tick_pos, colordata['norm'].vmin, colordata['norm'].vmin + 0.3*xrange, color="black",linewidth=0.5)
|
|
795
821
|
cb_ax.hlines(tick_pos, colordata['norm'].vmin + 0.7*xrange, colordata['norm'].vmax, color="black",linewidth=0.5)
|
|
796
822
|
|
|
797
|
-
# cb_ax.text(1.02,tick_pos, str(int(tick_pos)),color=[1,1,1],
|
|
798
|
-
# path_effects=[path_effects.Stroke(linewidth=self.stroke_line_width, foreground='black'),
|
|
799
|
-
# path_effects.Normal()],
|
|
800
|
-
# va="center", ha="left",font=self.font_colorbar)
|
|
801
823
|
|
|
802
824
|
cb_ax.text(1.04,tick_pos, str(int(tick_pos)),va="center", ha="left",fontsize=5) # font=self.font_colorbar
|
|
803
825
|
|
|
804
826
|
cb_ax.text(1.85, 1.035, colordata['units'], transform=cb_ax.transAxes,va="center", ha="center", fontsize=5 ) # ,font=self.font_colorbar
|
|
805
|
-
|
|
827
|
+
|
|
806
828
|
|
|
807
829
|
|
|
808
830
|
def draw_gisinfo(self,):
|
|
@@ -811,7 +833,6 @@ class DRAW_RADAR_OTHER:
|
|
|
811
833
|
aa = (np.array(self.gis_lats)<self.nlat) & (np.array(self.gis_lats) > self.slat)
|
|
812
834
|
bb = (np.array(self.gis_lons)<self.elon) & (np.array(self.gis_lons) > self.wlon)
|
|
813
835
|
cc = aa & bb
|
|
814
|
-
# cc = cc.values
|
|
815
836
|
|
|
816
837
|
alltxt=[]
|
|
817
838
|
for nn in range(len(self.gis_name)):
|
|
@@ -823,65 +844,51 @@ class DRAW_RADAR_OTHER:
|
|
|
823
844
|
markersize=1, alpha=0.8, transform=ccrs.PlateCarree())
|
|
824
845
|
txt_lon = curlon
|
|
825
846
|
txt_lat = curlat
|
|
826
|
-
if self.gis_name[nn] == '农博园':
|
|
827
|
-
txt_lon = curlon + 0.05
|
|
828
|
-
txt_lat = curlat + 0.01
|
|
829
|
-
elif self.gis_name[nn] == '吉林农大':
|
|
830
|
-
txt_lon = curlon + 0.06
|
|
831
|
-
txt_lat = curlat - 0.015
|
|
832
847
|
texts = self.ax1.text(txt_lon, txt_lat, self.gis_name[nn], clip_on=True,
|
|
833
848
|
verticalalignment='center', horizontalalignment='right',
|
|
834
849
|
transform=text_transform, fontproperties=self.font_gis, color='white',
|
|
835
850
|
path_effects=[path_effects.Stroke(linewidth=1, foreground='black'),path_effects.Normal()])
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
path_effects=[path_effects.Stroke(linewidth=lw+0.2, foreground='white'),path_effects.Normal()],
|
|
864
|
-
facecolor=facecolor, edgecolor=edgecolor, lw=lw, **kwargs)
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
def add_china_map_2cartopy(self, ax, name='province',edgecolor='k', lw=0.8,facecolor='none',transform=None, **kwargs):
|
|
854
|
+
"""
|
|
855
|
+
Draw china boundary on cartopy map.
|
|
856
|
+
|
|
857
|
+
:param ax: matplotlib axes instance.
|
|
858
|
+
:param name: map name.
|
|
859
|
+
:param facecolor: fill color, default is none.
|
|
860
|
+
:param edgecolor: edge color.
|
|
861
|
+
:param lw: line width.
|
|
862
|
+
:return: None
|
|
863
|
+
"""
|
|
864
|
+
|
|
865
|
+
# map name
|
|
866
|
+
names = {'nation': "bou1_4p", 'province': "bou2_4p",
|
|
867
|
+
'county': "BOUNT_poly", 'river': "hyd1_4l",
|
|
868
|
+
'river_high': "hyd2_4l"}
|
|
869
|
+
|
|
870
|
+
# get shape filename
|
|
871
|
+
shpfile = MAP_PATH + os.sep + names[name] + ".shp"
|
|
872
|
+
|
|
873
|
+
# add map
|
|
874
|
+
ax.add_geometries(
|
|
875
|
+
Reader(shpfile).geometries(), ccrs.PlateCarree(),
|
|
876
|
+
path_effects=[path_effects.Stroke(linewidth=lw+0.3, foreground='white'),path_effects.Normal()],
|
|
877
|
+
facecolor=facecolor, edgecolor=edgecolor, lw=lw, **kwargs)
|
|
865
878
|
|
|
866
879
|
def draw_basemap(self,):
|
|
867
880
|
# Setting projection and ploting the second tilt
|
|
868
881
|
projection = ccrs.PlateCarree()
|
|
869
|
-
# projection = ccrs.LambertConformal(central_latitude=radar.latitude['data'][0],
|
|
870
|
-
# central_longitude=radar.longitude['data'][0])
|
|
871
|
-
# figsize=(4,3)
|
|
872
|
-
self.fig = plt.figure(figsize=(self.paintsize_x,self.paintsize_y))
|
|
873
|
-
# DPI = 100
|
|
874
|
-
# fig.set_size_inches(800.0/float(DPI),600.0/float(DPI))
|
|
875
882
|
|
|
883
|
+
self.fig = plt.figure(figsize=(self.paintsize_x,self.paintsize_y))
|
|
884
|
+
|
|
876
885
|
self.map_panel_axes = [0.12, 0.1, .76, .8]
|
|
877
|
-
# map_panel_axes = [0.01, 0.06, 0.98, 0.88]
|
|
878
886
|
self.ax1 = self.fig.add_axes(self.map_panel_axes, projection=projection)
|
|
879
887
|
pass
|
|
880
888
|
|
|
881
889
|
def add_chinamap(self,):
|
|
882
|
-
self.add_china_map_2cartopy(self.ax1, name='county',
|
|
883
|
-
|
|
884
|
-
|
|
890
|
+
self.add_china_map_2cartopy(self.ax1, name='county',edgecolor=self.mapcolor, lw=self.linewidth_map)
|
|
891
|
+
|
|
885
892
|
|
|
886
893
|
def draw_title(self,titlestr='XX雷达0.5度仰角径向速度'):
|
|
887
894
|
if not self.bdraw_title_ppi:
|
|
@@ -896,8 +903,7 @@ class DRAW_RADAR_OTHER:
|
|
|
896
903
|
plt.title('%s(%s BJT)'%(titlestr,tstr),fontproperties=self.font_title,loc='right',verticalalignment='top')
|
|
897
904
|
|
|
898
905
|
def crs_finish_save(self,bshow=False,subdir='',add_str='',):
|
|
899
|
-
|
|
900
|
-
# self.crs_ax.set_xlim([0,150])
|
|
906
|
+
|
|
901
907
|
|
|
902
908
|
try:
|
|
903
909
|
if not os.path.exists(self.picpath + os.sep + subdir):
|
|
@@ -908,8 +914,8 @@ class DRAW_RADAR_OTHER:
|
|
|
908
914
|
plt.savefig(self.picpath + os.sep + subdir + os.sep + self.timestr + '.' + add_str + '.' + self.pic_format,dpi=self.dpi)
|
|
909
915
|
else:
|
|
910
916
|
plt.savefig(self.picpath + os.sep + subdir + os.sep + self.timestr + '.' + add_str + '.' + self.pic_format,dpi=self.dpi,bbox_inches='tight')
|
|
911
|
-
|
|
912
|
-
print(
|
|
917
|
+
|
|
918
|
+
print(self.picpath + os.sep + subdir + os.sep + self.timestr + '.' + add_str + '.' + self.pic_format)
|
|
913
919
|
if bshow:
|
|
914
920
|
plt.show()
|
|
915
921
|
|
|
@@ -946,7 +952,7 @@ class DRAW_RADAR_OTHER:
|
|
|
946
952
|
plt.savefig(self.picpath + os.sep + subdir + os.sep + self.timestr + '.' + self.pic_format,dpi=self.dpi)
|
|
947
953
|
else:
|
|
948
954
|
plt.savefig(self.picpath + os.sep + subdir + os.sep + self.timestr + '.' + self.pic_format,dpi=self.dpi,bbox_inches='tight')
|
|
949
|
-
print(
|
|
955
|
+
print(self.picpath + os.sep + subdir + os.sep + self.timestr + '.' + self.pic_format)
|
|
950
956
|
if bshow:
|
|
951
957
|
plt.show()
|
|
952
958
|
|
|
@@ -955,7 +961,6 @@ class DRAW_RADAR_OTHER:
|
|
|
955
961
|
def draw_vel_pre(self,subdir='径向速度+当前小时降水',tilt=1):
|
|
956
962
|
# check
|
|
957
963
|
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
958
|
-
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
959
964
|
return False
|
|
960
965
|
self.draw_basemap()
|
|
961
966
|
self.draw_gisinfo()
|
|
@@ -963,7 +968,7 @@ class DRAW_RADAR_OTHER:
|
|
|
963
968
|
self.draw_pre_1h()
|
|
964
969
|
self.add_chinamap()
|
|
965
970
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
966
|
-
self.draw_title('%s
|
|
971
|
+
self.draw_title('%s %.1f° %s'%(self.radarname,ele, subdir))
|
|
967
972
|
self.draw_colorbar(colorfile=self.vel_colorfile)
|
|
968
973
|
self.finish_save(subdir=subdir)
|
|
969
974
|
|
|
@@ -975,7 +980,7 @@ class DRAW_RADAR_OTHER:
|
|
|
975
980
|
self.gatefilter_ref.exclude_below('reflectivity', thred, exclude_masked=True, op='or', inclusive=False)
|
|
976
981
|
|
|
977
982
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
978
|
-
subdir='%.
|
|
983
|
+
subdir='%.1f_%s'%(ele,subdir)
|
|
979
984
|
if not self.breplace and os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
980
985
|
print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
981
986
|
return False
|
|
@@ -998,7 +1003,7 @@ class DRAW_RADAR_OTHER:
|
|
|
998
1003
|
self.gatefilter_ref.exclude_below('cross_correlation_ratio', thred, exclude_masked=True, op='or', inclusive=False)
|
|
999
1004
|
|
|
1000
1005
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1001
|
-
subdir='%.
|
|
1006
|
+
subdir='%.1f_%s'%(ele,subdir)
|
|
1002
1007
|
if not self.breplace and os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1003
1008
|
print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1004
1009
|
return False
|
|
@@ -1022,7 +1027,7 @@ class DRAW_RADAR_OTHER:
|
|
|
1022
1027
|
self.gatefilter_ref.exclude_below('cross_correlation_ratio', thred, exclude_masked=True, op='or', inclusive=False)
|
|
1023
1028
|
|
|
1024
1029
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1025
|
-
subdir='%.
|
|
1030
|
+
subdir='%.1f_%s'%(ele,subdir)
|
|
1026
1031
|
if not self.breplace and os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1027
1032
|
print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1028
1033
|
return False
|
|
@@ -1041,7 +1046,7 @@ class DRAW_RADAR_OTHER:
|
|
|
1041
1046
|
if self.radar is None:
|
|
1042
1047
|
return False
|
|
1043
1048
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1044
|
-
subdir='%.
|
|
1049
|
+
subdir='%.1f_%s'%(ele,subdir)
|
|
1045
1050
|
|
|
1046
1051
|
if not self.breplace and os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.' + format):
|
|
1047
1052
|
print(self.picpath + os.sep + subdir + self.timestr + '.' + format + ' already exists!')
|
|
@@ -1066,7 +1071,7 @@ class DRAW_RADAR_OTHER:
|
|
|
1066
1071
|
self.add_chinamap()
|
|
1067
1072
|
self.draw_wind_barb()
|
|
1068
1073
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1069
|
-
self.draw_title('%s
|
|
1074
|
+
self.draw_title('%s %.1f° %s'%(self.radarname,ele, subdir))
|
|
1070
1075
|
self.draw_colorbar(colorfile=self.vel_colorfile)
|
|
1071
1076
|
self.finish_save(subdir=subdir)
|
|
1072
1077
|
|
|
@@ -1081,30 +1086,30 @@ class DRAW_RADAR_OTHER:
|
|
|
1081
1086
|
self.add_chinamap()
|
|
1082
1087
|
self.draw_wind_quiver()
|
|
1083
1088
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1084
|
-
self.draw_title('%s
|
|
1089
|
+
self.draw_title('%s %.1f° %s'%(self.radarname,ele, subdir))
|
|
1085
1090
|
self.draw_colorbar(colorfile=self.vel_colorfile)
|
|
1086
1091
|
self.finish_save(subdir=subdir)
|
|
1087
1092
|
|
|
1088
1093
|
def draw_ref_pre(self,subdir='基本反射率+当前小时降水',tilt=0):
|
|
1089
1094
|
# check
|
|
1090
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1091
|
-
|
|
1092
|
-
|
|
1095
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1096
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1097
|
+
# return False
|
|
1093
1098
|
self.draw_basemap()
|
|
1094
1099
|
self.draw_gisinfo()
|
|
1095
1100
|
self.draw_ppi(fieldname='reflectivity',tilt=tilt,colorfile=self.ref_colorfile)
|
|
1096
1101
|
self.draw_pre_1h()
|
|
1097
1102
|
self.add_chinamap()
|
|
1098
1103
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1099
|
-
self.draw_title('%s
|
|
1104
|
+
self.draw_title('%s %.1f° %s'%(self.radarname,ele, subdir))
|
|
1100
1105
|
self.draw_colorbar(colorfile=self.ref_colorfile)
|
|
1101
1106
|
self.finish_save(subdir=subdir)
|
|
1102
1107
|
|
|
1103
1108
|
def draw_cref_pre(self,subdir='组合反射率+当前小时降水'):
|
|
1104
1109
|
# check
|
|
1105
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1106
|
-
|
|
1107
|
-
|
|
1110
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1111
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1112
|
+
# return False
|
|
1108
1113
|
self.draw_basemap()
|
|
1109
1114
|
self.draw_gisinfo()
|
|
1110
1115
|
self.draw_cref()
|
|
@@ -1116,9 +1121,9 @@ class DRAW_RADAR_OTHER:
|
|
|
1116
1121
|
|
|
1117
1122
|
def draw_cref_wind_barb(self,subdir='组合反射率+地面自动站风场'):
|
|
1118
1123
|
# check
|
|
1119
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1120
|
-
|
|
1121
|
-
|
|
1124
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1125
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1126
|
+
# return False
|
|
1122
1127
|
self.draw_basemap()
|
|
1123
1128
|
self.draw_gisinfo()
|
|
1124
1129
|
self.draw_cref()
|
|
@@ -1130,9 +1135,9 @@ class DRAW_RADAR_OTHER:
|
|
|
1130
1135
|
|
|
1131
1136
|
def draw_cref_wind_quiver(self,subdir='组合反射率+地面流场'):
|
|
1132
1137
|
# check
|
|
1133
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1134
|
-
|
|
1135
|
-
|
|
1138
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1139
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1140
|
+
# return False
|
|
1136
1141
|
self.draw_basemap()
|
|
1137
1142
|
self.draw_gisinfo()
|
|
1138
1143
|
self.draw_cref()
|
|
@@ -1144,9 +1149,9 @@ class DRAW_RADAR_OTHER:
|
|
|
1144
1149
|
|
|
1145
1150
|
def draw_cref_pre_wind_barb(self,subdir='组合反射率+地面自动站风场+当前小时降水'):
|
|
1146
1151
|
# check
|
|
1147
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1148
|
-
|
|
1149
|
-
|
|
1152
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1153
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1154
|
+
# return False
|
|
1150
1155
|
|
|
1151
1156
|
self.draw_basemap()
|
|
1152
1157
|
self.draw_gisinfo()
|
|
@@ -1161,9 +1166,9 @@ class DRAW_RADAR_OTHER:
|
|
|
1161
1166
|
|
|
1162
1167
|
def draw_ref_wind_barb_vortex(self,subdir='基本反射率+地面自动站风场+涡度场(等值线)',tilt=0):
|
|
1163
1168
|
# check
|
|
1164
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1165
|
-
|
|
1166
|
-
|
|
1169
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1170
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1171
|
+
# return False
|
|
1167
1172
|
self.draw_basemap()
|
|
1168
1173
|
self.draw_gisinfo()
|
|
1169
1174
|
self.draw_ppi(fieldname='reflectivity',tilt=tilt,colorfile=self.ref_colorfile)
|
|
@@ -1171,15 +1176,15 @@ class DRAW_RADAR_OTHER:
|
|
|
1171
1176
|
self.add_chinamap()
|
|
1172
1177
|
self.draw_wind_barb(zorder=10)
|
|
1173
1178
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1174
|
-
self.draw_title('%s
|
|
1179
|
+
self.draw_title('%s %.1f° %s'%(self.radarname,ele, subdir))
|
|
1175
1180
|
self.draw_colorbar(colorfile=self.ref_colorfile)
|
|
1176
1181
|
self.finish_save(subdir=subdir)
|
|
1177
1182
|
|
|
1178
1183
|
def draw_ref_wind_divergence(self,subdir='基本反射率+地面自动站风场+散度(等值线)',tilt=0,type='quiver'):
|
|
1179
1184
|
# check
|
|
1180
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1181
|
-
|
|
1182
|
-
|
|
1185
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1186
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1187
|
+
# return False
|
|
1183
1188
|
self.draw_basemap()
|
|
1184
1189
|
self.draw_gisinfo()
|
|
1185
1190
|
self.draw_ppi(fieldname='reflectivity',tilt=tilt,colorfile=self.ref_colorfile)
|
|
@@ -1190,15 +1195,15 @@ class DRAW_RADAR_OTHER:
|
|
|
1190
1195
|
elif type == 'barb':
|
|
1191
1196
|
self.draw_wind_barb(zorder=10)
|
|
1192
1197
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1193
|
-
self.draw_title('%s
|
|
1198
|
+
self.draw_title('%s %.1f° %s'%(self.radarname,ele, subdir))
|
|
1194
1199
|
self.draw_colorbar(colorfile=self.ref_colorfile)
|
|
1195
1200
|
self.finish_save(subdir=subdir)
|
|
1196
1201
|
|
|
1197
1202
|
def draw_ref_wind_barb_temperature(self,subdir='基本反射率+地面自动站风场+温度场(等值线)',tilt=0):
|
|
1198
1203
|
# check
|
|
1199
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1200
|
-
|
|
1201
|
-
|
|
1204
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1205
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1206
|
+
# return False
|
|
1202
1207
|
self.draw_basemap()
|
|
1203
1208
|
self.draw_gisinfo()
|
|
1204
1209
|
self.draw_ppi(fieldname='reflectivity',tilt=tilt,colorfile=self.ref_colorfile)
|
|
@@ -1206,15 +1211,15 @@ class DRAW_RADAR_OTHER:
|
|
|
1206
1211
|
self.add_chinamap()
|
|
1207
1212
|
self.draw_wind_barb(zorder=10)
|
|
1208
1213
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1209
|
-
self.draw_title('%s
|
|
1214
|
+
self.draw_title('%s %.1f°%s'%(self.radarname,ele, subdir))
|
|
1210
1215
|
self.draw_colorbar(colorfile=self.ref_colorfile)
|
|
1211
1216
|
self.finish_save(subdir=subdir)
|
|
1212
1217
|
|
|
1213
1218
|
def draw_ref_wind_barb_dewpoint(self,subdir='基本反射率+地面自动站风场+露点场(等值线)',tilt=0):
|
|
1214
1219
|
# check
|
|
1215
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1216
|
-
|
|
1217
|
-
|
|
1220
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1221
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1222
|
+
# return False
|
|
1218
1223
|
self.draw_basemap()
|
|
1219
1224
|
self.draw_gisinfo()
|
|
1220
1225
|
self.draw_ppi(fieldname='reflectivity',tilt=tilt,colorfile=self.ref_colorfile)
|
|
@@ -1222,16 +1227,16 @@ class DRAW_RADAR_OTHER:
|
|
|
1222
1227
|
self.add_chinamap()
|
|
1223
1228
|
self.draw_wind_barb(zorder=10)
|
|
1224
1229
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1225
|
-
self.draw_title('%s
|
|
1230
|
+
self.draw_title('%s %.1f° %s'%(self.radarname,ele, subdir))
|
|
1226
1231
|
self.draw_colorbar(colorfile=self.ref_colorfile)
|
|
1227
1232
|
self.finish_save(subdir=subdir)
|
|
1228
1233
|
|
|
1229
1234
|
|
|
1230
1235
|
def draw_ref_pre_wind(self,subdir='基本反射率+地面自动站风场+当前小时降水',type='barb',tilt=0):
|
|
1231
1236
|
# type == barb or quiver
|
|
1232
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1233
|
-
|
|
1234
|
-
|
|
1237
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1238
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1239
|
+
# return False
|
|
1235
1240
|
self.draw_basemap()
|
|
1236
1241
|
self.draw_gisinfo()
|
|
1237
1242
|
self.draw_ppi(fieldname='reflectivity',tilt=tilt,colorfile=self.ref_colorfile)
|
|
@@ -1242,15 +1247,15 @@ class DRAW_RADAR_OTHER:
|
|
|
1242
1247
|
self.draw_pre_1h()
|
|
1243
1248
|
self.add_chinamap()
|
|
1244
1249
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1245
|
-
self.draw_title('%s
|
|
1250
|
+
self.draw_title('%s %.1f° %s'%(self.radarname,ele, subdir))
|
|
1246
1251
|
self.draw_colorbar(colorfile=self.ref_colorfile)
|
|
1247
1252
|
self.finish_save(subdir=subdir)
|
|
1248
1253
|
|
|
1249
1254
|
def draw_ref_wind(self,subdir='基本反射率+地面自动站风场',type='barb',tilt=0):
|
|
1250
1255
|
# type == barb or quiver
|
|
1251
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1252
|
-
|
|
1253
|
-
|
|
1256
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.png'):
|
|
1257
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.png' + ' already exists!')
|
|
1258
|
+
# return False
|
|
1254
1259
|
self.draw_basemap()
|
|
1255
1260
|
self.draw_gisinfo()
|
|
1256
1261
|
self.draw_ppi(fieldname='reflectivity',tilt=tilt,colorfile=self.ref_colorfile)
|
|
@@ -1260,10 +1265,45 @@ class DRAW_RADAR_OTHER:
|
|
|
1260
1265
|
self.draw_wind_quiver()
|
|
1261
1266
|
self.add_chinamap()
|
|
1262
1267
|
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1263
|
-
self.draw_title('%s
|
|
1268
|
+
self.draw_title('%s %.1f° %s'%(self.radarname,ele, subdir))
|
|
1264
1269
|
self.draw_colorbar(colorfile=self.ref_colorfile)
|
|
1265
1270
|
self.finish_save(subdir=subdir)
|
|
1266
1271
|
|
|
1272
|
+
|
|
1273
|
+
# 叠加1小时变温
|
|
1274
|
+
def draw_ref_wind_delta_t(self,subdir='基本反射率+地面自动站风场+1小时变温(等值线)',tilt=0,type='quiver'):
|
|
1275
|
+
# check
|
|
1276
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.' + self.pic_format):
|
|
1277
|
+
# print(self.picpath + os.sep + subdir + self.timestr + '.' + self.pic_format + ' already exists!')
|
|
1278
|
+
# return False
|
|
1279
|
+
self.draw_basemap()
|
|
1280
|
+
self.draw_gisinfo()
|
|
1281
|
+
|
|
1282
|
+
self.draw_ppi(fieldname='reflectivity',tilt=tilt,colorfile=self.ref_colorfile)
|
|
1283
|
+
# self.draw_divergence(zorder=2)
|
|
1284
|
+
self.draw_delta_t(zorder=2)
|
|
1285
|
+
self.add_chinamap()
|
|
1286
|
+
if type == 'quiver':
|
|
1287
|
+
self.draw_wind_quiver(zorder=10)
|
|
1288
|
+
elif type == 'barb':
|
|
1289
|
+
self.draw_wind_barb(zorder=10)
|
|
1290
|
+
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1291
|
+
self.draw_title('%s %.1f° %s'%(self.radarname,ele, subdir))
|
|
1292
|
+
self.draw_colorbar(colorfile=self.ref_colorfile)
|
|
1293
|
+
self.finish_save(subdir=subdir)
|
|
1294
|
+
|
|
1295
|
+
# 叠加1小时变压
|
|
1296
|
+
def draw_ref_wind_delta_p(self,subdir='基本反射率+地面自动站风场+1小时变压(等值线)',tilt=0,type='quiver'):
|
|
1297
|
+
# check
|
|
1298
|
+
# if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + + '.' + self.pic_format):
|
|
1299
|
+
# print(self.picpath + os.sep + subdir + self.timestr + + '.' + self.pic_format + ' already exists!')
|
|
1300
|
+
# return False
|
|
1301
|
+
self.draw_basemap()
|
|
1302
|
+
self.draw_gisinfo()
|
|
1303
|
+
self.draw_ppi(fieldname='reflectivity',tilt=tilt,colorfile=self.ref_colorfile)
|
|
1304
|
+
self.draw_delta_p(zorder=2)
|
|
1305
|
+
|
|
1306
|
+
|
|
1267
1307
|
def draw_delta_t(self,zorder=2):
|
|
1268
1308
|
|
|
1269
1309
|
# 叠加1小时变温
|
|
@@ -1284,9 +1324,10 @@ class DRAW_RADAR_OTHER:
|
|
|
1284
1324
|
cntr = self.ax1.contour(delta_t_data.lon.values,delta_t_data.lat.values,delta_t_data.t2m_delta_1hr.values.T,
|
|
1285
1325
|
levels=levels,colors=self.contour_color,zorder=zorder,linewidths=self.linewidth_cntr)
|
|
1286
1326
|
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1327
|
+
for artist in cntr.get_children():
|
|
1328
|
+
if isinstance(artist, matplotlib.collections.PathCollection):
|
|
1329
|
+
artist.set_path_effects([patheffects.withStroke(linewidth=self.linewidth_cntr, foreground="w")])
|
|
1330
|
+
clbls = self.ax1.clabel(artist,fmt="%2.1f",use_clabeltext=True,fontsize=self.fontsize_colorbar)
|
|
1290
1331
|
|
|
1291
1332
|
plt.setp(cntr.labelTexts, path_effects=[
|
|
1292
1333
|
patheffects.withStroke(linewidth=self.linewidth_cntr, foreground="w")])
|
|
@@ -1311,69 +1352,99 @@ class DRAW_RADAR_OTHER:
|
|
|
1311
1352
|
cntr = self.ax1.contour(delta_p_data.lon.values,delta_p_data.lat.values,delta_p_data.sprs2m_delta_1hr.values.T,
|
|
1312
1353
|
levels=levels,colors=self.contour_color,zorder=zorder,linewidths=self.linewidth_cntr,label='1小时变压')
|
|
1313
1354
|
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1355
|
+
for artist in cntr.get_children():
|
|
1356
|
+
if isinstance(artist, matplotlib.collections.PathCollection):
|
|
1357
|
+
artist.set_path_effects([patheffects.withStroke(linewidth=self.linewidth_cntr, foreground="w")])
|
|
1358
|
+
clbls = self.ax1.clabel(artist,fmt="%2.1f",use_clabeltext=True,fontsize=self.fontsize_colorbar,inline=True)
|
|
1318
1359
|
|
|
1319
1360
|
plt.setp(cntr.labelTexts, path_effects=[
|
|
1320
1361
|
patheffects.withStroke(linewidth=self.linewidth_cntr, foreground="w")])
|
|
1321
1362
|
return cntr
|
|
1322
1363
|
|
|
1323
1364
|
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
# filename = 'resources/topo/china_dem_30m.nc'
|
|
1328
|
-
basetopo = xr.open_dataset(filename)
|
|
1329
|
-
#根据经纬度范围获取区域内的地形高度最大最小值
|
|
1330
|
-
topo = basetopo.sel(Longitude=slice(self.wlon,self.elon),Latitude=slice(self.slat,self.nlat))
|
|
1331
|
-
# topo = basetopo.sel(lon=slice(self.wlon,self.elon),lat=slice(self.slat,self.nlat))
|
|
1332
|
-
topo_min = float(topo.min().topo.values)
|
|
1333
|
-
topo_max = float(topo.max().topo.values)
|
|
1334
|
-
# self.ax1.pcolormesh(topo['lon'].values,topo['lat'].values,topo['topo'],vmin=300,vmax=1000,cmap='pyart_Gray5')# ,levels=[250,500,750,1000],
|
|
1335
|
-
self.ax1.pcolormesh(topo['Longitude'].values,topo['Latitude'].values,topo['topo'],vmin=300,vmax=1000,cmap='pyart_Gray5')# ,levels=[250,500,750,1000],
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
|
|
1336
1368
|
|
|
1337
|
-
|
|
1338
|
-
def draw_ref_wind_delta_t(self,subdir='基本反射率+地面自动站风场+1小时变温(等值线)',tilt=0,type='quiver'):
|
|
1339
|
-
# check
|
|
1340
|
-
if os.path.exists(self.picpath + os.sep + subdir + os.sep +self.timestr + '.' + self.pic_format):
|
|
1341
|
-
print(self.picpath + os.sep + subdir + self.timestr + '.' + self.pic_format + ' already exists!')
|
|
1342
|
-
return False
|
|
1343
|
-
self.draw_basemap()
|
|
1344
|
-
self.draw_gisinfo()
|
|
1345
|
-
self.draw_topo()
|
|
1346
|
-
self.draw_ppi(fieldname='reflectivity',tilt=tilt,colorfile=self.ref_colorfile)
|
|
1347
|
-
# self.draw_divergence(zorder=2)
|
|
1348
|
-
self.draw_delta_t(zorder=2)
|
|
1349
|
-
self.add_chinamap()
|
|
1350
|
-
if type == 'quiver':
|
|
1351
|
-
self.draw_wind_quiver(zorder=10)
|
|
1352
|
-
elif type == 'barb':
|
|
1353
|
-
self.draw_wind_barb(zorder=10)
|
|
1354
|
-
ele=np.mean(self.radar.get_elevation(tilt))
|
|
1355
|
-
self.draw_title('%s雷达%.1f度%s'%(self.radarname,ele, subdir))
|
|
1356
|
-
self.draw_colorbar(colorfile=self.ref_colorfile)
|
|
1357
|
-
self.finish_save(subdir=subdir)
|
|
1369
|
+
if __name__ == "__main__":
|
|
1358
1370
|
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1371
|
+
import pandas as pd
|
|
1372
|
+
import numpy as np
|
|
1373
|
+
# 准备GIS文件
|
|
1374
|
+
gisfile = '/home/wjzhu/OneDrive/PythonCode/MyWork/metradar/resources/stations/cma_city_station_info.dat'
|
|
1375
|
+
|
|
1376
|
+
cities = pd.read_csv(gisfile, delimiter=r"\s+") # cma_city_station_info
|
|
1377
|
+
|
|
1378
|
+
cityname = np.unique(cities['city_name'])
|
|
1379
|
+
stanames=[]
|
|
1380
|
+
lat=[]
|
|
1381
|
+
lon=[]
|
|
1382
|
+
|
|
1383
|
+
curdata = cities
|
|
1384
|
+
for name in cityname:
|
|
1385
|
+
flag2 = curdata['city_name'] == name
|
|
1386
|
+
tmp_lat = np.mean(curdata[flag2]['lat'])
|
|
1387
|
+
tmp_lon = np.mean(curdata[flag2]['lon'])
|
|
1388
|
+
|
|
1389
|
+
stanames.append(name)
|
|
1390
|
+
lon.append(tmp_lon)
|
|
1391
|
+
lat.append(tmp_lat)
|
|
1369
1392
|
|
|
1370
1393
|
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1394
|
+
# 初始化绘图参数
|
|
1395
|
+
params=ini_params()
|
|
1396
|
+
|
|
1397
|
+
# 修改补充完善参数
|
|
1398
|
+
params['radarfile_path'] = '/mnt/e/metradar_test/radar_aws/radar_fmt/2021/07/20/Z9371'
|
|
1399
|
+
params['radarfile_name'] = 'Z_RADR_I_Z9371_20210720083000_O_DOR_SAD_CAP_FMT.bin.bz2'
|
|
1400
|
+
params['rose_cr_path'] = '/mnt/e/metradar_test/radar_aws/pup/Z9371/CR/37'
|
|
1401
|
+
params['rose_cr_name'] = 'Z9371_20210720083000Z_CR_00_37'
|
|
1402
|
+
params['aws_hour_file_path'] = '/mnt/e/metradar_test/radar_aws/awsdata/aws_hourly_obs'
|
|
1403
|
+
params['aws_hour_file_name'] = 'surface_aws_hourly_20210720_0900.csv'
|
|
1404
|
+
params['aws_min_file_path'] = '/mnt/e/metradar_test/radar_aws/awsdata/aws_minutes_obs'
|
|
1405
|
+
params['aws_min_file_name'] = 'surface_aws_minute_20210720_0824_0830.csv'
|
|
1406
|
+
|
|
1407
|
+
params['pic_path'] = '/mnt/e/metradar_test/radar_aws/pic'
|
|
1408
|
+
params['slat'] = 34
|
|
1409
|
+
params['nlat'] = 35
|
|
1410
|
+
params['wlon'] = 113
|
|
1411
|
+
params['elon'] = 114
|
|
1412
|
+
params['timestr'] = params['radarfile_name'].split('_')[4]
|
|
1413
|
+
params['fontfile'] = '/home/wjzhu/OneDrive/PythonCode/MyWork/metradar/resources/fonts/YaHeiConsolasHybrid_1.12.ttf'
|
|
1414
|
+
params['gis_lats'] = lat
|
|
1415
|
+
params['gis_lons'] = lon
|
|
1416
|
+
params['gis_name'] = stanames
|
|
1417
|
+
params['breplace'] = True
|
|
1418
|
+
params['bdraw_crs'] = False
|
|
1419
|
+
params['ref_colorfile'] = '/home/wjzhu/OneDrive/PythonCode/MyWork/metradar/resources/gr2_colors/default_BR_PUP2.pal'
|
|
1420
|
+
params['vel_colorfile'] = '/home/wjzhu/OneDrive/PythonCode/MyWork/metradar/resources/gr2_colors/default_BV_PUP2.pal'
|
|
1421
|
+
params['figsize_width'] = 4
|
|
1422
|
+
params['fontsize_gis'] = 5
|
|
1423
|
+
params['fontsize_colorbar'] = 5
|
|
1424
|
+
params['fontsize_title'] = 6
|
|
1425
|
+
params['mapcolor'] = [0/255,0/255,0/255]
|
|
1426
|
+
params['dpi'] = 300
|
|
1427
|
+
params['pic_format'] = 'png'
|
|
1428
|
+
params['bdraw_title_ppi'] = False
|
|
1429
|
+
|
|
1430
|
+
|
|
1431
|
+
# 创建绘图函数
|
|
1432
|
+
_draw_radar_other = DRAW_RADAR_OTHER(params)
|
|
1433
|
+
|
|
1434
|
+
# _draw_radar_other.read_vol_data()
|
|
1435
|
+
|
|
1436
|
+
# _draw_radar_other.draw_ref_alone(subdir='ref',tilt=0,thred=-5)
|
|
1437
|
+
|
|
1438
|
+
# _draw_radar_other.draw_vel_alone(subdir='vel',tilt=1)
|
|
1439
|
+
|
|
1440
|
+
# _draw_radar_other.draw_ref_pre(subdir='ref_pre',)
|
|
1441
|
+
|
|
1442
|
+
# _draw_radar_other.draw_ref_wind_barb_vortex(subdir='ref_pre_wind_vortex',)
|
|
1443
|
+
|
|
1444
|
+
# _draw_radar_other.get_cref_from_radar(xlimits=[-80,50],ylimits=[-80,50])
|
|
1445
|
+
# _draw_radar_other.draw_cref_wind_barb(subdir='cref_wind_barb',)
|
|
1446
|
+
# _draw_radar_other.draw_cref_pre(subdir='cref_pre',)
|
|
1447
|
+
|
|
1448
|
+
_draw_radar_other.get_cref_from_rose()
|
|
1449
|
+
# _draw_radar_other.draw_cref_wind_barb(subdir='cref_wind_barb',)
|
|
1450
|
+
_draw_radar_other.draw_cref_pre(subdir='cref_pre',)
|