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.
Files changed (166) hide show
  1. shancx/3D/__init__.py +25 -0
  2. shancx/Algo/Class.py +11 -0
  3. shancx/Algo/CudaPrefetcher1.py +112 -0
  4. shancx/Algo/Fake_image.py +24 -0
  5. shancx/Algo/Hsml.py +391 -0
  6. shancx/Algo/L2Loss.py +10 -0
  7. shancx/Algo/MetricTracker.py +132 -0
  8. shancx/Algo/Normalize.py +66 -0
  9. shancx/Algo/OptimizerWScheduler.py +38 -0
  10. shancx/Algo/Rmageresize.py +79 -0
  11. shancx/Algo/Savemodel.py +33 -0
  12. shancx/Algo/SmoothL1_losses.py +27 -0
  13. shancx/Algo/Tqdm.py +62 -0
  14. shancx/Algo/__init__.py +121 -0
  15. shancx/Algo/checknan.py +28 -0
  16. shancx/Algo/iouJU.py +83 -0
  17. shancx/Algo/mask.py +25 -0
  18. shancx/Algo/psnr.py +9 -0
  19. shancx/Algo/ssim.py +70 -0
  20. shancx/Algo/structural_similarity.py +308 -0
  21. shancx/Algo/tool.py +704 -0
  22. shancx/Calmetrics/__init__.py +97 -0
  23. shancx/Calmetrics/calmetrics.py +14 -0
  24. shancx/Calmetrics/calmetricsmatrixLib.py +147 -0
  25. shancx/Calmetrics/rmseR2score.py +35 -0
  26. shancx/Clip/__init__.py +50 -0
  27. shancx/Cmd.py +126 -0
  28. shancx/Config_.py +26 -0
  29. shancx/Df/DataFrame.py +11 -2
  30. shancx/Df/__init__.py +17 -0
  31. shancx/Df/tool.py +0 -0
  32. shancx/Diffm/Psamples.py +18 -0
  33. shancx/Diffm/__init__.py +0 -0
  34. shancx/Diffm/test.py +207 -0
  35. shancx/Doc/__init__.py +214 -0
  36. shancx/E/__init__.py +178 -152
  37. shancx/Fillmiss/__init__.py +0 -0
  38. shancx/Fillmiss/imgidwJU.py +46 -0
  39. shancx/Fillmiss/imgidwLatLonJU.py +82 -0
  40. shancx/Gpu/__init__.py +55 -0
  41. shancx/H9/__init__.py +126 -0
  42. shancx/H9/ahi_read_hsd.py +877 -0
  43. shancx/H9/ahisearchtable.py +298 -0
  44. shancx/H9/geometry.py +2439 -0
  45. shancx/Hug/__init__.py +81 -0
  46. shancx/Inst.py +22 -0
  47. shancx/Lib.py +31 -0
  48. shancx/Mos/__init__.py +37 -0
  49. shancx/NN/__init__.py +235 -106
  50. shancx/Path1.py +161 -0
  51. shancx/Plot/GlobMap.py +276 -116
  52. shancx/Plot/__init__.py +491 -1
  53. shancx/Plot/draw_day_CR_PNG.py +4 -21
  54. shancx/Plot/exam.py +116 -0
  55. shancx/Plot/plotGlobal.py +325 -0
  56. shancx/{radar_nmc.py → Plot/radarNmc.py} +4 -34
  57. shancx/{subplots_single_china_map.py → Plot/single_china_map.py} +1 -1
  58. shancx/Point.py +46 -0
  59. shancx/QC.py +223 -0
  60. shancx/RdPzl/__init__.py +32 -0
  61. shancx/Read.py +72 -0
  62. shancx/Resize.py +79 -0
  63. shancx/SN/__init__.py +62 -123
  64. shancx/Time/GetTime.py +9 -3
  65. shancx/Time/__init__.py +66 -1
  66. shancx/Time/timeCycle.py +302 -0
  67. shancx/Time/tool.py +0 -0
  68. shancx/Train/__init__.py +74 -0
  69. shancx/Train/makelist.py +187 -0
  70. shancx/Train/multiGpu.py +27 -0
  71. shancx/Train/prepare.py +161 -0
  72. shancx/Train/renet50.py +157 -0
  73. shancx/ZR.py +12 -0
  74. shancx/__init__.py +333 -262
  75. shancx/args.py +27 -0
  76. shancx/bak.py +768 -0
  77. shancx/df2database.py +62 -2
  78. shancx/geosProj.py +80 -0
  79. shancx/info.py +38 -0
  80. shancx/netdfJU.py +231 -0
  81. shancx/sendM.py +59 -0
  82. shancx/tensBoard/__init__.py +28 -0
  83. shancx/wait.py +246 -0
  84. {shancx-1.8.92.dist-info → shancx-1.9.33.218.dist-info}/METADATA +15 -5
  85. shancx-1.9.33.218.dist-info/RECORD +91 -0
  86. {shancx-1.8.92.dist-info → shancx-1.9.33.218.dist-info}/WHEEL +1 -1
  87. my_timer_decorator/__init__.py +0 -10
  88. shancx/Dsalgor/__init__.py +0 -19
  89. shancx/E/DFGRRIB.py +0 -30
  90. shancx/EN/DFGRRIB.py +0 -30
  91. shancx/EN/__init__.py +0 -148
  92. shancx/FileRead.py +0 -44
  93. shancx/Gray2RGB.py +0 -86
  94. shancx/M/__init__.py +0 -137
  95. shancx/MN/__init__.py +0 -133
  96. shancx/N/__init__.py +0 -131
  97. shancx/Plot/draw_day_CR_PNGUS.py +0 -206
  98. shancx/Plot/draw_day_CR_SVG.py +0 -275
  99. shancx/Plot/draw_day_pre_PNGUS.py +0 -205
  100. shancx/Plot/glob_nation_map.py +0 -116
  101. shancx/Plot/radar_nmc.py +0 -61
  102. shancx/Plot/radar_nmc_china_map_compare1.py +0 -50
  103. shancx/Plot/radar_nmc_china_map_f.py +0 -121
  104. shancx/Plot/radar_nmc_us_map_f.py +0 -128
  105. shancx/Plot/subplots_compare_devlop.py +0 -36
  106. shancx/Plot/subplots_single_china_map.py +0 -45
  107. shancx/S/__init__.py +0 -138
  108. shancx/W/__init__.py +0 -132
  109. shancx/WN/__init__.py +0 -132
  110. shancx/code.py +0 -331
  111. shancx/draw_day_CR_PNG.py +0 -200
  112. shancx/draw_day_CR_PNGUS.py +0 -206
  113. shancx/draw_day_CR_SVG.py +0 -275
  114. shancx/draw_day_pre_PNGUS.py +0 -205
  115. shancx/makenetCDFN.py +0 -42
  116. shancx/mkIMGSCX.py +0 -92
  117. shancx/netCDF.py +0 -130
  118. shancx/radar_nmc_china_map_compare1.py +0 -50
  119. shancx/radar_nmc_china_map_f.py +0 -125
  120. shancx/radar_nmc_us_map_f.py +0 -67
  121. shancx/subplots_compare_devlop.py +0 -36
  122. shancx/tool.py +0 -18
  123. shancx/user/H8mess.py +0 -317
  124. shancx/user/__init__.py +0 -137
  125. shancx/user/cinradHJN.py +0 -496
  126. shancx/user/examMeso.py +0 -293
  127. shancx/user/hjnDAAS.py +0 -26
  128. shancx/user/hjnFTP.py +0 -81
  129. shancx/user/hjnGIS.py +0 -320
  130. shancx/user/hjnGPU.py +0 -21
  131. shancx/user/hjnIDW.py +0 -68
  132. shancx/user/hjnKDTree.py +0 -75
  133. shancx/user/hjnLAPSTransform.py +0 -47
  134. shancx/user/hjnMiscellaneous.py +0 -182
  135. shancx/user/hjnProj.py +0 -162
  136. shancx/user/inotify.py +0 -41
  137. shancx/user/matplotlibMess.py +0 -87
  138. shancx/user/mkNCHJN.py +0 -623
  139. shancx/user/newTypeRadar.py +0 -492
  140. shancx/user/test.py +0 -6
  141. shancx/user/tlogP.py +0 -129
  142. shancx/util_log.py +0 -33
  143. shancx/wtx/H8mess.py +0 -315
  144. shancx/wtx/__init__.py +0 -151
  145. shancx/wtx/cinradHJN.py +0 -496
  146. shancx/wtx/colormap.py +0 -64
  147. shancx/wtx/examMeso.py +0 -298
  148. shancx/wtx/hjnDAAS.py +0 -26
  149. shancx/wtx/hjnFTP.py +0 -81
  150. shancx/wtx/hjnGIS.py +0 -330
  151. shancx/wtx/hjnGPU.py +0 -21
  152. shancx/wtx/hjnIDW.py +0 -68
  153. shancx/wtx/hjnKDTree.py +0 -75
  154. shancx/wtx/hjnLAPSTransform.py +0 -47
  155. shancx/wtx/hjnLog.py +0 -78
  156. shancx/wtx/hjnMiscellaneous.py +0 -201
  157. shancx/wtx/hjnProj.py +0 -161
  158. shancx/wtx/inotify.py +0 -41
  159. shancx/wtx/matplotlibMess.py +0 -87
  160. shancx/wtx/mkNCHJN.py +0 -613
  161. shancx/wtx/newTypeRadar.py +0 -492
  162. shancx/wtx/test.py +0 -6
  163. shancx/wtx/tlogP.py +0 -129
  164. shancx-1.8.92.dist-info/RECORD +0 -99
  165. /shancx/{Dsalgor → Algo}/dsalgor.py +0 -0
  166. {shancx-1.8.92.dist-info → shancx-1.9.33.218.dist-info}/top_level.txt +0 -0
