shancx 1.60__py3-none-any.whl → 1.70__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/__init__.py CHANGED
@@ -52,3 +52,96 @@ def Mul_Ess(map_fun,tuple_list):
52
52
  with Pool(31) as p:
53
53
  P_data = p.map(map_fun, tuple_list)
54
54
  return P_data
55
+
56
+
57
+ import numpy as np
58
+ from matplotlib.colors import ListedColormap
59
+ import matplotlib.pyplot as plt
60
+ import datetime
61
+ cmp_hjnwtx={}
62
+
63
+ newcolorsNMC = np.array([
64
+ [68,157,237, 255],
65
+ [98,230,234, 255],
66
+ [104,249,82, 255],
67
+ [0,215,46, 255],
68
+ [0,143,27, 255],
69
+ [254,254,63, 255],
70
+ [231,192,48, 255],
71
+ [255,154,41, 255],
72
+ [255,19,27, 255],
73
+ [215,14,21, 255],
74
+ [193,11,18, 255],
75
+ [255,28,236, 255],
76
+ [152,15,177, 255],
77
+ [175,145,237, 255]])/255
78
+ cmp_hjnwtx["radar_nmc"] = ListedColormap(newcolorsNMC)
79
+
80
+ newcolorsNMC = np.array([
81
+ [68,157,237, 255],
82
+ [98,230,234, 255],
83
+ [104,249,82, 255],
84
+ [0,215,46, 255],
85
+ [0,143,27, 255],
86
+ [254,254,63, 255],
87
+ [231,192,48, 255],
88
+ [255,154,41, 255],
89
+ [255,19,27, 255],
90
+ [215,14,21, 255],
91
+ [193,11,18, 255],
92
+ [255,28,236, 255],
93
+ [152,15,177, 255],
94
+ [175,145,237, 255]])/255
95
+ cmp_hjnwtx["radar_moc"] = ListedColormap(newcolorsNMC)
96
+
97
+
98
+ newcolorsPRE = np.array([
99
+ [128, 255, 255, 255],
100
+ [35, 182, 254, 255],
101
+ [0, 120, 180, 255],
102
+ [0, 82, 202, 255],
103
+ [0, 16, 220, 255],
104
+ [150, 2, 244, 255],
105
+ [110, 0, 182, 255],
106
+ [77, 0, 130, 255]])/255
107
+ cmp_hjnwtx["pre_tqw"] = ListedColormap(newcolorsPRE)
108
+
109
+ newcolorsWS = np.array([
110
+ [75, 140, 244, 255],
111
+ [0, 89, 235, 255],
112
+ [36, 173, 0, 255],
113
+ [18, 129, 1, 255],
114
+ [3, 64, 4, 255],
115
+ [218, 183, 5, 255],
116
+ [179, 125, 1, 255],
117
+ [155, 70, 16, 255],
118
+ [253, 3, 127, 255],
119
+ [255, 0, 55, 255],
120
+ [233, 0, 3, 255]])/255
121
+ cmp_hjnwtx["ws_nmic"] = ListedColormap(newcolorsWS)
122
+
123
+ import os
124
+ def mkDir(path):
125
+ if "." in path:
126
+ os.makedirs(os.path.dirname(path),exist_ok=True)
127
+ else:
128
+ os.makedirs(path, exist_ok=True)
129
+
130
+ def Radar_Nmc(array_dt,temp = "850"):
131
+ now_str = datetime.datetime.now().strftime("%Y%m%d%H%M")
132
+ if len(array_dt.shape)==3:
133
+ for i , img_ch_nel in enumerate(array_dt):
134
+ plt.imshow(img_ch_nel,vmin=0,vmax=100,cmap=cmp_hjnwtx["radar_nmc"])
135
+ plt.colorbar()
136
+ outpath = f"./radar_nmc/{temp}_{now_str}.png"
137
+ mkDir(outpath)
138
+ plt.savefig(outpath)
139
+ plt.close()
140
+ if len(array_dt.shape)==2:
141
+ plt.imshow(array_dt,vmin=0,vmax=100,cmap=cmp_hjnwtx["radar_nmc"])
142
+ plt.colorbar()
143
+ outpath = f"./radar_nmc/{temp}_{now_str}.png"
144
+ mkDir(outpath)
145
+ plt.savefig(outpath)
146
+ plt.close()
147
+
shancx/mkIMGSCX.py ADDED
@@ -0,0 +1,92 @@
1
+
2
+ import numpy as np
3
+ from matplotlib.colors import ListedColormap
4
+ import matplotlib.pyplot as plt
5
+ import datetime
6
+ cmp_hjnwtx={}
7
+
8
+ newcolorsNMC = np.array([
9
+ [68,157,237, 255],
10
+ [98,230,234, 255],
11
+ [104,249,82, 255],
12
+ [0,215,46, 255],
13
+ [0,143,27, 255],
14
+ [254,254,63, 255],
15
+ [231,192,48, 255],
16
+ [255,154,41, 255],
17
+ [255,19,27, 255],
18
+ [215,14,21, 255],
19
+ [193,11,18, 255],
20
+ [255,28,236, 255],
21
+ [152,15,177, 255],
22
+ [175,145,237, 255]])/255
23
+ cmp_hjnwtx["radar_nmc"] = ListedColormap(newcolorsNMC)
24
+
25
+ newcolorsNMC = np.array([
26
+ [68,157,237, 255],
27
+ [98,230,234, 255],
28
+ [104,249,82, 255],
29
+ [0,215,46, 255],
30
+ [0,143,27, 255],
31
+ [254,254,63, 255],
32
+ [231,192,48, 255],
33
+ [255,154,41, 255],
34
+ [255,19,27, 255],
35
+ [215,14,21, 255],
36
+ [193,11,18, 255],
37
+ [255,28,236, 255],
38
+ [152,15,177, 255],
39
+ [175,145,237, 255]])/255
40
+ cmp_hjnwtx["radar_moc"] = ListedColormap(newcolorsNMC)
41
+
42
+
43
+ newcolorsPRE = np.array([
44
+ [128, 255, 255, 255],
45
+ [35, 182, 254, 255],
46
+ [0, 120, 180, 255],
47
+ [0, 82, 202, 255],
48
+ [0, 16, 220, 255],
49
+ [150, 2, 244, 255],
50
+ [110, 0, 182, 255],
51
+ [77, 0, 130, 255]])/255
52
+ cmp_hjnwtx["pre_tqw"] = ListedColormap(newcolorsPRE)
53
+
54
+ newcolorsWS = np.array([
55
+ [75, 140, 244, 255],
56
+ [0, 89, 235, 255],
57
+ [36, 173, 0, 255],
58
+ [18, 129, 1, 255],
59
+ [3, 64, 4, 255],
60
+ [218, 183, 5, 255],
61
+ [179, 125, 1, 255],
62
+ [155, 70, 16, 255],
63
+ [253, 3, 127, 255],
64
+ [255, 0, 55, 255],
65
+ [233, 0, 3, 255]])/255
66
+ cmp_hjnwtx["ws_nmic"] = ListedColormap(newcolorsWS)
67
+
68
+ import os
69
+ def mkDir(path):
70
+ if "." in path:
71
+ os.makedirs(os.path.dirname(path),exist_ok=True)
72
+ else:
73
+ os.makedirs(path, exist_ok=True)
74
+
75
+ def Radar_Nmc(array_dt,temp = "850"):
76
+ now_str = datetime.datetime.now().strftime("%Y%m%d%H%M")
77
+ if len(array_dt.shape)==3:
78
+ for i , img_ch_nel in enumerate(array_dt):
79
+ plt.imshow(img_ch_nel,vmin=0,vmax=100,cmap=cmp_hjnwtx["radar_nmc"])
80
+ plt.colorbar()
81
+ outpath = f"./radar_nmc/{temp}_{now_str}.png"
82
+ mkDir(outpath)
83
+ plt.savefig(outpath)
84
+ plt.close()
85
+ if len(array_dt.shape)==2:
86
+ plt.imshow(array_dt,vmin=0,vmax=100,cmap=cmp_hjnwtx["radar_nmc"])
87
+ plt.colorbar()
88
+ outpath = f"./radar_nmc/{temp}_{now_str}.png"
89
+ mkDir(outpath)
90
+ plt.savefig(outpath)
91
+ plt.close()
92
+
@@ -0,0 +1,55 @@
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
+
9
+ def big_value_fun(array_dt,array_dt1,name="temp"):
10
+ now_str = datetime.datetime.now().strftime("%Y%m%d%H%M")
11
+ outpath = f"./radar_nmc/{name}_{now_str}.png"
12
+ mkDir(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
+ def mkDir(path):
49
+ # 处理目录创建
50
+ import os
51
+ directory = os.path.dirname(path)
52
+ if not os.path.exists(directory):
53
+ os.makedirs(directory)
54
+
55
+ # 示例用法
@@ -0,0 +1,54 @@
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
+
9
+ def big_value_fun(array_dt):
10
+ now_str = datetime.datetime.now().strftime("%Y%m%d%H%M")
11
+ outpath = f"./radar_nmc/{now_str}.png"
12
+ mkDir(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])
33
+ plt.colorbar(ax.images[0], ax=ax, orientation='vertical')
34
+ plt.savefig(outpath)
35
+ plt.close(fig)
36
+
37
+ def add_china_map(ax):
38
+ # 在地图上添加地形特征
39
+ ax.add_feature(cfeature.COASTLINE, edgecolor='gray')
40
+ ax.add_feature(cfeature.BORDERS, linestyle=':', edgecolor='gray')
41
+ ax.add_feature(cfeature.LAKES, alpha=0.8)
42
+ # 添加省份轮廓
43
+ provinces = shpreader.natural_earth(resolution='10m', category='cultural', name='admin_1_states_provinces')
44
+ provinces_features = shpreader.Reader(provinces).geometries()
45
+ ax.add_geometries(provinces_features, ccrs.PlateCarree(), facecolor='none', edgecolor='gray', linestyle=':', linewidth=0.5, alpha=0.8)
46
+
47
+ def mkDir(path):
48
+ # 处理目录创建
49
+ import os
50
+ directory = os.path.dirname(path)
51
+ if not os.path.exists(directory):
52
+ os.makedirs(directory)
53
+
54
+ # 示例用法
@@ -0,0 +1,36 @@
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(base_up,base_down,shape_len, name="temp"):
22
+ now_str = datetime.datetime.now().strftime("%Y%m%d%H%M")
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")
@@ -0,0 +1,40 @@
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
+ ax.add_geometries(provinces_features, ccrs.PlateCarree(), facecolor='none', edgecolor='gray', linestyle=':', linewidth=0.5, alpha=0.8)
15
+
16
+ def mkDir(filepath):
17
+ directory = os.path.dirname(filepath)
18
+ if not os.path.exists(directory):
19
+ os.makedirs(directory)
20
+
21
+ def draw_radar_images(data, num_images, output_name="temp"):
22
+ # Validate input
23
+ if not data.shape[0] >= num_images:
24
+ raise ValueError("Data does not contain enough entries for the number of images specified.")
25
+
26
+ # Setup figure dimensions based on the number of images
27
+ fig, axs = plt.subplots(1, num_images, figsize=(10 * num_images, 10), subplot_kw={'projection': ccrs.PlateCarree()})
28
+
29
+ for i in range(num_images):
30
+ axs[i].imshow(data[i, :, :], vmax=70, vmin=0, cmap=cmp_hjnwtx["radar_nmc"], transform=ccrs.PlateCarree(), extent=[73, 135, 18, 54])
31
+ add_china_map(axs[i])
32
+ axs[i].axis('off')
33
+
34
+ # Save the figure
35
+ now_str = datetime.datetime.now().strftime("%Y%m%d%H%M")
36
+ outpath = f"./aplot_image/{output_name}_{now_str}.png"
37
+ mkDir(outpath)
38
+ fig.tight_layout()
39
+ fig.savefig(outpath, dpi=300)
40
+ plt.close(fig)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: shancx
3
- Version: 1.60
3
+ Version: 1.70
4
4
  Summary: A simple timer decorator
