shancx 1.8.92__py3-none-any.whl → 1.9.33.218__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.
- shancx/3D/__init__.py +25 -0
- shancx/Algo/Class.py +11 -0
- shancx/Algo/CudaPrefetcher1.py +112 -0
- shancx/Algo/Fake_image.py +24 -0
- shancx/Algo/Hsml.py +391 -0
- shancx/Algo/L2Loss.py +10 -0
- shancx/Algo/MetricTracker.py +132 -0
- shancx/Algo/Normalize.py +66 -0
- shancx/Algo/OptimizerWScheduler.py +38 -0
- shancx/Algo/Rmageresize.py +79 -0
- shancx/Algo/Savemodel.py +33 -0
- shancx/Algo/SmoothL1_losses.py +27 -0
- shancx/Algo/Tqdm.py +62 -0
- shancx/Algo/__init__.py +121 -0
- shancx/Algo/checknan.py +28 -0
- shancx/Algo/iouJU.py +83 -0
- shancx/Algo/mask.py +25 -0
- shancx/Algo/psnr.py +9 -0
- shancx/Algo/ssim.py +70 -0
- shancx/Algo/structural_similarity.py +308 -0
- shancx/Algo/tool.py +704 -0
- shancx/Calmetrics/__init__.py +97 -0
- shancx/Calmetrics/calmetrics.py +14 -0
- shancx/Calmetrics/calmetricsmatrixLib.py +147 -0
- shancx/Calmetrics/rmseR2score.py +35 -0
- shancx/Clip/__init__.py +50 -0
- shancx/Cmd.py +126 -0
- shancx/Config_.py +26 -0
- shancx/Df/DataFrame.py +11 -2
- shancx/Df/__init__.py +17 -0
- shancx/Df/tool.py +0 -0
- shancx/Diffm/Psamples.py +18 -0
- shancx/Diffm/__init__.py +0 -0
- shancx/Diffm/test.py +207 -0
- shancx/Doc/__init__.py +214 -0
- shancx/E/__init__.py +178 -152
- shancx/Fillmiss/__init__.py +0 -0
- shancx/Fillmiss/imgidwJU.py +46 -0
- shancx/Fillmiss/imgidwLatLonJU.py +82 -0
- shancx/Gpu/__init__.py +55 -0
- shancx/H9/__init__.py +126 -0
- shancx/H9/ahi_read_hsd.py +877 -0
- shancx/H9/ahisearchtable.py +298 -0
- shancx/H9/geometry.py +2439 -0
- shancx/Hug/__init__.py +81 -0
- shancx/Inst.py +22 -0
- shancx/Lib.py +31 -0
- shancx/Mos/__init__.py +37 -0
- shancx/NN/__init__.py +235 -106
- shancx/Path1.py +161 -0
- shancx/Plot/GlobMap.py +276 -116
- shancx/Plot/__init__.py +491 -1
- shancx/Plot/draw_day_CR_PNG.py +4 -21
- shancx/Plot/exam.py +116 -0
- shancx/Plot/plotGlobal.py +325 -0
- shancx/{radar_nmc.py → Plot/radarNmc.py} +4 -34
- shancx/{subplots_single_china_map.py → Plot/single_china_map.py} +1 -1
- shancx/Point.py +46 -0
- shancx/QC.py +223 -0
- shancx/RdPzl/__init__.py +32 -0
- shancx/Read.py +72 -0
- shancx/Resize.py +79 -0
- shancx/SN/__init__.py +62 -123
- shancx/Time/GetTime.py +9 -3
- shancx/Time/__init__.py +66 -1
- shancx/Time/timeCycle.py +302 -0
- shancx/Time/tool.py +0 -0
- shancx/Train/__init__.py +74 -0
- shancx/Train/makelist.py +187 -0
- shancx/Train/multiGpu.py +27 -0
- shancx/Train/prepare.py +161 -0
- shancx/Train/renet50.py +157 -0
- shancx/ZR.py +12 -0
- shancx/__init__.py +333 -262
- shancx/args.py +27 -0
- shancx/bak.py +768 -0
- shancx/df2database.py +62 -2
- shancx/geosProj.py +80 -0
- shancx/info.py +38 -0
- shancx/netdfJU.py +231 -0
- shancx/sendM.py +59 -0
- shancx/tensBoard/__init__.py +28 -0
- shancx/wait.py +246 -0
- {shancx-1.8.92.dist-info → shancx-1.9.33.218.dist-info}/METADATA +15 -5
- shancx-1.9.33.218.dist-info/RECORD +91 -0
- {shancx-1.8.92.dist-info → shancx-1.9.33.218.dist-info}/WHEEL +1 -1
- my_timer_decorator/__init__.py +0 -10
- shancx/Dsalgor/__init__.py +0 -19
- shancx/E/DFGRRIB.py +0 -30
- shancx/EN/DFGRRIB.py +0 -30
- shancx/EN/__init__.py +0 -148
- shancx/FileRead.py +0 -44
- shancx/Gray2RGB.py +0 -86
- shancx/M/__init__.py +0 -137
- shancx/MN/__init__.py +0 -133
- shancx/N/__init__.py +0 -131
- shancx/Plot/draw_day_CR_PNGUS.py +0 -206
- shancx/Plot/draw_day_CR_SVG.py +0 -275
- shancx/Plot/draw_day_pre_PNGUS.py +0 -205
- shancx/Plot/glob_nation_map.py +0 -116
- shancx/Plot/radar_nmc.py +0 -61
- shancx/Plot/radar_nmc_china_map_compare1.py +0 -50
- shancx/Plot/radar_nmc_china_map_f.py +0 -121
- shancx/Plot/radar_nmc_us_map_f.py +0 -128
- shancx/Plot/subplots_compare_devlop.py +0 -36
- shancx/Plot/subplots_single_china_map.py +0 -45
- shancx/S/__init__.py +0 -138
- shancx/W/__init__.py +0 -132
- shancx/WN/__init__.py +0 -132
- shancx/code.py +0 -331
- shancx/draw_day_CR_PNG.py +0 -200
- shancx/draw_day_CR_PNGUS.py +0 -206
- shancx/draw_day_CR_SVG.py +0 -275
- shancx/draw_day_pre_PNGUS.py +0 -205
- shancx/makenetCDFN.py +0 -42
- shancx/mkIMGSCX.py +0 -92
- shancx/netCDF.py +0 -130
- shancx/radar_nmc_china_map_compare1.py +0 -50
- shancx/radar_nmc_china_map_f.py +0 -125
- shancx/radar_nmc_us_map_f.py +0 -67
- shancx/subplots_compare_devlop.py +0 -36
- shancx/tool.py +0 -18
- shancx/user/H8mess.py +0 -317
- shancx/user/__init__.py +0 -137
- shancx/user/cinradHJN.py +0 -496
- shancx/user/examMeso.py +0 -293
- shancx/user/hjnDAAS.py +0 -26
- shancx/user/hjnFTP.py +0 -81
- shancx/user/hjnGIS.py +0 -320
- shancx/user/hjnGPU.py +0 -21
- shancx/user/hjnIDW.py +0 -68
- shancx/user/hjnKDTree.py +0 -75
- shancx/user/hjnLAPSTransform.py +0 -47
- shancx/user/hjnMiscellaneous.py +0 -182
- shancx/user/hjnProj.py +0 -162
- shancx/user/inotify.py +0 -41
- shancx/user/matplotlibMess.py +0 -87
- shancx/user/mkNCHJN.py +0 -623
- shancx/user/newTypeRadar.py +0 -492
- shancx/user/test.py +0 -6
- shancx/user/tlogP.py +0 -129
- shancx/util_log.py +0 -33
- shancx/wtx/H8mess.py +0 -315
- shancx/wtx/__init__.py +0 -151
- shancx/wtx/cinradHJN.py +0 -496
- shancx/wtx/colormap.py +0 -64
- shancx/wtx/examMeso.py +0 -298
- shancx/wtx/hjnDAAS.py +0 -26
- shancx/wtx/hjnFTP.py +0 -81
- shancx/wtx/hjnGIS.py +0 -330
- shancx/wtx/hjnGPU.py +0 -21
- shancx/wtx/hjnIDW.py +0 -68
- shancx/wtx/hjnKDTree.py +0 -75
- shancx/wtx/hjnLAPSTransform.py +0 -47
- shancx/wtx/hjnLog.py +0 -78
- shancx/wtx/hjnMiscellaneous.py +0 -201
- shancx/wtx/hjnProj.py +0 -161
- shancx/wtx/inotify.py +0 -41
- shancx/wtx/matplotlibMess.py +0 -87
- shancx/wtx/mkNCHJN.py +0 -613
- shancx/wtx/newTypeRadar.py +0 -492
- shancx/wtx/test.py +0 -6
- shancx/wtx/tlogP.py +0 -129
- shancx-1.8.92.dist-info/RECORD +0 -99
- /shancx/{Dsalgor → Algo}/dsalgor.py +0 -0
- {shancx-1.8.92.dist-info → shancx-1.9.33.218.dist-info}/top_level.txt +0 -0
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import matplotlib.pyplot as plt
|
|
2
|
-
import numpy as np
|
|
3
|
-
import datetime
|
|
4
|
-
from hjnwtx.colormap import cmp_hjnwtx # 假设这是您的自定义颜色映射库
|
|
5
|
-
import cartopy.crs as ccrs
|
|
6
|
-
import cartopy.feature as cfeature
|
|
7
|
-
import cartopy.io.shapereader as shpreader
|
|
8
|
-
from shancx import crDir
|
|
9
|
-
def drawpic_com(array_dt,array_dt1,name="temp"):
|
|
10
|
-
now_str = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
|
11
|
-
outpath = f"./radar_nmc/{name}_{now_str}.png"
|
|
12
|
-
crDir(outpath)
|
|
13
|
-
|
|
14
|
-
# 创建绘图和设置坐标系
|
|
15
|
-
fig = plt.figure(figsize=(10, 8))
|
|
16
|
-
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
|
|
17
|
-
|
|
18
|
-
# 设置图像显示的范围
|
|
19
|
-
ax.set_extent([73, 135, 18, 54], ccrs.PlateCarree()) # 根据需要调整
|
|
20
|
-
|
|
21
|
-
# 添加中国地图的边界和特征,包括省份轮廓
|
|
22
|
-
add_china_map(ax)
|
|
23
|
-
|
|
24
|
-
# 添加数据层
|
|
25
|
-
if len(array_dt.shape) == 3:
|
|
26
|
-
for i, img_ch_nel in enumerate(array_dt):
|
|
27
|
-
ax.imshow(img_ch_nel, vmin=50, vmax=500, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=[73, 134.99, 12.21, 54.2])
|
|
28
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
29
|
-
plt.savefig(f"{outpath}_layer_{i}.png")
|
|
30
|
-
plt.clf() # 清除图形以绘制下一个通道图像
|
|
31
|
-
elif len(array_dt.shape) == 2:
|
|
32
|
-
ax.imshow(array_dt, vmin=0, vmax=100, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=[73, 134.99, 12.21, 54.2], alpha=1)
|
|
33
|
-
ax.imshow(array_dt1, vmin=0, vmax=100, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=[73, 134.99, 12.21, 54.2], alpha=0.3)
|
|
34
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
35
|
-
plt.savefig(outpath)
|
|
36
|
-
plt.close(fig)
|
|
37
|
-
|
|
38
|
-
def add_china_map(ax):
|
|
39
|
-
# 在地图上添加地形特征
|
|
40
|
-
ax.add_feature(cfeature.COASTLINE, edgecolor='gray')
|
|
41
|
-
ax.add_feature(cfeature.BORDERS, linestyle=':', edgecolor='gray')
|
|
42
|
-
ax.add_feature(cfeature.LAKES, alpha=0.8)
|
|
43
|
-
# 添加省份轮廓
|
|
44
|
-
provinces = shpreader.natural_earth(resolution='10m', category='cultural', name='admin_1_states_provinces')
|
|
45
|
-
provinces_features = shpreader.Reader(provinces).geometries()
|
|
46
|
-
ax.add_geometries(provinces_features, ccrs.PlateCarree(), facecolor='none', edgecolor='gray', linestyle=':', linewidth=0.5, alpha=0.8)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
# 示例用法
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import matplotlib.pyplot as plt
|
|
2
|
-
import numpy as np
|
|
3
|
-
import datetime
|
|
4
|
-
from hjnwtx.colormap import cmp_hjnwtx # 假设这是您的自定义颜色映射库
|
|
5
|
-
import cartopy.crs as ccrs
|
|
6
|
-
import cartopy.feature as cfeature
|
|
7
|
-
import cartopy.io.shapereader as shpreader
|
|
8
|
-
import os
|
|
9
|
-
from shancx import crDir
|
|
10
|
-
|
|
11
|
-
def drawCN(array_dt,ty="CR"):
|
|
12
|
-
env = [73, 135, 18, 54] #US [-119, -64, 22, 50]
|
|
13
|
-
now_str = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
|
14
|
-
outpath = f"./radar_nmc/CN_{now_str}.png"
|
|
15
|
-
crDir(outpath)
|
|
16
|
-
|
|
17
|
-
# 创建绘图和设置坐标系
|
|
18
|
-
fig = plt.figure(figsize=(10, 8))
|
|
19
|
-
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
|
|
20
|
-
|
|
21
|
-
# 设置图像显示的范围
|
|
22
|
-
ax.set_extent(env, ccrs.PlateCarree()) # 根据需要调整 [-119, -64, 22, 50]
|
|
23
|
-
|
|
24
|
-
# 添加中国地图的边界和特征,包括省份轮廓
|
|
25
|
-
add_china_map(ax)
|
|
26
|
-
|
|
27
|
-
# 添加数据层
|
|
28
|
-
if len(array_dt.shape) == 3:
|
|
29
|
-
for i, img_ch_nel in enumerate(array_dt):
|
|
30
|
-
ax.imshow(img_ch_nel, vmin=50, vmax=500, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env)
|
|
31
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
32
|
-
plt.savefig(f"{outpath}_layer_{i}.png")
|
|
33
|
-
plt.clf() # 清除图形以绘制下一个通道图像
|
|
34
|
-
elif len(array_dt.shape) == 2 and ty=="pre":
|
|
35
|
-
# ax.imshow(array_dt, vmin=0, vmax=100, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env)
|
|
36
|
-
ax.imshow(array_dt, vmin=0, vmax=10, cmap=cmp_hjnwtx["pre_tqw"], transform=ccrs.PlateCarree(), extent=[-119, -64, 22, 50]) #pre_tqw
|
|
37
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
38
|
-
plt.savefig(outpath)
|
|
39
|
-
else :
|
|
40
|
-
ax.imshow(array_dt, vmin=0, vmax=72, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env)
|
|
41
|
-
# ax.imshow(array_dt, vmin=0, vmax=10, cmap=cmp_hjnwtx["pre_tqw"], transform=ccrs.PlateCarree(), extent=[-119, -64, 22, 50]) #pre_tqw
|
|
42
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
43
|
-
plt.savefig(outpath)
|
|
44
|
-
plt.close(fig)
|
|
45
|
-
|
|
46
|
-
def add_china_map(ax):
|
|
47
|
-
# 在地图上添加地形特征
|
|
48
|
-
ax.add_feature(cfeature.COASTLINE, edgecolor='gray')
|
|
49
|
-
ax.add_feature(cfeature.BORDERS, linestyle=':', edgecolor='gray')
|
|
50
|
-
ax.add_feature(cfeature.LAKES, alpha=0.8)
|
|
51
|
-
# 添加省份轮廓
|
|
52
|
-
if os.path.exists('/home/scx/ne_10m_admin_1_states_provinces.shp'):
|
|
53
|
-
provinces = '/home/scx/ne_10m_admin_1_states_provinces.shp'
|
|
54
|
-
else :
|
|
55
|
-
provinces = shpreader.natural_earth(resolution='10m', category='cultural', name='admin_1_states_provinces') ###自动下载
|
|
56
|
-
provinces_features = shpreader.Reader(provinces).geometries()
|
|
57
|
-
"""
|
|
58
|
-
本地路径读取 #'/home/scx/.local/share/cartopy/shapefiles/natural_earth/cultural/ne_10m_admin_1_states_provinces.shp' #ne_10m_admin_1_states_provinces.shx
|
|
59
|
-
# shapefile_path = '/home/scx/.local/share/cartopy/shapefiles/natural_earth/cultural/admin_1_states_provinces.shp'
|
|
60
|
-
# provinces_features = shpreader.Reader(shapefile_path).geometries()
|
|
61
|
-
"""
|
|
62
|
-
ax.add_geometries(provinces_features, ccrs.PlateCarree(), facecolor='none', edgecolor='gray', linestyle=':', linewidth=0.5, alpha=0.8)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# 示例用法
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def drawCNLonLat(array_dt,Lon,Lat,ty="CR"):
|
|
69
|
-
env = [73, 135, 18, 54] #US [-119, -64, 22, 50]
|
|
70
|
-
now_str = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
|
71
|
-
outpath = f"./radar_nmc/CN_{now_str}.png"
|
|
72
|
-
crDir(outpath)
|
|
73
|
-
|
|
74
|
-
# 创建绘图和设置坐标系
|
|
75
|
-
fig = plt.figure(figsize=(10, 8))
|
|
76
|
-
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
|
|
77
|
-
|
|
78
|
-
# 设置图像显示的范围
|
|
79
|
-
ax.set_extent(env, ccrs.PlateCarree()) # 根据需要调整 [-119, -64, 22, 50]
|
|
80
|
-
|
|
81
|
-
# 添加中国地图的边界和特征,包括省份轮廓
|
|
82
|
-
add_china_map(ax)
|
|
83
|
-
|
|
84
|
-
# 添加数据层
|
|
85
|
-
if len(array_dt.shape) == 3:
|
|
86
|
-
for i, img_ch_nel in enumerate(array_dt):
|
|
87
|
-
ax.imshow(img_ch_nel, vmin=50, vmax=500, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env)
|
|
88
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
89
|
-
plt.savefig(f"{outpath}_layer_{i}.png")
|
|
90
|
-
plt.clf() # 清除图形以绘制下一个通道图像
|
|
91
|
-
elif len(array_dt.shape) == 2 and ty=="pre":
|
|
92
|
-
# ax.imshow(array_dt, vmin=0, vmax=100, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env)
|
|
93
|
-
ax.imshow(array_dt, vmin=0, vmax=10, cmap=cmp_hjnwtx["pre_tqw"], transform=ccrs.PlateCarree(), extent=[-119, -64, 22, 50]) #pre_tqw
|
|
94
|
-
ax.scatter(list(Lon), list(Lat), s=1, c='red', marker='o', transform=ccrs.PlateCarree())
|
|
95
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
96
|
-
plt.savefig(outpath)
|
|
97
|
-
else :
|
|
98
|
-
ax.imshow(array_dt, vmin=0, vmax=72, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env)
|
|
99
|
-
ax.scatter(list(Lon), list(Lat), s=1, c='red', marker='o', transform=ccrs.PlateCarree())
|
|
100
|
-
# ax.imshow(array_dt, vmin=0, vmax=10, cmap=cmp_hjnwtx["pre_tqw"], transform=ccrs.PlateCarree(), extent=[-119, -64, 22, 50]) #pre_tqw
|
|
101
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
102
|
-
plt.savefig(outpath)
|
|
103
|
-
plt.close(fig)
|
|
104
|
-
|
|
105
|
-
def add_china_map(ax):
|
|
106
|
-
# 在地图上添加地形特征
|
|
107
|
-
ax.add_feature(cfeature.COASTLINE, edgecolor='gray')
|
|
108
|
-
ax.add_feature(cfeature.BORDERS, linestyle=':', edgecolor='gray')
|
|
109
|
-
ax.add_feature(cfeature.LAKES, alpha=0.8)
|
|
110
|
-
# 添加省份轮廓
|
|
111
|
-
if os.path.exists('/home/scx/ne_10m_admin_1_states_provinces.shp'):
|
|
112
|
-
provinces = '/home/scx/ne_10m_admin_1_states_provinces.shp'
|
|
113
|
-
else :
|
|
114
|
-
provinces = shpreader.natural_earth(resolution='10m', category='cultural', name='admin_1_states_provinces') ###自动下载
|
|
115
|
-
provinces_features = shpreader.Reader(provinces).geometries()
|
|
116
|
-
"""
|
|
117
|
-
本地路径读取 #'/home/scx/.local/share/cartopy/shapefiles/natural_earth/cultural/ne_10m_admin_1_states_provinces.shp' #ne_10m_admin_1_states_provinces.shx
|
|
118
|
-
# shapefile_path = '/home/scx/.local/share/cartopy/shapefiles/natural_earth/cultural/admin_1_states_provinces.shp'
|
|
119
|
-
# provinces_features = shpreader.Reader(shapefile_path).geometries()
|
|
120
|
-
"""
|
|
121
|
-
ax.add_geometries(provinces_features, ccrs.PlateCarree(), facecolor='none', edgecolor='gray', linestyle=':', linewidth=0.5, alpha=0.8)
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import matplotlib.pyplot as plt
|
|
2
|
-
import numpy as np
|
|
3
|
-
import datetime
|
|
4
|
-
from hjnwtx.colormap import cmp_hjnwtx # Assuming this is your custom colormap library
|
|
5
|
-
import cartopy.crs as ccrs
|
|
6
|
-
import cartopy.feature as cfeature
|
|
7
|
-
import cartopy.io.shapereader as shpreader
|
|
8
|
-
import os
|
|
9
|
-
from shancx import crDir
|
|
10
|
-
|
|
11
|
-
def drawUS(array_dt,ty="CR"):
|
|
12
|
-
# env = [-119, -64, 22, 50]
|
|
13
|
-
env = [-132.0, -47.0, 0, 57.0]
|
|
14
|
-
now_str = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
|
15
|
-
outpath = f"./radar_nmc/US_{now_str}.png"
|
|
16
|
-
crDir(outpath)
|
|
17
|
-
|
|
18
|
-
# Create figure and set the coordinate system
|
|
19
|
-
fig = plt.figure(figsize=(10, 8))
|
|
20
|
-
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
|
|
21
|
-
|
|
22
|
-
# Set the extent for the United States
|
|
23
|
-
ax.set_extent(env, ccrs.PlateCarree()) # Adjust as needed
|
|
24
|
-
|
|
25
|
-
# Add the US map boundaries and features
|
|
26
|
-
add_us_map(ax)
|
|
27
|
-
|
|
28
|
-
# Add data layers
|
|
29
|
-
if len(array_dt.shape) == 3:
|
|
30
|
-
for i, img_ch_nel in enumerate(array_dt):
|
|
31
|
-
ax.imshow(img_ch_nel, vmin=50, vmax=500, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env)
|
|
32
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
33
|
-
plt.savefig(f"{outpath}_layer_{i}.png")
|
|
34
|
-
plt.clf() # Clear the figure to draw the next channel image
|
|
35
|
-
elif len(array_dt.shape) == 2 and ty =="pre":
|
|
36
|
-
# ax.imshow(array_dt, vmin=0, vmax=100, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env) #pre_tqw
|
|
37
|
-
ax.imshow(array_dt, vmin=0, vmax=10, cmap=cmp_hjnwtx["pre_tqw"], transform=ccrs.PlateCarree(), extent=env) #pre_tqw
|
|
38
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
39
|
-
plt.savefig(outpath)
|
|
40
|
-
else :
|
|
41
|
-
ax.imshow(array_dt, vmin=0, vmax=72, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env)
|
|
42
|
-
# ax.imshow(array_dt, vmin=0, vmax=10, cmap=cmp_hjnwtx["pre_tqw"], transform=ccrs.PlateCarree(), extent=[-119, -64, 22, 50]) #pre_tqw
|
|
43
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
44
|
-
plt.savefig(outpath)
|
|
45
|
-
|
|
46
|
-
plt.close(fig)
|
|
47
|
-
|
|
48
|
-
def add_us_map(ax):
|
|
49
|
-
# Add geographic features for the US
|
|
50
|
-
ax.add_feature(cfeature.COASTLINE, edgecolor='gray')
|
|
51
|
-
ax.add_feature(cfeature.BORDERS, linestyle=':', edgecolor='gray')
|
|
52
|
-
ax.add_feature(cfeature.LAKES, alpha=0.8)
|
|
53
|
-
|
|
54
|
-
# Adding state boundaries
|
|
55
|
-
if os.path.exists('/home/scx/ne_10m_admin_1_states_provinces.shp'):
|
|
56
|
-
states = '/home/scx/ne_10m_admin_1_states_provinces.shp'
|
|
57
|
-
else:
|
|
58
|
-
states = shpreader.natural_earth(resolution='10m', category='cultural', name='admin_1_states_provinces') # Automatically download
|
|
59
|
-
|
|
60
|
-
states_features = shpreader.Reader(states).geometries()
|
|
61
|
-
|
|
62
|
-
ax.add_geometries(states_features, ccrs.PlateCarree(), facecolor='none', edgecolor='gray', linestyle=':', linewidth=0.5, alpha=0.8)
|
|
63
|
-
|
|
64
|
-
# Example usage
|
|
65
|
-
# Assuming array_dt is your data array, pass it to drawUS
|
|
66
|
-
# array_dt = np.random.rand(3, 100, 100) # Example random data; replace with your actual data
|
|
67
|
-
# drawUS(array_dt)
|
|
68
|
-
|
|
69
|
-
def drawUSLonLat(array_dt,Lon,Lat,ty="CR"): ### x_coords2 维度
|
|
70
|
-
# env = [-119, -64, 22, 50]
|
|
71
|
-
env = [-132.0, -47.0, 0, 57.0]
|
|
72
|
-
now_str = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
|
73
|
-
outpath = f"./radar_nmc/US_{now_str}.png"
|
|
74
|
-
crDir(outpath)
|
|
75
|
-
|
|
76
|
-
# Create figure and set the coordinate system
|
|
77
|
-
fig = plt.figure(figsize=(10, 8))
|
|
78
|
-
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
|
|
79
|
-
|
|
80
|
-
# Set the extent for the United States
|
|
81
|
-
ax.set_extent(env, ccrs.PlateCarree()) # Adjust as needed
|
|
82
|
-
|
|
83
|
-
# Add the US map boundaries and features
|
|
84
|
-
add_us_map(ax)
|
|
85
|
-
|
|
86
|
-
# Add data layers
|
|
87
|
-
if len(array_dt.shape) == 3:
|
|
88
|
-
for i, img_ch_nel in enumerate(array_dt):
|
|
89
|
-
ax.imshow(img_ch_nel, vmin=50, vmax=500, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env)
|
|
90
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
91
|
-
plt.savefig(f"{outpath}_layer_{i}.png")
|
|
92
|
-
plt.clf() # Clear the figure to draw the next channel image
|
|
93
|
-
elif len(array_dt.shape) == 2 and ty =="pre":
|
|
94
|
-
# ax.imshow(array_dt, vmin=0, vmax=100, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env) #pre_tqw
|
|
95
|
-
ax.imshow(array_dt, vmin=0, vmax=10, cmap=cmp_hjnwtx["pre_tqw"], transform=ccrs.PlateCarree(), extent=env) #pre_tqw
|
|
96
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
97
|
-
ax.scatter(list(Lon), list(Lat), s=1, c='red', marker='o', transform=ccrs.PlateCarree())
|
|
98
|
-
# ax.scatter(list(x_coords2), list(y_coords2), 'ro', markersize=1)
|
|
99
|
-
plt.savefig(outpath)
|
|
100
|
-
else :
|
|
101
|
-
ax.imshow(array_dt, vmin=0, vmax=72, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=env)
|
|
102
|
-
ax.scatter(list(Lon), list(Lat), s=1, c='red', marker='o', transform=ccrs.PlateCarree())
|
|
103
|
-
# ax.imshow(array_dt, vmin=0, vmax=10, cmap=cmp_hjnwtx["pre_tqw"], transform=ccrs.PlateCarree(), extent=[-119, -64, 22, 50]) #pre_tqw
|
|
104
|
-
plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
|
|
105
|
-
plt.savefig(outpath)
|
|
106
|
-
|
|
107
|
-
plt.close(fig)
|
|
108
|
-
|
|
109
|
-
def add_us_map(ax):
|
|
110
|
-
# Add geographic features for the US
|
|
111
|
-
ax.add_feature(cfeature.COASTLINE, edgecolor='gray')
|
|
112
|
-
ax.add_feature(cfeature.BORDERS, linestyle=':', edgecolor='gray')
|
|
113
|
-
ax.add_feature(cfeature.LAKES, alpha=0.8)
|
|
114
|
-
|
|
115
|
-
# Adding state boundaries
|
|
116
|
-
if os.path.exists('/home/scx/ne_10m_admin_1_states_provinces.shp'):
|
|
117
|
-
states = '/home/scx/ne_10m_admin_1_states_provinces.shp'
|
|
118
|
-
else:
|
|
119
|
-
states = shpreader.natural_earth(resolution='10m', category='cultural', name='admin_1_states_provinces') # Automatically download
|
|
120
|
-
|
|
121
|
-
states_features = shpreader.Reader(states).geometries()
|
|
122
|
-
|
|
123
|
-
ax.add_geometries(states_features, ccrs.PlateCarree(), facecolor='none', edgecolor='gray', linestyle=':', linewidth=0.5, alpha=0.8)
|
|
124
|
-
|
|
125
|
-
# Example usage
|
|
126
|
-
# Assuming array_dt is your data array, pass it to drawUS
|
|
127
|
-
# array_dt = np.random.rand(3, 100, 100) # Example random data; replace with your actual data
|
|
128
|
-
# drawUS(array_dt)
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import glob
|
|
3
|
-
import numpy as np
|
|
4
|
-
from hjnwtx.colormap import cmp_hjnwtx
|
|
5
|
-
PathList = glob.glob("/mnt/wtx_weather_forecast/scx/testDBscan/2024_p/20240312/*")
|
|
6
|
-
path = PathList[0]
|
|
7
|
-
print(path)
|
|
8
|
-
|
|
9
|
-
import numpy as np
|
|
10
|
-
import matplotlib.pyplot as plt
|
|
11
|
-
x = np.load(path)
|
|
12
|
-
# for i in range(35):
|
|
13
|
-
# plt.imshow(x[i])
|
|
14
|
-
# plt.savefig(f"./image/a{str(i)}.png")
|
|
15
|
-
# plt.show()
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
from hjnwtx.colormap import cmp_hjnwtx
|
|
19
|
-
import matplotlib.pyplot as plt
|
|
20
|
-
import datetime
|
|
21
|
-
def drawpic_com(base_up,base_down,shape_len, name="temp"):
|
|
22
|
-
now_str = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
|
23
|
-
Count = shape_len
|
|
24
|
-
data_all = np.concatenate([base_up,base_down], axis=0)
|
|
25
|
-
fig, axs = plt.subplots(2, Count, figsize=(10*shape_len, 10))
|
|
26
|
-
# data_all = data_all * 70
|
|
27
|
-
for i in range(2):
|
|
28
|
-
for j in range(Count):
|
|
29
|
-
index = i * Count + j
|
|
30
|
-
axs[i, j].imshow(data_all[index, :, :],vmax=70,vmin=0,cmap=cmp_hjnwtx["radar_nmc"])
|
|
31
|
-
axs[i, j].axis('off')
|
|
32
|
-
plt.tight_layout()
|
|
33
|
-
plt.savefig(name +now_str + '.png')
|
|
34
|
-
plt.close()
|
|
35
|
-
#drawpic(x,x,35)
|
|
36
|
-
print("done")
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import matplotlib.pyplot as plt
|
|
2
|
-
import cartopy.crs as ccrs
|
|
3
|
-
import cartopy.feature as cfeature
|
|
4
|
-
import cartopy.io.shapereader as shpreader
|
|
5
|
-
import datetime
|
|
6
|
-
import os
|
|
7
|
-
|
|
8
|
-
def add_china_map(ax):
|
|
9
|
-
ax.add_feature(cfeature.COASTLINE, edgecolor='gray')
|
|
10
|
-
ax.add_feature(cfeature.BORDERS, linestyle=':', edgecolor='gray')
|
|
11
|
-
ax.add_feature(cfeature.LAKES, alpha=0.8)
|
|
12
|
-
provinces = shpreader.natural_earth(resolution='10m', category='cultural', name='admin_1_states_provinces') ###自动下载
|
|
13
|
-
provinces_features = shpreader.Reader(provinces).geometries()
|
|
14
|
-
"""
|
|
15
|
-
本地路径读取 #'/home/scx/.local/share/cartopy/shapefiles/natural_earth/cultural/ne_10m_admin_1_states_provinces.shp' #ne_10m_admin_1_states_provinces.shx
|
|
16
|
-
# shapefile_path = '/home/scx/.local/share/cartopy/shapefiles/natural_earth/cultural/admin_1_states_provinces.shp'
|
|
17
|
-
# provinces_features = shpreader.Reader(shapefile_path).geometries()
|
|
18
|
-
"""
|
|
19
|
-
ax.add_geometries(provinces_features, ccrs.PlateCarree(), facecolor='none', edgecolor='gray', linestyle=':', linewidth=0.5, alpha=0.8)
|
|
20
|
-
|
|
21
|
-
def mkDir(filepath):
|
|
22
|
-
directory = os.path.dirname(filepath)
|
|
23
|
-
if not os.path.exists(directory):
|
|
24
|
-
os.makedirs(directory)
|
|
25
|
-
|
|
26
|
-
def drawpic(data, num_images, output_name="temp"):
|
|
27
|
-
# Validate input
|
|
28
|
-
if not data.shape[0] >= num_images:
|
|
29
|
-
raise ValueError("Data does not contain enough entries for the number of images specified.")
|
|
30
|
-
|
|
31
|
-
# Setup figure dimensions based on the number of images
|
|
32
|
-
fig, axs = plt.subplots(1, num_images, figsize=(10 * num_images, 10), subplot_kw={'projection': ccrs.PlateCarree()})
|
|
33
|
-
|
|
34
|
-
for i in range(num_images):
|
|
35
|
-
axs[i].imshow(data[i, :, :], vmax=70, vmin=0, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=[73, 135, 18, 54])
|
|
36
|
-
add_china_map(axs[i])
|
|
37
|
-
axs[i].axis('off')
|
|
38
|
-
|
|
39
|
-
# Save the figure
|
|
40
|
-
now_str = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
|
41
|
-
outpath = f"./aplot_image/{output_name}_{now_str}.png"
|
|
42
|
-
mkDir(outpath)
|
|
43
|
-
fig.tight_layout()
|
|
44
|
-
fig.savefig(outpath, dpi=300)
|
|
45
|
-
plt.close(fig)
|
shancx/S/__init__.py
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
import os
|
|
4
|
-
def start():
|
|
5
|
-
print("import successful")
|
|
6
|
-
# constants
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__author__ = 'shancx'
|
|
10
|
-
|
|
11
|
-
__author_email__ = 'shancx@126.com'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# @Time : 2023/09/27 下午8:52
|
|
16
|
-
# @Author : shanchangxi
|
|
17
|
-
# @File : util_log.py
|
|
18
|
-
import time
|
|
19
|
-
import logging
|
|
20
|
-
from logging import handlers
|
|
21
|
-
|
|
22
|
-
def mkDir(path):
|
|
23
|
-
if "." in path:
|
|
24
|
-
os.makedirs(os.path.dirname(path),exist_ok=True)
|
|
25
|
-
else:
|
|
26
|
-
os.makedirs(path, exist_ok=True)
|
|
27
|
-
|
|
28
|
-
loggers = logging.getLogger()
|
|
29
|
-
loggers.setLevel(logging.INFO)
|
|
30
|
-
log_name = '/home/scx/logs/project_S.log'
|
|
31
|
-
mkDir(log_name)
|
|
32
|
-
logfile = log_name
|
|
33
|
-
time_rotating_file_handler = handlers.TimedRotatingFileHandler(filename=logfile, when='D', encoding='utf-8')
|
|
34
|
-
time_rotating_file_handler.setLevel(logging.INFO)
|
|
35
|
-
formatter = logging.Formatter("%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s")
|
|
36
|
-
time_rotating_file_handler.setFormatter(formatter)
|
|
37
|
-
loggers.addHandler(time_rotating_file_handler)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"""
|
|
41
|
-
import tracback
|
|
42
|
-
try:
|
|
43
|
-
|
|
44
|
-
except Exception as e:
|
|
45
|
-
|
|
46
|
-
logger.info(traceback.format_exc())
|
|
47
|
-
"""
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'''
|
|
51
|
-
##定義一個streamHandler
|
|
52
|
-
# print_handler = logging.StreamHandler()
|
|
53
|
-
# print_handler.setFormatter(formatter)
|
|
54
|
-
# loggers.addHandler(print_handler)
|
|
55
|
-
'''
|
|
56
|
-
|
|
57
|
-
"""
|
|
58
|
-
from main import makeAll,options
|
|
59
|
-
from multiprocessing import Pool
|
|
60
|
-
import datetime
|
|
61
|
-
from config import logger,output
|
|
62
|
-
import time
|
|
63
|
-
import pandas as pd
|
|
64
|
-
import os
|
|
65
|
-
from itertools import product
|
|
66
|
-
import threading
|
|
67
|
-
|
|
68
|
-
def excuteCommand(cmd):
|
|
69
|
-
print(cmd)
|
|
70
|
-
os.system(cmd)
|
|
71
|
-
|
|
72
|
-
def gpuPro(makeListUTC, isPhase, isDebug, gpu, isOverwrite):
|
|
73
|
-
productList = product(makeListUTC, [isPhase], [isDebug], [gpu], [isOverwrite])
|
|
74
|
-
|
|
75
|
-
with Pool(4) as p:
|
|
76
|
-
p.map(makeAll, productList)
|
|
77
|
-
|
|
78
|
-
if __name__ == '__main__':
|
|
79
|
-
cfg = options()
|
|
80
|
-
isPhase = cfg.isPhase
|
|
81
|
-
isDebug = cfg.isDebug
|
|
82
|
-
sepSec = cfg.sepSec
|
|
83
|
-
gpu = cfg.gpu
|
|
84
|
-
pool = cfg.pool
|
|
85
|
-
isOverwrite = cfg.isOverwrite
|
|
86
|
-
timeList = pd.date_range(cfg.times[0], cfg.times[-1], freq=f"{sepSec}s")
|
|
87
|
-
logger.info(f"时间段check {timeList}")
|
|
88
|
-
gpuNum = 2
|
|
89
|
-
eachGPU = 4
|
|
90
|
-
|
|
91
|
-
makeListUTC = []
|
|
92
|
-
for UTC in timeList:
|
|
93
|
-
UTCStr = UTC.strftime("%Y%m%d%H%M")
|
|
94
|
-
outpath = f"{output}/{UTCStr[:4]}/{UTCStr[:8]}/MSP2_WTX_AIW_QPF_L88_CHN_{UTCStr}_00000-00300-00006.nc"
|
|
95
|
-
if not os.path.exists(outpath) or isOverwrite:
|
|
96
|
-
makeListUTC.append(UTC)
|
|
97
|
-
[print(element) for element in makeListUTC]
|
|
98
|
-
|
|
99
|
-
phaseCMD = "--isPhase" if isPhase else ""
|
|
100
|
-
debugCMD = "--isDebug" if isDebug else ""
|
|
101
|
-
OverwriteCMD = "--isOverwrite"
|
|
102
|
-
gpuCMD = f"--gpu={gpu}"
|
|
103
|
-
# cmdList = list(map(lambda x:f"python main.py --times={x.strftime('%Y%m%d%H%M')} {phaseCMD} {debugCMD} {OverwriteCMD} {gpuCMD}",makeListUTC))
|
|
104
|
-
cmdList = list(map(lambda x:f"python main.py --times={x.strftime('%Y%m%d%H%M')} {phaseCMD} {debugCMD} {gpuCMD}",makeListUTC))
|
|
105
|
-
|
|
106
|
-
with Pool(pool) as p:
|
|
107
|
-
p.map(excuteCommand, cmdList)
|
|
108
|
-
"""
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
'''
|
|
112
|
-
# @Time : 2023/09/27 下午8:52
|
|
113
|
-
# @Author : shanchangxi
|
|
114
|
-
# @File : util_log.py
|
|
115
|
-
import time
|
|
116
|
-
import logging
|
|
117
|
-
from logging import handlers
|
|
118
|
-
|
|
119
|
-
logger = logging.getLogger()
|
|
120
|
-
logger.setLevel(logging.INFO)
|
|
121
|
-
log_name = 'project_tim_tor.log'
|
|
122
|
-
logfile = log_name
|
|
123
|
-
time_rotating_file_handler = handlers.TimedRotatingFileHandler(filename=logfile, when='D', encoding='utf-8')
|
|
124
|
-
time_rotating_file_handler.setLevel(logging.INFO)
|
|
125
|
-
formatter = logging.Formatter("%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s")
|
|
126
|
-
time_rotating_file_handler.setFormatter(formatter)
|
|
127
|
-
logger.addHandler(time_rotating_file_handler)
|
|
128
|
-
print_handler = logging.StreamHandler()
|
|
129
|
-
print_handler.setFormatter(formatter)
|
|
130
|
-
logger.addHandler(print_handler)
|
|
131
|
-
|
|
132
|
-
'''
|
|
133
|
-
|
|
134
|
-
'''
|
|
135
|
-
###解决方法 pip install torch==2.4.0 torchvision torchaudio三个同时安装 python 3.12 解决cuda启动不了的问题
|
|
136
|
-
|
|
137
|
-
Res网络
|
|
138
|
-
'''
|
shancx/W/__init__.py
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
import os
|
|
4
|
-
def start():
|
|
5
|
-
print("import successful")
|
|
6
|
-
# constants
|
|
7
|
-
|
|
8
|
-
__author__ = 'shancx'
|
|
9
|
-
|
|
10
|
-
__author_email__ = 'shancx@126.com'
|
|
11
|
-
|
|
12
|
-
# @Time : 2023/09/27 下午8:52
|
|
13
|
-
# @Author : shanchangxi
|
|
14
|
-
# @File : util_log.py
|
|
15
|
-
import time
|
|
16
|
-
import logging
|
|
17
|
-
from logging import handlers
|
|
18
|
-
|
|
19
|
-
def mkDir(path):
|
|
20
|
-
if "." in path:
|
|
21
|
-
os.makedirs(os.path.dirname(path),exist_ok=True)
|
|
22
|
-
else:
|
|
23
|
-
os.makedirs(path, exist_ok=True)
|
|
24
|
-
|
|
25
|
-
loggers = logging.getLogger()
|
|
26
|
-
loggers.setLevel(logging.INFO)
|
|
27
|
-
log_name = '/home/scx/logs/project_W.log'
|
|
28
|
-
mkDir(log_name)
|
|
29
|
-
logfile = log_name
|
|
30
|
-
time_rotating_file_handler = handlers.TimedRotatingFileHandler(filename=logfile, when='D', encoding='utf-8')
|
|
31
|
-
time_rotating_file_handler.setLevel(logging.INFO)
|
|
32
|
-
formatter = logging.Formatter("%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s")
|
|
33
|
-
time_rotating_file_handler.setFormatter(formatter)
|
|
34
|
-
loggers.addHandler(time_rotating_file_handler)
|
|
35
|
-
|
|
36
|
-
"""
|
|
37
|
-
import tracback
|
|
38
|
-
try:
|
|
39
|
-
|
|
40
|
-
except Exception as e:
|
|
41
|
-
|
|
42
|
-
logger.info(traceback.format_exc())
|
|
43
|
-
"""
|
|
44
|
-
'''
|
|
45
|
-
##定義一個streamHandler
|
|
46
|
-
# print_handler = logging.StreamHandler()
|
|
47
|
-
# print_handler.setFormatter(formatter)
|
|
48
|
-
# loggers.addHandler(print_handler)
|
|
49
|
-
'''
|
|
50
|
-
|
|
51
|
-
"""
|
|
52
|
-
from main import makeAll,options
|
|
53
|
-
from multiprocessing import Pool
|
|
54
|
-
import datetime
|
|
55
|
-
from config import logger,output
|
|
56
|
-
import time
|
|
57
|
-
import pandas as pd
|
|
58
|
-
import os
|
|
59
|
-
from itertools import product
|
|
60
|
-
import threading
|
|
61
|
-
|
|
62
|
-
def excuteCommand(cmd):
|
|
63
|
-
print(cmd)
|
|
64
|
-
os.system(cmd)
|
|
65
|
-
|
|
66
|
-
def gpuPro(makeListUTC, isPhase, isDebug, gpu, isOverwrite):
|
|
67
|
-
productList = product(makeListUTC, [isPhase], [isDebug], [gpu], [isOverwrite])
|
|
68
|
-
|
|
69
|
-
with Pool(4) as p:
|
|
70
|
-
p.map(makeAll, productList)
|
|
71
|
-
|
|
72
|
-
if __name__ == '__main__':
|
|
73
|
-
cfg = options()
|
|
74
|
-
isPhase = cfg.isPhase
|
|
75
|
-
isDebug = cfg.isDebug
|
|
76
|
-
sepSec = cfg.sepSec
|
|
77
|
-
gpu = cfg.gpu
|
|
78
|
-
pool = cfg.pool
|
|
79
|
-
isOverwrite = cfg.isOverwrite
|
|
80
|
-
timeList = pd.date_range(cfg.times[0], cfg.times[-1], freq=f"{sepSec}s")
|
|
81
|
-
logger.info(f"时间段check {timeList}")
|
|
82
|
-
gpuNum = 2
|
|
83
|
-
eachGPU = 4
|
|
84
|
-
|
|
85
|
-
makeListUTC = []
|
|
86
|
-
for UTC in timeList:
|
|
87
|
-
UTCStr = UTC.strftime("%Y%m%d%H%M")
|
|
88
|
-
outpath = f"{output}/{UTCStr[:4]}/{UTCStr[:8]}/MSP2_WTX_AIW_QPF_L88_CHN_{UTCStr}_00000-00300-00006.nc"
|
|
89
|
-
if not os.path.exists(outpath) or isOverwrite:
|
|
90
|
-
makeListUTC.append(UTC)
|
|
91
|
-
[print(element) for element in makeListUTC]
|
|
92
|
-
|
|
93
|
-
phaseCMD = "--isPhase" if isPhase else ""
|
|
94
|
-
debugCMD = "--isDebug" if isDebug else ""
|
|
95
|
-
OverwriteCMD = "--isOverwrite"
|
|
96
|
-
gpuCMD = f"--gpu={gpu}"
|
|
97
|
-
# cmdList = list(map(lambda x:f"python main.py --times={x.strftime('%Y%m%d%H%M')} {phaseCMD} {debugCMD} {OverwriteCMD} {gpuCMD}",makeListUTC))
|
|
98
|
-
cmdList = list(map(lambda x:f"python main.py --times={x.strftime('%Y%m%d%H%M')} {phaseCMD} {debugCMD} {gpuCMD}",makeListUTC))
|
|
99
|
-
|
|
100
|
-
with Pool(pool) as p:
|
|
101
|
-
p.map(excuteCommand, cmdList)
|
|
102
|
-
"""
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
'''
|
|
106
|
-
# @Time : 2023/09/27 下午8:52
|
|
107
|
-
# @Author : shanchangxi
|
|
108
|
-
# @File : util_log.py
|
|
109
|
-
import time
|
|
110
|
-
import logging
|
|
111
|
-
from logging import handlers
|
|
112
|
-
|
|
113
|
-
logger = logging.getLogger()
|
|
114
|
-
logger.setLevel(logging.INFO)
|
|
115
|
-
log_name = 'project_tim_tor.log'
|
|
116
|
-
logfile = log_name
|
|
117
|
-
time_rotating_file_handler = handlers.TimedRotatingFileHandler(filename=logfile, when='D', encoding='utf-8')
|
|
118
|
-
time_rotating_file_handler.setLevel(logging.INFO)
|
|
119
|
-
formatter = logging.Formatter("%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s")
|
|
120
|
-
time_rotating_file_handler.setFormatter(formatter)
|
|
121
|
-
logger.addHandler(time_rotating_file_handler)
|
|
122
|
-
print_handler = logging.StreamHandler()
|
|
123
|
-
print_handler.setFormatter(formatter)
|
|
124
|
-
logger.addHandler(print_handler)
|
|
125
|
-
|
|
126
|
-
'''
|
|
127
|
-
|
|
128
|
-
'''
|
|
129
|
-
###解决方法 pip install torch==2.4.0 torchvision torchaudio三个同时安装 python 3.12 解决cuda启动不了的问题
|
|
130
|
-
|
|
131
|
-
Res网络
|
|
132
|
-
'''
|