shancx 1.9.33.169__tar.gz → 1.9.33.171__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.
Files changed (94) hide show
  1. {shancx-1.9.33.169 → shancx-1.9.33.171}/PKG-INFO +1 -1
  2. {shancx-1.9.33.169 → shancx-1.9.33.171}/setup.py +1 -1
  3. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/NN/__init__.py +27 -1
  4. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx.egg-info/PKG-INFO +1 -1
  5. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx.egg-info/SOURCES.txt +0 -4
  6. shancx-1.9.33.169/shancx/H9/__init__.py +0 -126
  7. shancx-1.9.33.169/shancx/H9/ahi_read_hsd.py +0 -877
  8. shancx-1.9.33.169/shancx/H9/ahisearchtable.py +0 -298
  9. shancx-1.9.33.169/shancx/H9/geometry.py +0 -2439
  10. {shancx-1.9.33.169 → shancx-1.9.33.171}/README.md +0 -0
  11. {shancx-1.9.33.169 → shancx-1.9.33.171}/setup.cfg +0 -0
  12. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/3D/__init__.py +0 -0
  13. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/Class.py +0 -0
  14. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/CudaPrefetcher1.py +0 -0
  15. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/Fake_image.py +0 -0
  16. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/Hsml.py +0 -0
  17. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/L2Loss.py +0 -0
  18. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/MetricTracker.py +0 -0
  19. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/Normalize.py +0 -0
  20. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/OptimizerWScheduler.py +0 -0
  21. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/Rmageresize.py +0 -0
  22. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/Savemodel.py +0 -0
  23. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/SmoothL1_losses.py +0 -0
  24. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/Tqdm.py +0 -0
  25. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/__init__.py +0 -0
  26. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/checknan.py +0 -0
  27. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/dsalgor.py +0 -0
  28. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/iouJU.py +0 -0
  29. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/mask.py +0 -0
  30. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/psnr.py +0 -0
  31. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/ssim.py +0 -0
  32. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/structural_similarity.py +0 -0
  33. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Algo/tool.py +0 -0
  34. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Calmetrics/__init__.py +0 -0
  35. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Calmetrics/calmetrics.py +0 -0
  36. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Calmetrics/calmetricsmatrixLib.py +0 -0
  37. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Calmetrics/rmseR2score.py +0 -0
  38. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Clip/__init__.py +0 -0
  39. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Cmd.py +0 -0
  40. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Df/DataFrame.py +0 -0
  41. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Df/__init__.py +0 -0
  42. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Df/tool.py +0 -0
  43. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Diffm/Psamples.py +0 -0
  44. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Diffm/__init__.py +0 -0
  45. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Diffm/test.py +0 -0
  46. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Doc/__init__.py +0 -0
  47. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/E/__init__.py +0 -0
  48. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Fillmiss/__init__.py +0 -0
  49. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Fillmiss/imgidwJU.py +0 -0
  50. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Fillmiss/imgidwLatLonJU.py +0 -0
  51. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Gpu/__init__.py +0 -0
  52. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Hug/__init__.py +0 -0
  53. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Inst.py +0 -0
  54. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Lib.py +0 -0
  55. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Mos/__init__.py +0 -0
  56. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Path1.py +0 -0
  57. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Plot/GlobMap.py +0 -0
  58. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Plot/Gray2RGB.py +0 -0
  59. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Plot/__init__.py +0 -0
  60. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Plot/border.py +0 -0
  61. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Plot/draw_day_CR_PNG.py +0 -0
  62. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Plot/exam.py +0 -0
  63. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Plot/radarNmc.py +0 -0
  64. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Plot/single_china_map.py +0 -0
  65. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Point.py +0 -0
  66. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/QC.py +0 -0
  67. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/RdPzl/__init__.py +0 -0
  68. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Read.py +0 -0
  69. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/SN/__init__.py +0 -0
  70. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Time/GetTime.py +0 -0
  71. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Time/__init__.py +0 -0
  72. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Time/timeCycle.py +0 -0
  73. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Time/tool.py +0 -0
  74. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Train/__init__.py +0 -0
  75. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Train/makelist.py +0 -0
  76. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Train/multiGpu.py +0 -0
  77. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Train/prepare.py +0 -0
  78. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/Train/renet50.py +0 -0
  79. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/ZR.py +0 -0
  80. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/__init__.py +0 -0
  81. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/args.py +0 -0
  82. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/bak.py +0 -0
  83. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/cmp.py +0 -0
  84. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/df2database.py +0 -0
  85. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/getResponse.py +0 -0
  86. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/info.py +0 -0
  87. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/netdfJU.py +0 -0
  88. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/sendM.py +0 -0
  89. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/tensBoard/__init__.py +0 -0
  90. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/tool.py +0 -0
  91. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx/wait.py +0 -0
  92. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx.egg-info/dependency_links.txt +0 -0
  93. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx.egg-info/requires.txt +0 -0
  94. {shancx-1.9.33.169 → shancx-1.9.33.171}/shancx.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: shancx