shancx/wait.py ADDED
@@ -0,0 +1,246 @@
1
+ import os
2
+ import time
3
+ import asyncio
4
+ import threading
5
+ import logging
6
+ from typing import Union, Literal
7
+ import traceback
8
+ import netCDF4 as nc
9
+ from shancx.NN import setlogger
10
+ logger = setlogger(level=logging.INFO)
11
+ def smart_wait(
12
+ path: str,
13
+ timeout: Union[int, float] = 300,
14
+ mode: Literal['auto', 'polling', 'async'] = 'auto',
15
+ debug: bool = False
16
+ ) -> bool:
17
+ """
18
+ 智能文件等待方案(自动选择最优策略)
19
+ Args:
20
+ path: 要监控的文件路径
21
+ timeout: 最大等待时间(秒)
22
+ mode: 运行模式,可选:
23
+ - 'auto':自动选择(默认)
24
+ - 'polling':指数退避轮询
25
+ - 'async':异步协程模式
26
+ debug: 调试模式(立即返回当前状态)
27
+ """
28
+ if timeout <= 0:
29
+ raise ValueError("Timeout must be positive")
30
+ if debug:
31
+ return _immediate_check(path)
32
+ if mode == 'auto':
33
+ mode = 'async' if timeout > 60 else 'polling'
34
+ try:
35
+ if mode == 'async':
36
+ return asyncio.run(_async_wait(path, timeout))
37
+ elif mode == 'polling':
38
+ return _polling_wait(path, timeout)
39
+ else:
40
+ raise ValueError(f"Invalid mode: {mode}")
41
+ except Exception as e:
42
+ logger.error(f"Smart wait failed: {str(e)}")
43
+ return False
44
+ def _immediate_check(path: str) -> bool:
45
+ if not os.path.exists(path):
46
+ logger.info(f"[DEBUG] File not exists: {path}")
47
+ return False
48
+ try:
49
+ if path.lower().endswith('.nc'):
50
+ with nc.Dataset(path) as ds:
51
+ if not ds.variables:
52
+ logger.info(f"[DEBUG] Empty NetCDF: {path}")
53
+ return False
54
+ logger.info(f"[DEBUG] File valid: {path}")
55
+ return True
56
+ except Exception as e:
57
+ logger.info(f"[DEBUG] Invalid file {path}: {str(e)}")
58
+ logger.info(f"DEBUG {path} is missing")
59
+ return False
60
+
61
+ async def _async_wait(path: str, timeout: Union[int, float]) -> bool:
62
+ async def _check():
63
+ logger.info(f"_async_wait {path} {timeout}")
64
+ while True:
65
+ if os.path.exists(path):
66
+ try:
67
+ if path.lower().endswith('.nc'):
68
+ with nc.Dataset(path) as ds:
69
+ print(ds)
70
+ if ds.variables:
71
+ logger.info(f"_async_wait {path} waited ")
72
+ return True
73
+ else:
74
+ logger.info(f"_async_wait {path} waited ")
75
+ return True
76
+ except Exception:
77
+ # return False
78
+ pass
79
+ await asyncio.sleep(1)
80
+ try:
81
+ return await asyncio.wait_for(_check(), timeout)
82
+ except asyncio.TimeoutError:
83
+ logger.info(f"_async_wait {path} is missing")
84
+ return False
85
+
86
+ def _polling_wait(path: str, timeout: Union[int, float]) -> bool:
87
+ logger.info(f"_polling_wait {path} {timeout}")
88
+ wait_sec = 1
89
+ start_time = time.time()
90
+ while (time.time() - start_time) < timeout:
91
+ if os.path.exists(path):
92
+ try:
93
+ if path.lower().endswith('.nc'):
94
+ with nc.Dataset(path) as ds:
95
+ if ds.variables:
96
+ logger.info(f"_polling_wait {path} waited ")
97
+ return True
98
+ else:
99
+ logger.info(f"_polling_wait {path} waited ")
100
+ return True
101
+ except Exception as e:
102
+ logger.warning(f"File validation failed: {str(e)}")
103
+ elapsed = time.time() - start_time
104
+ remaining = timeout - elapsed
105
+ next_wait = min(wait_sec, remaining)
106
+ if next_wait <= 0:
107
+ break
108
+ time.sleep(next_wait)
109
+ wait_sec = min(wait_sec * 2, 60) # 上限60秒
110
+ logger.info(f"_polling_wait {path} is missing")
111
+ return False
112
+
113
+ """
114
+ # 基本用法(自动选择最佳模式)
115
+ success = smart_wait("/data/sample.nc", timeout=120,mode="async")
116
+ 1. flag = smart_wait(path, timeout=60,mode="async")
117
+ 2.flag = True if os.path.exists(path) else smart_wait(path, timeout=60,mode="async")
118
+
119
+ # 强制使用watchdog模式
120
+ success = smart_wait("/data/sample.nc", mode='watchdog')
121
+
122
+ # 调试模式
123
+ print(smart_wait("/data/sample.nc", debug=True))
124
+
125
+ """
126
+ import time
127
+ from typing import List, Optional
128
+ import glob
129
+ def waitFiles(pattern,next=180,interval=5,alls = 1) -> Optional[List[str]]:
130
+ logger.info(f"_polling_wait {pattern} waiting {next} ")
131
+ for _ in range(next):
132
+ if files := glob.glob(pattern):
133
+ if len(files)>alls:
134
+ logger.info(f"_polling_wait {files[0]} waited ")
135
+ return files
136
+ else:
137
+ time.sleep(interval)
138
+ continue
139
+ return None
140
+
141
+ """
142
+ waitFiles(pattern,timeout=180,interval=5)
143
+ """
144
+
145
+ import time, glob, os
146
+ from typing import Optional, Tuple, List
147
+ def checkSize(pattern: str,size_mb: float = 50.0,timeout: int = 180,interval: int = 5) -> Optional[List[str]]:
148
+ size = size_mb * 1024 * 1024
149
+ logger.info(f"_polling_wait {pattern} waiting {timeout} size {size}")
150
+ for _ in range(timeout // interval):
151
+ if files := [f for f in glob.glob(pattern) if os.path.isfile(f)]:
152
+ if large := [f for f in files if os.path.getsize(f) > size]:
153
+ return large
154
+ time.sleep(interval)
155
+ return None
156
+ """
157
+ checkSize(pattern: str,size_mb: float = 50.0,timeout: int = 180,interval: int = 5)
158
+ """
159
+
160
+ import os
161
+ import time
162
+ def is_process_alive(pid):
163
+ try:
164
+ os.kill(pid, 0)
165
+ return True
166
+ except OSError:
167
+ return False
168
+ def check_lock(lock_file):
169
+ if not os.path.exists(lock_file):
170
+ return False
171
+ try:
172
+ with open(lock_file, 'r') as f:
173
+ content = f.read().strip()
174
+ if 'process_id:' in content and 'create_time:' in content:
175
+ pid_str = content.split('process_id:')[1].split(',')[0]
176
+ pid = int(pid_str)
177
+ if not is_process_alive(pid):
178
+ print(f"进程 {pid} 已消亡,清理锁文件")
179
+ os.remove(lock_file)
180
+ return False
181
+ else:
182
+ print(f"进程 {pid} 仍在运行,跳过执行")
183
+ return True
184
+ except Exception as e:
185
+ print(f"锁文件解析错误,清理: {e}")
186
+ os.remove(lock_file)
187
+ return False
188
+ return False
189
+ """
190
+ if check_lock(lock_file):
191
+ return False
192
+ """
193
+
194
+ import numpy as np
195
+ from typing import Union
196
+ def check_nans(data=None, threshold= 0.5) -> bool:
197
+ if not isinstance(data, np.ndarray):
198
+ try:
199
+ data = data.cpu().numpy()
200
+ except RuntimeError as e:
201
+ logger.info(f"Tensor转换失败: {str(e)}")
202
+ return False
203
+ elif not isinstance(data, np.ndarray):
204
+ return False
205
+ if data.ndim == 2:
206
+ data = data[np.newaxis, ...]
207
+ elif data.ndim != 3:
208
+ return False
209
+ try:
210
+ return any(
211
+ (nan_ratio := np.isnan(channel).mean()) > threshold
212
+ and (logger.warning(f"Channel {i} exceeds threshold: {nan_ratio:.4%} > {threshold:.4%}") or True)
213
+ for i, channel in enumerate(data)
214
+ )
215
+ except Exception as e:
216
+ logger.info(f"NaN检查出错: {str(e)}")
217
+ logger.info(traceback.format_exc())
218
+ return False
219
+ """
220
+ flagnan = check_nans(satdata,threshold=0)
221
+ if flagnan:
222
+ # plotA2b(satdata[:3],satdata[3:])
223
+ radio = np.isnan(satdata).sum()/satdata.size
224
+ if radio>0.0001 and radio <0.01:
225
+ plotA2b(satdata[:3],satdata[3:],saveDir="plotA2bN")
226
+ return
227
+ """
228
+
229
+ import time
230
+ import shutil
231
+ import traceback
232
+ def safe_delete(path_pattern):
233
+ for path in glob.glob(path_pattern):
234
+ try:
235
+ if os.path.isfile(path):
236
+ os.remove(path)
237
+ elif os.path.isdir(path):
238
+ shutil.rmtree(path)
239
+ except Exception as e:
240
+ print(traceback.format_exc())
241
+ logger.warning(f"删除失败 {path}: {e}")
242
+ """
243
+ if os.path.exists(zip_file):
244
+ safe_delete(zip_file)
245
+ """
246
+
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: shancx
3
- Version: 1.8.92
3
+ Version: 1.9.33.218
4
4
  Summary: A simple timer decorator
5
5
  Home-page: https://gitee.com/shancx
6
6
  Author: shancx
@@ -10,14 +10,24 @@ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.6
12
12
  Description-Content-Type: text/markdown
13
- Requires-Dist: numpy >=0
13
+ Requires-Dist: tqdm
14
+ Requires-Dist: pandas
15
+ Requires-Dist: matplotlib
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: requires-dist
23
+ Dynamic: requires-python
24
+ Dynamic: summary
14
25
 
15
- # My Timer Decorator
26
+ # Welecome to shancx
16
27
 
17
28
  A simple Python package that provides a timer decorator to measure the execution time of functions.
18
29
 
19
30
  ## Installation
20
-
21
31
 
22
32
  pip install shancx
23
33
 
@@ -0,0 +1,91 @@
1
+ shancx/Cmd.py,sha256=FjbNHOAp9g6Y0BHr4R5f9PxqfK9BaHqNrWzdyL87CdU,4860
2
+ shancx/Config_.py,sha256=CgkvFXXDwuXgyHDrNWkvlOY7rNRQ-dMaDvcUouBJ9y0,733
3
+ shancx/Inst.py,sha256=Q8dULK2djqBU0JFyhMAf1mhWzFDwx9SaAJuTIO0AWig,751
4
+ shancx/Lib.py,sha256=GUAspllSxk39mvj-F1Q8Ys0EcY_lQfZPRGPE7L3x4SE,977
5
+ shancx/Path1.py,sha256=vX4A5RgdwVyIVVNZRocl18rOu1Z8YMLfDb0B92-0bE8,5334
6
+ shancx/Point.py,sha256=gyIomOVbNoz6SOcAhhTS26NHBeJ0TOwB-ljNsBWN1ZE,1909
7
+ shancx/QC.py,sha256=MFxbPMEwrnk5l0sTFMrx13wPlXJ5WI5TovzaiBoEr0E,9848
8
+ shancx/Read.py,sha256=x0nMlTXhxb5utkr9Tn9Aawz32m-dmLUXpG2HM9KywtI,2924
9
+ shancx/Resize.py,sha256=uwiOhD-aWPDLvIwOYEX-XXN_suOXv6hPDcaGyr4JLC4,4044
10
+ shancx/ZR.py,sha256=5APchqVoI1G2MkrN9YJSWCwfLUygcSFIsUXSo9aq1Qg,341
11
+ shancx/__init__.py,sha256=6sfiHElECqfy5eEEGqaCAw4YiKxgKfJ5IFFh9yvtewk,11442
12
+ shancx/args.py,sha256=Nr80vgQpT3m31_crKGf5DvofCxyERJFbqJ1sHb1BIqs,1042
13
+ shancx/bak.py,sha256=SvxKomcukMkWvOlBil77AP0BWcrPNdkz2H3DoFOWLw0,26640
14
+ shancx/cmp.py,sha256=cIQv-QTl-22FJa6tmHyBu_IQmMq5LnsQGGFK5jc5hMA,893
15
+ shancx/df2database.py,sha256=h9_n9tZBWKyGKnpGPRHPSZgMn5kylX0sV5APwmi2SHM,3315
16
+ shancx/geosProj.py,sha256=JMmtj3kV8rtFkKbmwvTKuDWlC8AkgLG8JvCPzkn8Dfs,2685
17
+ shancx/getResponse.py,sha256=QmJfa4czGCOiKb8RuCLXKE7AAKVADAptNiwn7v1tfbM,1055
18
+ shancx/info.py,sha256=0rk_L8Z5uj9RliaZrzT-CArH9ZObmdmcp-1RxAItL08,1122
19
+ shancx/netdfJU.py,sha256=96KR9NMLr2Kcs_OOMpX7QPujdWUj0GCEUIZ7_4_pBxw,7741
20
+ shancx/sendM.py,sha256=CEpeHavseWILlfevhfOMYxYUIWhh4fCNkXGRsEjMxBE,3352
21
+ shancx/wait.py,sha256=OgT9JmEgMH7d3ir3TEksx0_Kyl_S4bkOKl50jvVpdFA,8575
22
+ shancx/3D/__init__.py,sha256=pDFvW1OOEW-ueXH50NJIYdWlySHZU6sr5htzHUSeROo,1000
23
+ shancx/Algo/Class.py,sha256=bxJ9JhIjoxl0hJfjO126YrnyHWDpxCEAZ7qcPs0Y0ic,377
24
+ shancx/Algo/CudaPrefetcher1.py,sha256=mUVlS3txsriET26ZMZ6DYOnyzWr8Tz6wThifzWrC7k8,3951
25
+ shancx/Algo/Fake_image.py,sha256=PEha7w0mMVEOodcAXEGNv_FvrWUipsqAJPkhTYDk6l4,1264
26
+ shancx/Algo/Hsml.py,sha256=GzAMS30DxJm8_y8lq8bk-6F_3_Xah4eHdLqHuZQWenw,16874
27
+ shancx/Algo/L2Loss.py,sha256=m68uMLLUfgvP066_gKaKvjWGmLTlbHQwGAKUmzIt4qQ,261
28
+ shancx/Algo/MetricTracker.py,sha256=shXN8OUsmbFIAX0aC5hgf-hMuX5Jts3ebAbjYDgmce0,4268
29
+ shancx/Algo/Normalize.py,sha256=arUrZ6d4L2DiJRSsefpAe3wvkeVICvvnJ6RbvMoyIDE,3191
30
+ shancx/Algo/OptimizerWScheduler.py,sha256=oC7OmYCuYfVRVSzP2-zPvHB7lgmE4UuAUhdBPob87H0,1529
31
+ shancx/Algo/Rmageresize.py,sha256=TQfVLnCLJYSLC88dI7x6IZJJv43s1zJYE9HzCZpPb0M,2979
32
+ shancx/Algo/Savemodel.py,sha256=l4XfuNJ4WMfVy8qalH8AhtR3RsQmZfpJF53zIwQxrUs,1009
33
+ shancx/Algo/SmoothL1_losses.py,sha256=P7YpSjrlIhyVgBxyxDxehuVtTbffbbrnKmuZ-Po-UvE,1056
34
+ shancx/Algo/Tqdm.py,sha256=JZz8SwqQjql4eT0GUmFX6xAwLNEx1YwpGM2hL1LDyk8,2707
35
+ shancx/Algo/__init__.py,sha256=05Kzre38HFbhmqdj-U1W3m_lc8pkUypaEhgh3UjVAmg,4466
36
+ shancx/Algo/checknan.py,sha256=Oi7yU-UTSQgE4tgvuXTdgPmhlaus6G7gB2suaV7QgeQ,1188
37
+ shancx/Algo/dsalgor.py,sha256=jNlD8TJuAOKT6H_8xc-l8sI-mXf8upemeA7Jpf5Eftk,398
38
+ shancx/Algo/iouJU.py,sha256=pZYQ-KPE-hgsuPUL0KxZZcuemDCt_LWAyw9GuKgvZNE,3602
39
+ shancx/Algo/mask.py,sha256=Dx7mLfcfEDIudu-DzdowFGoS1D3IxLHC8Mtw_kAen4w,1060
40
+ shancx/Algo/psnr.py,sha256=mrepcNyWTdB5UrHXZpSvyLsbZ-i_evyZtAmk3mIOwT8,267
41
+ shancx/Algo/ssim.py,sha256=eW_RXovDhVvwvFg2kEG_Xd3SasGKQt5BpQr6yNOiepk,2896
42
+ shancx/Algo/structural_similarity.py,sha256=zc4wjCKVkkDgySneB1uPuBWu-9KVD5TXPLubXKhMR7o,10204
43
+ shancx/Algo/tool.py,sha256=NpSoeX0r61k7_iBlMYCTv1IfcZQZv1sFecxJk_afa0g,26690
44
+ shancx/Calmetrics/__init__.py,sha256=hnahHA7FxxmCvd6X5Buu2MSSbwagaUDgNnjkxeGBL14,3104
45
+ shancx/Calmetrics/calmetrics.py,sha256=O_0aCoGh1n4b6lyBP9iX_qMu_-GxQ66Ky0aDgx4JtgI,498
46
+ shancx/Calmetrics/calmetricsmatrixLib.py,sha256=MO1E04hBjZZ93Uzlgth6ilNwmY666cjFR9SwOM6YN4I,6749
47
+ shancx/Calmetrics/rmseR2score.py,sha256=MOK6RKW4nxBjdna8dy8vHm9wncrzjEDvb7BLSUhhoHM,1243
48
+ shancx/Clip/__init__.py,sha256=8JDd5X42LfAGVbd0Qk0Z1pXx7Qx3t6drVjoQNlhC8lg,1808
49
+ shancx/Df/DataFrame.py,sha256=KvwKPHmVxFLCPPyfesKjZl-Se1oAdGyLbbJoCjzP4YY,661
50
+ shancx/Df/__init__.py,sha256=FxFvYlgg79eBqaWl_XmDC7Tv5e7wLm0iIPSvz_XgXIY,906
51
+ shancx/Df/tool.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
+ shancx/Diffm/Psamples.py,sha256=9Uu5w-bsBaFvoTH6ZWU-8MOefkLUh6lYzhIlzO9O6D0,662
53
+ shancx/Diffm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
+ shancx/Diffm/test.py,sha256=uRldWrcqiZpHeBY9WD9gtsPsLWobDyt8Y02Zc3q_78o,8180
55
+ shancx/Doc/__init__.py,sha256=nLQzA4V8yA7KvzzVmV00Kfn57PK1bNi9P1EBYcsOHk4,7772
56
+ shancx/E/__init__.py,sha256=UJZugggSzsRkyT3Zi1R-1i-vfD5UnoNoEgCHEiS84bg,5393
57
+ shancx/Fillmiss/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
+ shancx/Fillmiss/imgidwJU.py,sha256=CyP4ZlhPpXPqGVzzcLR7lohVl8bWjEceJLo7yvKgtEM,1708
59
+ shancx/Fillmiss/imgidwLatLonJU.py,sha256=ltYZj9CwN8cVs4Kow64oVN1EiBERgW9FceTUBFkCOAs,4314
60
+ shancx/Gpu/__init__.py,sha256=4Ahq04phTGVlFWN9Vih0WAh-IqFrhtwM5hj4G1IU2Dk,1950
61
+ shancx/H9/__init__.py,sha256=FCarcXfU2tVD2KrCGKNNUuL51zAWZYHV7lrP7gntvaI,4911
62
+ shancx/H9/ahi_read_hsd.py,sha256=bt9oOOARcXijmyGpmHYXj0NKnuTntZjqx0_tu6Vp2vs,33522
63
+ shancx/H9/ahisearchtable.py,sha256=e2kpz-P5npgL4gzNxn8igERJuWWIysvTNLkptr5_Zcc,9579
64
+ shancx/H9/geometry.py,sha256=ZoCfgP07ANqDxyLf8uFN016DPl7QqW9pAV3sr2ekCng,95893
65
+ shancx/Hug/__init__.py,sha256=NvcqXM0CSwXYtTr5yj4zfkag_7PZcI5tCsIHjuLNXTQ,3040
66
+ shancx/Mos/__init__.py,sha256=IDlCLNN6a_mguYmRcAPcevHSDaud5ZhvYNSuASqztcE,1563
67
+ shancx/NN/__init__.py,sha256=ENgZxIzUJzkuxArkcH-1JlxQA08Urq2ppFkGCbIURZk,9219
68
+ shancx/Plot/GlobMap.py,sha256=WRvZOf5bo8IfECk1-sN4g6K0CrcJhSoEJAiLvZAWDwg,13021
69
+ shancx/Plot/Gray2RGB.py,sha256=yDXu1xWVi7OtrS8_ExxK_ev1988kj1ZxoNCWf-kl4Zc,2734
70
+ shancx/Plot/__init__.py,sha256=_fmDFZfh9HzDPBPKCMPrDT2DsblLVfrO-uFvUg76a74,19194
71
+ shancx/Plot/draw_day_CR_PNG.py,sha256=ftOYdk80Xmry_H1uaypjrTUA0mJZBV7EGt5T7JfVg0E,7267
72
+ shancx/Plot/exam.py,sha256=XXyBQp1Eb1siNiu7FY8ACiWH0g43ZSLTOGLqs3aKomE,3966
73
+ shancx/Plot/plotGlobal.py,sha256=B2887VhMop6B3jEg7zD7ADlyIbKfyUOKffSJ2oEmEbo,15270
74
+ shancx/Plot/radarNmc.py,sha256=ixmoDaoT6whmmrv4wD4p7H_DiNsyOEb2tUoz2KQgDeM,1273
75
+ shancx/Plot/single_china_map.py,sha256=cRmZW6TtLBwLb-Y3syim_K1jM350CmB5zkK1nrAcaRQ,2116
76
+ shancx/RdPzl/__init__.py,sha256=I5Isz3KfDgFZAdlRk4D-Hvp-8xH4F2Dl0XGxYGzUcKc,1166
77
+ shancx/SN/__init__.py,sha256=6BOmiKkAEeFPpDhMYo0Kpp8PvVn4XCpQ0qF0fQM0sls,2786
78
+ shancx/Time/GetTime.py,sha256=lFdjKpFHxOgvyCUzeGi8MrGUIEPrGzcaRX3CVZi8B4o,1262
79
+ shancx/Time/__init__.py,sha256=ftYQdlJotvBYGtMWtTnooUBJOvjNOsFJ9i5ACFTjtDU,3826
80
+ shancx/Time/timeCycle.py,sha256=YD_r-pS7uIR2ZqNIzZtEWTD_mUPu5vBHJSZiFh8fNgg,9959
81
+ shancx/Time/tool.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
+ shancx/Train/__init__.py,sha256=clWzZpsVEhJqEvRCDCEn3tZxrG-wf-BiiCsGvTTGR6I,2379
83
+ shancx/Train/makelist.py,sha256=0NTU4mUqvUJUT496mROorLAmUTIVSsn9k1LQWYL_vEA,6871
84
+ shancx/Train/multiGpu.py,sha256=D_oZeiSc7VWktpnVDwrFOC1CYZSt9rxOKY5lngE5vFg,820
85
+ shancx/Train/prepare.py,sha256=vL_8UOA66oZCBIwCICtihsGibivtNgaVJGulJxfNdn8,6793
86
+ shancx/Train/renet50.py,sha256=wEhYk1X96WE5zuqHqVxWLJa-A5jDNkz4z6edORNufnA,6428
87
+ shancx/tensBoard/__init__.py,sha256=ga2C5YyJITvvQA1ocpxna_KNFnNRJVwkTjLoIglLZUQ,993
88
+ shancx-1.9.33.218.dist-info/METADATA,sha256=EbrBBFNqDUpu1A02IPoPAi9kDXpSeDHK_lN8P911HFg,850
89
+ shancx-1.9.33.218.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
90
+ shancx-1.9.33.218.dist-info/top_level.txt,sha256=akfCS1vKWz3pNmEN_yN9ZiGp-60IQY5ET38mRx_i_-4,7
91
+ shancx-1.9.33.218.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- import time
2
-
3
- def timer_decorator(func):
4
- def wrapper(*args, **kwargs):
5
- start_time = time.time()
6
- result = func(*args, **kwargs)
7
- end_time = time.time()
8
- print(f"{func.__name__} took {end_time - start_time:.4f} seconds")
9
- return result
10
- return wrapper
@@ -1,19 +0,0 @@
1
- #!/usr/bin/python
2
- # -*- coding: utf-8 -*-
3
- # @Time : 2024/10/17 上午午10:40
4
- # @Author : shancx
5
- # @File : __init__.py
6
- # @email : shanhe12@163.com
7
-
8
- def quick_sort(arr):
9
- if len(arr) <= 1:
10
- return arr
11
- pivot = arr[len(arr) // 2]
12
- left = [x for x in arr if x < pivot]
13
- middle = [x for x in arr if x == pivot]
14
- right = [x for x in arr if x > pivot]
15
- return quick_sort(left) + middle + quick_sort(right)
16
-
17
- def sort_dict_by_key(d):
18
- sorted_dict = {key: d[key] for key in sorted(d.keys())}
19
- return sorted_dict
shancx/E/DFGRRIB.py DELETED
@@ -1,30 +0,0 @@
1
-
2
- from hjnwtx.examMeso import getPointIdx
3
- import numpy as np
4
- class envelope():
5
- def __init__(self,n,s,w,e):
6
- self.n,self.s,self.w,self.e=n,s,w,e
7
- def __str__(self):
8
- return ("n:%s,s:%s,w:%s,e:%s"%(self.n,self.s,self.w,self.e))
9
-
10
- def cropDF(df,evn):
11
- return df[(df["Lat"]>evn.s)&(df["Lat"]<evn.n)&(df["Lon"]>evn.w)&(df["Lon"]<evn.e)]
12
-
13
- def DFGTORIB(df_Station,col_flg = "PRE1",env_Range=[85.05112877980659, -85.09887122019342,-179.56702040954826,179.63297959045173],shape_v =[3404,7186] ):
14
- """
15
- 将数据框 df_Station 中的某列数据转化为一个 NumPy 数组。
16
- 参数:
17
- - df_Station (pd.DataFrame): 包含气象数据的 pandas 数据框。
18
- - shape_v (list): 输出数组的形状,默认为 [3404, 7186]。
19
- - col_flg (str): 指定的数据列名称,默认为 "PRE1"。
20
- 返回:
21
- - CHNMAt (np.ndarray): 具有指定形状的 NumPy 数组,表示数据的矩阵。
22
- """
23
-
24
- env_Range = envelope(env_Range[0],env_Range[1],env_Range[2],env_Range[3])
25
- df_Station_C = cropDF(df_Station, env_Range)
26
- df_Station_C = df_Station_C[df_Station_C[f"{col_flg}"]<9999]
27
- CHNMAt = np.full(shape_v,np.nan)
28
- latIdx, lonIdx = getPointIdx(df_Station_C, env_Range.n,env_Range.w, 0.05)
29
- CHNMAt[latIdx,lonIdx] = df_Station_C[f"{col_flg}"]
30
- return CHNMAt
shancx/EN/DFGRRIB.py DELETED
@@ -1,30 +0,0 @@
1
-
2
- from hjnwtx.examMeso import getPointIdx
3
- import numpy as np
4
- class envelope():
5
- def __init__(self,n,s,w,e):
6
- self.n,self.s,self.w,self.e=n,s,w,e
7
- def __str__(self):
8
- return ("n:%s,s:%s,w:%s,e:%s"%(self.n,self.s,self.w,self.e))
9
-
10
- def cropDF(df,evn):
11
- return df[(df["Lat"]>evn.s)&(df["Lat"]<evn.n)&(df["Lon"]>evn.w)&(df["Lon"]<evn.e)]
12
-
13
- def DFGTORIB(df_Station,col_flg = "PRE1",env_Range=[85.05112877980659, -85.09887122019342,-179.56702040954826,179.63297959045173],shape_v =[3404,7186] ):
14
- """
15
- 将数据框 df_Station 中的某列数据转化为一个 NumPy 数组。
16
- 参数:
17
- - df_Station (pd.DataFrame): 包含气象数据的 pandas 数据框。
18
- - shape_v (list): 输出数组的形状,默认为 [3404, 7186]。
19
- - col_flg (str): 指定的数据列名称,默认为 "PRE1"。
20
- 返回:
21
- - CHNMAt (np.ndarray): 具有指定形状的 NumPy 数组,表示数据的矩阵。
22
- """
23
-
24
- env_Range = envelope(env_Range[0],env_Range[1],env_Range[2],env_Range[3])
25
- df_Station_C = cropDF(df_Station, env_Range)
26
- df_Station_C = df_Station_C[df_Station_C[f"{col_flg}"]<9999]
27
- CHNMAt = np.full(shape_v,np.nan)
28
- latIdx, lonIdx = getPointIdx(df_Station_C, env_Range.n,env_Range.w, 0.05)
29
- CHNMAt[latIdx,lonIdx] = df_Station_C[f"{col_flg}"]
30
- return CHNMAt
shancx/EN/__init__.py DELETED
@@ -1,148 +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
- __author_email__ = 'shancx@126.com'
10
-
11
- # @Time : 2023/09/27 下午8:52
12
- # @Author : shanchangxi
13
- # @File : util_log.py
14
- import time
15
- import logging
16
- from logging import handlers
17
-
18
- def mkDir(path):
19
- if "." in path:
20
- os.makedirs(os.path.dirname(path),exist_ok=True)
21
- else:
22
- os.makedirs(path, exist_ok=True)
23
-
24
- loggers = logging.getLogger()
25
- loggers.setLevel(logging.INFO)
26
- log_name = './project_E.log'
27
- mkDir(log_name)
28
- logfile = log_name
29
- time_rotating_file_handler = handlers.TimedRotatingFileHandler(filename=logfile, when='D', encoding='utf-8')
30
- time_rotating_file_handler.setLevel(logging.INFO)
31
- formatter = logging.Formatter("%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s")
32
- time_rotating_file_handler.setFormatter(formatter)
33
- loggers.addHandler(time_rotating_file_handler)
34
-
35
- """
36
- import tracback
37
- try:
38
-
39
- except Exception as e:
40
-
41
- logger.info(traceback.format_exc())
42
- """
43
- '''
44
- ##定義一個streamHandler
45
- # print_handler = logging.StreamHandler()
46
- # print_handler.setFormatter(formatter)
47
- # loggers.addHandler(print_handler)
48
- '''
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
- '''
133
-
134
- '''
135
- #!/bin/bash
136
- subject="Daily System Report"
137
- to_email="shanhe12@163.com"
138
- temp_file="/home/scx/logs/111.log" # 替换为日志文件的实际路径
139
- search_terms=("error" "ERROR") # 可以添加多个搜索词
140
- for term in "${search_terms[@]}"; do
141
- if grep -q "$term" "$temp_file"; then
142
- grep "$term" "$temp_file" | mail -s "$subject - $term" "$to_email"
143
- else
144
- echo "No matches found for '$term'." >&2
145
- fi
146
- done
147
-
148
- '''
shancx/FileRead.py DELETED
@@ -1,44 +0,0 @@
1
- import gzip
2
-
3
- with gzip.open(file_path, 'rt') as file:
4
- first_line = file.readline()
5
-
6
- """
7
- CSV
8
-
9
- import gzip
10
- import csv
11
-
12
- with gzip.open(file_path, 'rt') as file:
13
- reader = csv.reader(file)
14
- for row in reader:
15
- print(row)
16
-
17
- XML
18
-
19
- import gzip
20
- import xml.etree.ElementTree as ET
21
-
22
- with gzip.open(file_path, 'rt') as file:
23
- tree = ET.parse(file)
24
- root = tree.getroot()
25
- for child in root:
26
- print(child.tag, child.attrib)
27
-
28
- YAML
29
-
30
- import gzip
31
- import yaml
32
- with gzip.open(file_path, 'rt') as file:
33
- data = yaml.safe_load(file)
34
- print(data)
35
-
36
- TEXT
37
-
38
- import gzip
39
-
40
- with gzip.open(file_path, 'rt') as file:
41
- for line in file:
42
- print(line.strip())
43
-
44
- """