5
5
  Home-page: https://gitee.com/shancx
6
6
  Author: Your Name
@@ -0,0 +1,12 @@
1
+ my_timer_decorator/__init__.py,sha256=ur0N4vwlv-LfYOCph5A8g6H8aFxxc9EhJdG9sxpa-SY,303
2
+ shancx/__init__.py,sha256=2Y16Cyjk7CxtRJllGNrfjypvDuKZubviN1FNODuVUv4,4312
3
+ shancx/mkIMGSCX.py,sha256=RN0LqYcZ3W8ez4jE5F3KBApw9biNgXVXeFuNVeZvQ2U,2520
4
+ shancx/radar_nmc_china_map_compare1.py,sha256=3PhtDm6sAY8EjmpdT8_TXJYjeGbqi02ce8QeqSMp76s,2493
5
+ shancx/radar_nmc_china_map_f.py,sha256=vgxYKygN1SibHVW4wU2zdlRrBm1r4olo_ln0PZr0178,2302
6
+ shancx/subplots_compare_devlop.py,sha256=ZsWEpv-z9ILPBE-mkleSIvLFx2UbRZyGySiWi7PX8oc,1075
7
+ shancx/subplots_single_china_map.py,sha256=NoxmZoc3o7-FIAGYM-PU2jn75EAdq_7k70lJ-PGY44E,1732
8
+ shancx/util_log.py,sha256=bGu-oCU7hozBBZJB6oDGj9XDDsz5GJVe8ZfJtx5pddA,1204
9
+ shancx-1.70.dist-info/METADATA,sha256=STAvvfrd43RZHkzWpC04zpuUDo6QHipNsmmqK6b3TOM,572
10
+ shancx-1.70.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
11
+ shancx-1.70.dist-info/top_level.txt,sha256=akfCS1vKWz3pNmEN_yN9ZiGp-60IQY5ET38mRx_i_-4,7
12
+ shancx-1.70.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- my_timer_decorator/__init__.py,sha256=ur0N4vwlv-LfYOCph5A8g6H8aFxxc9EhJdG9sxpa-SY,303
2
- shancx/__init__.py,sha256=7E61iUEkmy21JSSyOk6kTRGB9yGJo5dJ5cMqHKqCW4U,1790
3
- shancx/util_log.py,sha256=bGu-oCU7hozBBZJB6oDGj9XDDsz5GJVe8ZfJtx5pddA,1204
4
- shancx-1.60.dist-info/METADATA,sha256=Ymku04OYpWTcfJcGi68WJEeG9rQZP_5ZobTgcQU6jXA,572
5
- shancx-1.60.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
- shancx-1.60.dist-info/top_level.txt,sha256=akfCS1vKWz3pNmEN_yN9ZiGp-60IQY5ET38mRx_i_-4,7
7
- shancx-1.60.dist-info/RECORD,,
File without changes