3
- Version: 1.9.33.169
3
+ Version: 1.9.33.171
4
4
  Summary: A simple timer decorator
5
5
  Home-page: https://gitee.com/shancx
6
6
  Author: shancx
@@ -3,7 +3,7 @@
3
3
  from setuptools import setup, find_packages
4
4
  setup(
5
5
  name="shancx",
6
- version="1.9.33.169",
6
+ version="1.9.33.171",
7
7
  packages=find_packages(),
8
8
  description="A simple timer decorator",
9
9
  long_description=open("README.md").read(),
@@ -15,7 +15,7 @@ import logging
15
15
  from logging.handlers import RotatingFileHandler
16
16
  import os
17
17
  from shancx import crDir
18
- def _loggers(logger_name="loggers", root="./logs", phase="project", level=logging.INFO, screen=True, max_bytes=10*1024*1024, backup_count=5, overwrite=False,handlersflag=True):
18
+ def _loggers(logger_name="loggers", root="./logs", phase="project", level=logging.INFO, screen=True, max_bytes=10*1024*1024, backup_count=5, overwrite=False,handlersflag=False):
19
19
  '''set up logger with rotating file handler'''
20
20
  l = logging.getLogger(logger_name)
21
21
  if handlersflag:
@@ -64,6 +64,32 @@ if __name__ == "__main__":
64
64
  logger.info("这是一条INFO日志")
65
65
  '''
66
66
 
67
+ from itertools import product
68
+ from concurrent.futures import ProcessPoolExecutor as PoolExecutor, as_completed
69
+ import sys
70
+ from tqdm import tqdm
71
+ def validate_param_list(param_list):
72
+ if len(param_list) == 0:
73
+ raise ValueError("param_list cannot be empty.")
74
+ for sublist in param_list:
75
+ if len(sublist) == 0:
76
+ raise ValueError("Sub-lists in param_list cannot be empty.")
77
+ def Mul_sub(task, param_list, num=6):
78
+ print(f"Pro num {num}")
79
+ validate_param_list(param_list)
80
+ if len(param_list) == 1:
81
+ product_list = [(x,) for x in param_list[0]]
82
+ else:
83
+ product_list = list(product(*param_list))
84
+ with PoolExecutor(max_workers=num) as executor:
85
+ try:
86
+ futures = [executor.submit(task, item) for item in product_list]
87
+ for future in tqdm(as_completed(futures), total=len(futures), desc="Processing tasks", unit="task"):
88
+ future.result()
89
+ except KeyboardInterrupt:
90
+ sys.exit(1)
91
+ print("All tasks completed")
92
+
67
93
  # import os
68
94
  # from datetime import datetime
69
95
  # from shancx.NN import _loggers
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: shancx
3
- Version: 1.9.33.169
3
+ Version: 1.9.33.171
4
4
  Summary: A simple timer decorator
5
5
  Home-page: https://gitee.com/shancx
6
6
  Author: shancx
@@ -64,10 +64,6 @@ shancx/Fillmiss/__init__.py
64
64
  shancx/Fillmiss/imgidwJU.py
65
65
  shancx/Fillmiss/imgidwLatLonJU.py
66
66
  shancx/Gpu/__init__.py
67
- shancx/H9/__init__.py
68
- shancx/H9/ahi_read_hsd.py
69
- shancx/H9/ahisearchtable.py
70
- shancx/H9/geometry.py
71
67
  shancx/Hug/__init__.py
72
68
  shancx/Mos/__init__.py
73
69
  shancx/NN/__init__.py
@@ -1,126 +0,0 @@
1
- from shancx.H9.ahisearchtable import ahisearchtable
2
- from shancx.H9.ahi_read_hsd import ahi_read_hsd
3
- from tqdm import tqdm
4
- import os
5
- import numpy as np
6
- import datetime
7
- import time
8
- import warnings
9
- warnings.filterwarnings("ignore", category=UserWarning)
10
- class AHIScene(ahi_read_hsd, ahisearchtable) :
11
- def __init__(self, subpoint=140.7, resolution=0.02):
12
- super().__init__(subpoint=subpoint, resolution=resolution)
13
- self.Tempfile = []
14
- def hsdBlock(self, srcHSDfiles, tmppath, fillvalue=65535) :
15
- ''' 对H8、H9的HSD文件进行解析、拼接成NOM '''
16
- # HS_H09_20230115_0400_B01_FLDK_R10_S0110.DAT.bz2
17
- BandID, BlockIDMin, BlockIDMax, SegmentTotal = self.setHSDInfo(srcHSDfiles)
18
- outdata = None
19
- BlockIDs = []
20
- with tqdm(total=len(srcHSDfiles), iterable='iterable',
21
- desc = '正在进行第%i波段块合成' %(BandID), mininterval=1) as pbar:
22
- for hsdname in srcHSDfiles :
23
- if not os.path.isfile(hsdname):
24
- print('文件不存在【%s】' %(hsdname))
25
- pbar.update(1)
26
- continue
27
-
28
- # 获取文件名信息
29
- nameinfo = self.getHSDNameInfo(hsdname)
30
- if nameinfo is None :
31
- pbar.update(1)
32
- continue
33
- SegmentNum = nameinfo['SegmemtID']
34
-
35
- # print('正在解压bz2文件【%s】' %(hsdname))
36
- self._unzipped = self.unzip_file(hsdname, tmppath)
37
- if self._unzipped:
38
- self.is_zipped = True
39
- filename = self._unzipped
40
-
41
- self.Tempfile.append(filename)
42
- else:
43
- filename = hsdname
44
-
45
- if filename.endswith('.bz2') :
46
- print('解压bz2文件失败【%s】' %(filename))
47
- pbar.update(1)
48
- continue
49
-
50
- # 根据块号对数据进行拼接
51
- data = self.readhsd(filename, SegmentNum)
52
- if data is None :
53
- pbar.update(1)
54
- continue
55
-
56
- if outdata is None :
57
- line, pixel = data.shape
58
- outdata = np.full(shape=(line*SegmentTotal, pixel),
59
- fill_value=fillvalue, dtype=np.uint16)
60
-
61
- data[np.isnan(data)] = fillvalue/100.0
62
- outdata[(SegmentNum-BlockIDMin)*line:(SegmentNum-BlockIDMin+1)*line, :] \
63
- = np.array(data*100.0, dtype=np.uint16)
64
- BlockIDs.append(SegmentNum)
65
- pbar.update(1)
66
- pbar.close()
67
- self.__del__()
68
- return outdata
69
-
70
- def setHSDInfo(self, filelist):
71
-
72
- BandID = None
73
- BlockIDs = []
74
- for filename in filelist :
75
- nameinfo = self.getHSDNameInfo(filename)
76
- if nameinfo is None :
77
- continue
78
-
79
- if BandID is None :
80
- BandID = nameinfo['BandID']
81
- elif BandID != nameinfo['BandID'] :
82
- raise Exception('输入的文件列表中有多个波段的块数据文件【%s】' %(filename))
83
- BlockIDs.append(nameinfo['SegmemtID'])
84
-
85
- BlockIDMin = np.nanmin(BlockIDs)
86
- BlockIDMax = np.nanmax(BlockIDs)
87
-
88
- SegmentTotal = int(BlockIDMax-BlockIDMin+1)
89
-
90
- return BandID, BlockIDMin, BlockIDMax, SegmentTotal
91
-
92
- def getHSDNameInfo(self, filename):
93
-
94
- basename = os.path.basename(filename)
95
- basename = basename.split('.')[0]
96
- if len(basename) != 39 :
97
- print('非标准文件名,需要输入文件名【HS_H09_YYYYMMDD_HHMM_BXX_FLDK_R20_S0810】')
98
- return None
99
-
100
- nameinfo = {}
101
- namelist = basename.split('_')
102
-
103
- nameinfo['SatID'] = namelist[1]
104
- nameinfo['StartTime'] = datetime.datetime.strptime('%s %s' %(namelist[2], namelist[3]), '%Y%m%d %H%M')
105
- nameinfo['BandID'] = int(namelist[4][1:]) # 2-digit band number (varies from "01" to "16");
106
- nameinfo['ObsType'] = namelist[5]
107
- nameinfo['Resolution'] = float(namelist[6][1:])/10.0/100 # spatial resolution ("05": 0.5km, "10": 1.0km, "20": 2.0km);
108
- nameinfo['SegmemtID'] = int(namelist[7][1:3])
109
- nameinfo['SegmemtTotal'] = int(namelist[7][3:5]) # total number of segments (fixed to "10")
110
-
111
- return nameinfo
112
-
113
- def __del__(self):
114
- # pass
115
- for filename in self.Tempfile :
116
- if os.path.isfile(filename) :
117
- try:
118
- os.remove(filename)
119
- except BaseException as e :
120
- time.sleep(1)
121
- try:
122
- fp = open(filename, 'r')
123
- fp.close()
124
- os.remove(filename)
125
- except BaseException as e :
126
- pass