shancx 1.9.33.216__tar.gz → 1.9.33.220__tar.gz
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.
- {shancx-1.9.33.216 → shancx-1.9.33.220}/PKG-INFO +1 -1
- {shancx-1.9.33.216 → shancx-1.9.33.220}/setup.py +1 -1
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Plot/plotGlobal.py +134 -53
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Read.py +1 -15
- shancx-1.9.33.220/shancx/npz.py +15 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx.egg-info/PKG-INFO +1 -1
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx.egg-info/SOURCES.txt +1 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/README.md +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/setup.cfg +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/3D/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/Class.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/CudaPrefetcher1.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/Fake_image.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/Hsml.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/L2Loss.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/MetricTracker.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/Normalize.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/OptimizerWScheduler.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/Rmageresize.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/Savemodel.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/SmoothL1_losses.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/Tqdm.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/checknan.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/dsalgor.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/iouJU.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/mask.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/psnr.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/ssim.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/structural_similarity.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Algo/tool.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Calmetrics/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Calmetrics/calmetrics.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Calmetrics/calmetricsmatrixLib.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Calmetrics/rmseR2score.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Clip/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Cmd.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Config_.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Df/DataFrame.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Df/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Df/tool.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Diffm/Psamples.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Diffm/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Diffm/test.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Doc/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/E/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Fillmiss/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Fillmiss/imgidwJU.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Fillmiss/imgidwLatLonJU.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Gpu/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/H9/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/H9/ahi_read_hsd.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/H9/ahisearchtable.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/H9/geometry.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Hug/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Inst.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Lib.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Mos/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/NN/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Path1.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Plot/GlobMap.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Plot/Gray2RGB.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Plot/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Plot/draw_day_CR_PNG.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Plot/exam.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Plot/radarNmc.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Plot/single_china_map.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Point.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/QC.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/RdPzl/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Resize.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/SN/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Time/GetTime.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Time/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Time/timeCycle.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Time/tool.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Train/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Train/makelist.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Train/multiGpu.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Train/prepare.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/Train/renet50.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/ZR.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/args.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/bak.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/cmp.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/df2database.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/geosProj.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/getResponse.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/info.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/netdfJU.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/sendM.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/tensBoard/__init__.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx/wait.py +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx.egg-info/dependency_links.txt +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx.egg-info/requires.txt +0 -0
- {shancx-1.9.33.216 → shancx-1.9.33.220}/shancx.egg-info/top_level.txt +0 -0
|
@@ -11,7 +11,7 @@ import cartopy.feature as cfeature
|
|
|
11
11
|
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
|
|
12
12
|
from hjnwtx.colormap import cmp_hjnwtx
|
|
13
13
|
import os
|
|
14
|
-
def plotGlobal(b, latArr1, lonArr1, cmap='summer', title='Global QPF Data Visualization',saveDir = "./plotGlobal",ty=None ):
|
|
14
|
+
def plotGlobal(b, latArr1, lonArr1, cmap='summer', title='Global QPF Data Visualization',saveDir = "./plotGlobal",ty=None,name="plotGlobal" ):
|
|
15
15
|
now_str = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
|
16
16
|
plt.figure(figsize=(20, 10), dpi=100)
|
|
17
17
|
ax = plt.axes(projection=ccrs.PlateCarree())
|
|
@@ -28,14 +28,29 @@ def plotGlobal(b, latArr1, lonArr1, cmap='summer', title='Global QPF Data Visual
|
|
|
28
28
|
"pre": cmp_hjnwtx["pre_tqw"],
|
|
29
29
|
None: 'summer'
|
|
30
30
|
}.get(ty)
|
|
31
|
+
|
|
32
|
+
minmax = {
|
|
33
|
+
"radar": [0,80],
|
|
34
|
+
"pre": [0,20],
|
|
35
|
+
None: [np.nanmin(b),np.nanmax(b)]
|
|
36
|
+
}.get(ty)
|
|
37
|
+
|
|
38
|
+
setlabel = {
|
|
39
|
+
"radar": 'Composite Reflectivity (Radar)\nUnit: (dBZ)',
|
|
40
|
+
"pre": 'Precipitation\nUnit: (mm)',
|
|
41
|
+
None: 'Data'
|
|
42
|
+
}.get(ty)
|
|
43
|
+
|
|
31
44
|
img = ax.pcolormesh(lon_grid[::stride, ::stride],
|
|
32
45
|
lat_grid[::stride, ::stride],
|
|
33
46
|
b[::stride, ::stride],
|
|
34
47
|
cmap=cmap,
|
|
35
48
|
shading='auto',
|
|
49
|
+
vmin=minmax[0],
|
|
50
|
+
vmax=minmax[1],
|
|
36
51
|
transform=ccrs.PlateCarree())
|
|
37
52
|
cbar = plt.colorbar(img, ax=ax, orientation='vertical', pad=0.05, shrink=0.6)
|
|
38
|
-
cbar.set_label(
|
|
53
|
+
cbar.set_label(setlabel, fontsize=12)
|
|
39
54
|
ax.set_xticks(np.arange(-180, 181, 30), crs=ccrs.PlateCarree())
|
|
40
55
|
ax.set_yticks(np.arange(-90, 91, 15), crs=ccrs.PlateCarree())
|
|
41
56
|
ax.xaxis.set_major_formatter(LongitudeFormatter(zero_direction_label=True))
|
|
@@ -45,15 +60,108 @@ def plotGlobal(b, latArr1, lonArr1, cmap='summer', title='Global QPF Data Visual
|
|
|
45
60
|
ax.set_global()
|
|
46
61
|
plt.tight_layout()
|
|
47
62
|
os.makedirs(saveDir, exist_ok=True)
|
|
48
|
-
plt.savefig(f"./{saveDir}/
|
|
63
|
+
plt.savefig(f"./{saveDir}/plotGlobal_glob{now_str}_{name}.png", dpi=300, bbox_inches="tight")
|
|
49
64
|
plt.close()
|
|
50
65
|
|
|
51
66
|
"""
|
|
52
67
|
plotGlobal(b, latArr1, lonArr1,
|
|
53
68
|
title='Global Meteorological Data',ty="radar")
|
|
54
|
-
|
|
55
69
|
"""
|
|
56
70
|
|
|
71
|
+
import ssl
|
|
72
|
+
import urllib.request
|
|
73
|
+
ssl._create_default_https_context = ssl._create_unverified_context
|
|
74
|
+
import datetime
|
|
75
|
+
import numpy as np
|
|
76
|
+
import matplotlib.pyplot as plt
|
|
77
|
+
import cartopy.crs as ccrs
|
|
78
|
+
import cartopy.feature as cfeature
|
|
79
|
+
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
|
|
80
|
+
from hjnwtx.colormap import cmp_hjnwtx
|
|
81
|
+
import os
|
|
82
|
+
def plotGlobalTtf(b, latArr1, lonArr1, cmap='summer', title='Global QPF Data Visualization', saveDir="./plotGlobal", ty=None, name=1,font_path=None):
|
|
83
|
+
now_str = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
|
84
|
+
import matplotlib.pyplot as plt
|
|
85
|
+
import matplotlib
|
|
86
|
+
import matplotlib.font_manager as fm
|
|
87
|
+
font_path = "/mnt/wtx_weather_forecast/scx/sever7/微软雅黑.ttf" if font_path is None else font_path
|
|
88
|
+
font_kwargs = {}
|
|
89
|
+
if os.path.exists(font_path):
|
|
90
|
+
try:
|
|
91
|
+
fm.fontManager.addfont(font_path)
|
|
92
|
+
font_prop = fm.FontProperties(fname=font_path)
|
|
93
|
+
font_name = font_prop.get_name()
|
|
94
|
+
plt.rcParams['font.family'] = 'sans-serif'
|
|
95
|
+
plt.rcParams['font.sans-serif'] = [font_name]
|
|
96
|
+
plt.rcParams['axes.unicode_minus'] = False
|
|
97
|
+
font_kwargs = {'fontproperties': font_prop}
|
|
98
|
+
print(f"成功加载字体: {font_name}")
|
|
99
|
+
except Exception as e:
|
|
100
|
+
print(f"加载指定字体失败: {e}")
|
|
101
|
+
# 尝试使用系统字体
|
|
102
|
+
try:
|
|
103
|
+
plt.rcParams['font.sans-serif'] = ['SimHei', 'Microsoft YaHei', 'DejaVu Sans']
|
|
104
|
+
plt.rcParams['axes.unicode_minus'] = False
|
|
105
|
+
except:
|
|
106
|
+
pass
|
|
107
|
+
else:
|
|
108
|
+
print(f"警告: 字体文件不存在: {font_path}")
|
|
109
|
+
try:
|
|
110
|
+
plt.rcParams['font.sans-serif'] = ['SimHei', 'Microsoft YaHei', 'DejaVu Sans']
|
|
111
|
+
plt.rcParams['axes.unicode_minus'] = False
|
|
112
|
+
except:
|
|
113
|
+
pass
|
|
114
|
+
plt.figure(figsize=(20, 10), dpi=100)
|
|
115
|
+
ax = plt.axes(projection=ccrs.PlateCarree())
|
|
116
|
+
ax.add_feature(cfeature.LAND, facecolor='none') # 陆地无色
|
|
117
|
+
ax.add_feature(cfeature.OCEAN, facecolor='none') # 海洋无色
|
|
118
|
+
ax.add_feature(cfeature.COASTLINE, linewidth=0.8, edgecolor='black') # 海岸线黑色
|
|
119
|
+
ax.add_feature(cfeature.BORDERS, linestyle='-', linewidth=0.5, edgecolor='black') # 国界线黑色
|
|
120
|
+
ax.add_feature(cfeature.LAKES, alpha=0.3, facecolor='none', edgecolor='gray') # 湖泊无色,灰色边界
|
|
121
|
+
ax.add_feature(cfeature.RIVERS, edgecolor='gray', linewidth=0.5) # 河流灰色
|
|
122
|
+
lon_grid, lat_grid = np.meshgrid(lonArr1, latArr1)
|
|
123
|
+
stride = 10 # 每10个点取1个
|
|
124
|
+
cmap = {
|
|
125
|
+
"radar": cmp_hjnwtx["radar_nmc"],
|
|
126
|
+
"pre": cmp_hjnwtx["pre_tqw"],
|
|
127
|
+
None: 'summer'
|
|
128
|
+
}.get(ty)
|
|
129
|
+
minmax = {
|
|
130
|
+
"radar": [0,80],
|
|
131
|
+
"pre": [0,20],
|
|
132
|
+
None: [np.nanmin(b),np.nanmax(b)]
|
|
133
|
+
}.get(ty)
|
|
134
|
+
|
|
135
|
+
setlabel = {
|
|
136
|
+
"radar": '雷达组合反射率\n单位:(dbz)',
|
|
137
|
+
"pre": '降雨量\n单位:(mm)',
|
|
138
|
+
None: '数据'
|
|
139
|
+
}.get(ty)
|
|
140
|
+
img = ax.pcolormesh(lon_grid[::stride, ::stride],
|
|
141
|
+
lat_grid[::stride, ::stride],
|
|
142
|
+
b[::stride, ::stride],
|
|
143
|
+
cmap=cmap,
|
|
144
|
+
shading='auto',
|
|
145
|
+
transform=ccrs.PlateCarree(), vmin=minmax[0], vmax=minmax[1])
|
|
146
|
+
cbar = plt.colorbar(img, ax=ax, orientation='vertical', pad=0.05, shrink=0.6)
|
|
147
|
+
if font_kwargs:
|
|
148
|
+
cbar.set_label(setlabel, fontsize=12, **font_kwargs)
|
|
149
|
+
ax.set_xticks(np.arange(-180, 181, 30), crs=ccrs.PlateCarree())
|
|
150
|
+
ax.set_yticks(np.arange(-90, 91, 15), crs=ccrs.PlateCarree())
|
|
151
|
+
ax.xaxis.set_major_formatter(LongitudeFormatter(zero_direction_label=True))
|
|
152
|
+
ax.yaxis.set_major_formatter(LatitudeFormatter())
|
|
153
|
+
ax.gridlines(color='gray', linestyle=':', alpha=0.5)
|
|
154
|
+
ax.set_title(title, fontsize=16, pad=20)
|
|
155
|
+
ax.set_global()
|
|
156
|
+
plt.tight_layout()
|
|
157
|
+
os.makedirs(saveDir, exist_ok=True)
|
|
158
|
+
plt.savefig(f"./{saveDir}/plotScatter_glob{now_str}_{ty}_{name}.png", dpi=300, bbox_inches="tight")
|
|
159
|
+
plt.close()
|
|
160
|
+
|
|
161
|
+
'''
|
|
162
|
+
plotGlobal(satH9[0], latArrsatH9, lonArrsatH9, title=f'全球气象雷达组合反射率分布图',saveDir="./plotGlobal", ty="radar",name = "")
|
|
163
|
+
'''
|
|
164
|
+
|
|
57
165
|
import datetime
|
|
58
166
|
import numpy as np
|
|
59
167
|
import matplotlib.pyplot as plt
|
|
@@ -89,16 +197,31 @@ def plotGlobalPlus(b, latArr1, lonArr1, cmap='summer', title='Global QPF Data Vi
|
|
|
89
197
|
cmap = {
|
|
90
198
|
"radar": cmp_hjnwtx["radar_nmc"],
|
|
91
199
|
"pre": cmp_hjnwtx["pre_tqw"],
|
|
92
|
-
None:
|
|
93
|
-
}.get(ty
|
|
200
|
+
None: 'summer'
|
|
201
|
+
}.get(ty)
|
|
202
|
+
|
|
203
|
+
minmax = {
|
|
204
|
+
"radar": [0,80],
|
|
205
|
+
"pre": [0,20],
|
|
206
|
+
None: [np.nanmin(b),np.nanmax(b)]
|
|
207
|
+
}.get(ty)
|
|
208
|
+
|
|
209
|
+
setlabel = {
|
|
210
|
+
"radar": 'Composite Reflectivity (Radar)\nUnit: (dBZ)',
|
|
211
|
+
"pre": 'Precipitation\nUnit: (mm)',
|
|
212
|
+
None: 'Data'
|
|
213
|
+
}.get(ty)
|
|
214
|
+
|
|
94
215
|
img = ax.pcolormesh(lon_grid[::stride, ::stride],
|
|
95
216
|
lat_grid[::stride, ::stride],
|
|
96
217
|
b[::stride, ::stride],
|
|
97
218
|
cmap=cmap,
|
|
98
219
|
shading='auto',
|
|
220
|
+
vmin = minmax[0],
|
|
221
|
+
vmax = minmax[1],
|
|
99
222
|
transform=ccrs.PlateCarree())
|
|
100
223
|
cbar = plt.colorbar(img, ax=ax, orientation='vertical', pad=0.05, shrink=0.6)
|
|
101
|
-
cbar.set_label(
|
|
224
|
+
cbar.set_label(setlabel , fontsize=12)
|
|
102
225
|
ax.set_xticks(np.arange(-180, 181, 30), crs=ccrs.PlateCarree())
|
|
103
226
|
ax.set_yticks(np.arange(-90, 91, 15), crs=ccrs.PlateCarree())
|
|
104
227
|
ax.xaxis.set_major_formatter(LongitudeFormatter(zero_direction_label=True))
|
|
@@ -113,6 +236,7 @@ def plotGlobalPlus(b, latArr1, lonArr1, cmap='summer', title='Global QPF Data Vi
|
|
|
113
236
|
plt.close()
|
|
114
237
|
print(f"图像已保存到: {save_path}")
|
|
115
238
|
return save_path
|
|
239
|
+
|
|
116
240
|
"""
|
|
117
241
|
if __name__ == "__main__":
|
|
118
242
|
plotGlobal(
|
|
@@ -126,6 +250,7 @@ if __name__ == "__main__":
|
|
|
126
250
|
)
|
|
127
251
|
"""
|
|
128
252
|
|
|
253
|
+
|
|
129
254
|
import ssl
|
|
130
255
|
import urllib.request
|
|
131
256
|
ssl._create_default_https_context = ssl._create_unverified_context
|
|
@@ -240,10 +365,10 @@ def plotBorder(UTCstr, nclon, nclat, cr, fig_title,savepath="./plotBorder", data
|
|
|
240
365
|
cb.set_ticklabels([str(level) for level in clevels[:-1]], fontproperties=myfont)
|
|
241
366
|
for label in ax.get_xticklabels() + ax.get_yticklabels():
|
|
242
367
|
label.set_fontproperties(myfont)
|
|
243
|
-
mkDir(figpath)
|
|
244
368
|
plt.savefig(figpath, dpi=300, bbox_inches='tight')
|
|
245
369
|
print(f"{fig_title.split('_')[0]}绘制完成: {figpath}")
|
|
246
370
|
plt.close()
|
|
371
|
+
|
|
247
372
|
"""
|
|
248
373
|
latArr = np.linspace(27, -13, 2000 )
|
|
249
374
|
lonArr = np.linspace(70, 150, 4000)
|
|
@@ -322,48 +447,4 @@ fig_title = f"卫星反演雷达回波_{UTCstr}"
|
|
|
322
447
|
# base[20:1070,75:1625] = satCR
|
|
323
448
|
plot_fig(data,result['lats'],result['lons'],fig_title,datatype="radar")
|
|
324
449
|
"""
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
import numpy as np
|
|
328
|
-
import matplotlib.pyplot as plt
|
|
329
|
-
import cartopy.crs as ccrs
|
|
330
|
-
import cartopy.feature as cfeature
|
|
331
|
-
from mpl_toolkits.axes_grid1 import make_axes_locatable
|
|
332
|
-
import datetime
|
|
333
|
-
from shancx import crDir
|
|
334
|
-
def plotBorder(matrix,name='plotBorder',saveDir="plotBorder",extent=None,title='Matrix Plot', xlabel='X-axis', ylabel='Y-axis', color_label='Value', cmap='viridis'):
|
|
335
|
-
if extent is None:
|
|
336
|
-
lat_min, lat_max = -3, 13
|
|
337
|
-
lon_min, lon_max = -0, 28
|
|
338
|
-
else:
|
|
339
|
-
lat_min, lat_max, lon_min, lon_max = extent
|
|
340
|
-
now_str = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
|
341
|
-
fig = plt.figure(figsize=(12, 8))
|
|
342
|
-
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
|
|
343
|
-
ax.set_extent([lon_min, lon_max, lat_min, lat_max], crs=ccrs.PlateCarree())
|
|
344
|
-
im = ax.imshow(
|
|
345
|
-
matrix,
|
|
346
|
-
extent=[lon_min, lon_max, lat_min, lat_max],
|
|
347
|
-
origin='upper',
|
|
348
|
-
cmap='viridis',
|
|
349
|
-
transform=ccrs.PlateCarree()
|
|
350
|
-
)
|
|
351
|
-
ax.add_feature(cfeature.COASTLINE, linewidth=0.5)
|
|
352
|
-
ax.add_feature(cfeature.BORDERS, linestyle=':', linewidth=0.5)
|
|
353
|
-
states = cfeature.NaturalEarthFeature(
|
|
354
|
-
category='cultural',
|
|
355
|
-
name='admin_1_states_provinces_lines',
|
|
356
|
-
scale='50m',
|
|
357
|
-
facecolor='none'
|
|
358
|
-
)
|
|
359
|
-
ax.add_feature(states, edgecolor='red', linewidth=0.5)
|
|
360
|
-
divider = make_axes_locatable(ax)
|
|
361
|
-
cax = divider.append_axes("right", size="5%", pad=0.1, axes_class=plt.Axes)
|
|
362
|
-
cbar = plt.colorbar(im, cax=cax, label='Data Values')
|
|
363
|
-
ax.set_title('Sat data Boundaries', fontsize=14)
|
|
364
|
-
plt.tight_layout()
|
|
365
|
-
outpath = f'./{saveDir}/{name}_{now_str}.png' if name=="plotBorder" else f"./{saveDir}/{name}.png"
|
|
366
|
-
crDir(outpath)
|
|
367
|
-
plt.savefig(outpath)
|
|
368
|
-
plt.close()
|
|
369
|
-
|
|
450
|
+
|
|
@@ -55,18 +55,4 @@ if __name__ == "__main__":
|
|
|
55
55
|
lonArr = lonMat[0]
|
|
56
56
|
"""
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
from pathlib import Path
|
|
60
|
-
def npsavez(output, data):
|
|
61
|
-
output = output.replace('.npy', '.npz')
|
|
62
|
-
output_path = Path(output).with_suffix('.npz')
|
|
63
|
-
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
64
|
-
np.savez_compressed(output_path, data=data)
|
|
65
|
-
print(f"{output_path} done")
|
|
66
|
-
def nploadz(output_path):
|
|
67
|
-
return np.load(Path(output_path).with_suffix('.npz'))['data']
|
|
68
|
-
|
|
69
|
-
"""
|
|
70
|
-
savez(output, data)
|
|
71
|
-
nploadz(output_path)
|
|
72
|
-
"""
|
|
58
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
def npzSave(output, data):
|
|
4
|
+
output = output.replace('.npy', '.npz')
|
|
5
|
+
output_path = Path(output).with_suffix('.npz')
|
|
6
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
7
|
+
np.savez_compressed(output_path, data=data)
|
|
8
|
+
print(f"{output_path} done")
|
|
9
|
+
def npzLoad(output_path):
|
|
10
|
+
return np.load(Path(output_path).with_suffix('.npz'))['data']
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
npzSave(output, data)
|
|
14
|
+
npzLoad(output_path)
|
|
15
|
+
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|