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
@@ -0,0 +1,298 @@
1
+ # -*- coding:utf-8 -*-
2
+ '''
3
+ @Project : fypy
4
+
5
+ @File : ahisearchtable.py
6
+
7
+ @Modify Time : 2022/11/10 14:45
8
+
9
+ @Author : fypy Team
10
+
11
+ @Version : 1.0
12
+
13
+ @Description :
14
+
15
+ '''
16
+ import os
17
+
18
+ import sys
19
+ import numpy as np
20
+ import datetime
21
+
22
+ # TWOPI = 6.28318530717958648
23
+ # DPAI = 6.28318530717958648
24
+ #
25
+ deg2rad = np.pi / 180.0
26
+ rad2deg = 180.0 / np.pi
27
+
28
+ class ahisearchtable :
29
+
30
+ def __init__(self, subpoint, resolution):
31
+
32
+ self.ea = 6378.137 # 地球长半轴
33
+ self.eb = 6356.7523 # 地球短半轴
34
+ self.H = 42164.0 # 地心到卫星质心的距离
35
+
36
+ self.subpoint = subpoint
37
+ self.resolution = resolution
38
+
39
+ if resolution == 0.0025 : # 250米
40
+ self.coff = 21983.5
41
+ self.cfac = 163730199
42
+ self.loff = 21983.5
43
+ self.lfac = 163730199
44
+ self.rowmax = 44000
45
+ self.colmax = 44000
46
+ elif resolution == 0.005 :
47
+ self.coff = 10991.5
48
+ self.cfac = 81865099
49
+ self.loff = 10991.5
50
+ self.lfac = 81865099
51
+ self.rowmax = 22000
52
+ self.colmax = 22000
53
+ elif resolution == 0.01 :
54
+ self.coff = 5495.5
55
+ self.cfac = 40932549
56
+ self.loff = 5495.5
57
+ self.lfac = 40932549
58
+ self.rowmax = 11000
59
+ self.colmax = 11000
60
+ elif resolution == 0.02 :
61
+ self.coff = 2747.5
62
+ self.cfac = 20466274
63
+ self.loff = 2747.5
64
+ self.lfac = 20466274
65
+ self.rowmax = 5500
66
+ self.colmax = 5500
67
+ else:
68
+ raise Exception("resolution error! please input [0.0025, 0.005, 0.01, 0.02, 0.04]")
69
+
70
+
71
+ self.FLAT = 0.00335281317789691
72
+ self.AE = 6378.137
73
+ self.E2 = 0.0066943800699785
74
+
75
+
76
+ def xy2latlon(self, x, y, fillvalue=65535):
77
+ '''
78
+ 行列号转经纬度
79
+
80
+ Parameters
81
+ ----------
82
+ x: numpy.array
83
+ 列号
84
+ y: numpy.array
85
+ 行号
86
+
87
+ Returns
88
+ -------
89
+ numpy.array
90
+ 返回纬度、经度
91
+ '''
92
+
93
+ row = np.array(y)
94
+ col = np.array(x)
95
+
96
+ fillflag = (row < 0) | (row >= self.rowmax) | (col < 0) | (col >= self.colmax)
97
+
98
+ x = deg2rad * (col - self.coff) / (2**-16 * self.cfac)
99
+ y = deg2rad * (row - self.loff) / (2**-16 * self.lfac)
100
+
101
+ sd = (self.H * np.cos(x) * np.cos(y)) * (self.H * np.cos(x) * np.cos(y)) \
102
+ - (np.cos(y) * np.cos(y) + (self.ea * self.ea) / (self.eb * self.eb) \
103
+ * np.sin(y) * np.sin(y)) * ((self.H * self.H) - self.ea * self.ea)
104
+
105
+ flag = sd < 0
106
+
107
+ sd[sd>=0] = np.sqrt(sd[sd>=0])
108
+
109
+ sn = (self.H * np.cos(x) * np.cos(y) - sd) / \
110
+ (np.cos(y) * np.cos(y) + (self.ea * self.ea) / (self.eb * self.eb) * np.sin(y) * np.sin(y))
111
+
112
+ S1 = self.H - (sn * np.cos(x) * np.cos(y))
113
+ S2 = sn * np.sin(x) * np.cos(y)
114
+ S3 = -sn * np.sin(y)
115
+ Sxy = np.sqrt(S1 * S1 + S2 * S2)
116
+
117
+ lon = rad2deg * np.arctan2(S2 , S1) + self.subpoint
118
+ lat = rad2deg * np.arctan((self.ea * self.ea) / (self.eb * self.eb) * S3 / Sxy)
119
+
120
+ lon[lon > 180] -= 360.0
121
+ lon[lon < -180] += 360.0
122
+
123
+ lon[flag] = fillvalue
124
+ lat[flag] = fillvalue
125
+
126
+ lon[fillflag] = fillvalue
127
+ lat[fillflag] = fillvalue
128
+
129
+ lat = np.array(lat, dtype=np.float32)
130
+ lon = np.array(lon, dtype=np.float32)
131
+
132
+ return lon, lat
133
+
134
+ def latlon2xy(self, lat, lon, fillvalue=65535):
135
+ '''
136
+ 经纬度转行列号
137
+
138
+ Parameters
139
+ ----------
140
+ lat : numpy.array
141
+ 纬度, -90.0 ~ 90.0
142
+ lon : numpy.array
143
+ 经度, -180.0 ~ 180.0
144
+
145
+ Returns
146
+ -------
147
+ numpy.array
148
+ 返回行号、列号
149
+ '''
150
+
151
+ lat1 = np.array(lat.copy())
152
+ lon1 = np.array(lon.copy())
153
+
154
+ fillflag = (lat1<-90) | (lat1 > 90) | \
155
+ (lon1<-180) | (lon1 > 180)
156
+
157
+ lon1 = lon1 * deg2rad
158
+ lat1 = lat1 * deg2rad
159
+
160
+ phi_e = np.arctan(self.eb ** 2 * np.tan(lat1) / self.ea ** 2)
161
+ re = self.eb / np.sqrt(1-(self.ea**2 - self.eb**2) * np.cos(phi_e)**2/self.ea**2)
162
+ r1 = self.H - re * np.cos(phi_e) * np.cos(lon1 - self.subpoint * deg2rad)
163
+ r2 = -re * np.cos(phi_e) * np.sin(lon1 - self.subpoint * deg2rad)
164
+ r3 = re * np.sin(phi_e)
165
+ rn = np.sqrt(r1**2 + r2**2 + r3**2)
166
+ x = np.arctan2(-r2, r1)*180/np.pi
167
+ # x = np.arctan(-r2/r1)*180/np.pi
168
+ y = np.arcsin(-r3/rn)*180/np.pi
169
+ col = self.coff + x * 2**(-16) * self.cfac
170
+ line = self.loff + y * 2**(-16) * self.lfac
171
+
172
+ # 对外太空进行判断
173
+ tmp = r1 * (r1 - self.H) + r2 **2 + r3**2
174
+ flag = tmp > 0
175
+
176
+ line = np.array(line+0.5, dtype=np.int32)
177
+ col = np.array(col+0.5, dtype=np.int32)
178
+
179
+ line[(line<0) | (line >= self.rowmax)] = fillvalue
180
+ col[(col<0) | (col>=self.colmax)] = fillvalue
181
+ col[fillflag] = fillvalue
182
+ line[fillflag] = fillvalue
183
+
184
+ return col, line
185
+
186
+ def calSolarAngle(self, lat, lon, nowdate, fillvalue=65535):
187
+ ''' 计算太阳天顶角SOZ和方位角SOA '''
188
+
189
+ dHours, dMinutes, dSeconds = nowdate.hour, nowdate.minute, nowdate.second
190
+ iYear, iMonth, iDay = nowdate.year, nowdate.month, nowdate.day
191
+
192
+ dEarthMeanRadius = 6371.01
193
+ dAstronomicalUnit = 149597890
194
+
195
+ dDecimalHours = dHours + (dMinutes + dSeconds / 60.) / 60.
196
+
197
+ liAux1 = int((iMonth - 14.) / 12.)
198
+ liAux2 = int((1461. * (iYear + 4800. + liAux1)) / 4.) + int((367. * (iMonth - 2. - 12. * liAux1)) / 12.) - int(
199
+ (3. * int((iYear + 4900. + liAux1) / 100.)) / 4.) + iDay - 32075.
200
+ dJulianDate = liAux2 - 0.5 + dDecimalHours / 24.
201
+
202
+ dElapsedJulianDays = dJulianDate - 2451545.0
203
+
204
+ dOmega = 2.1429 - 0.0010394594 * dElapsedJulianDays
205
+ dMeanLongitude = 4.8950630 + 0.017202791698 * dElapsedJulianDays # Radians
206
+ dMeanAnomaly = 6.2400600 + 0.0172019699 * dElapsedJulianDays
207
+ dEclipticLongitude = dMeanLongitude + 0.03341607 * np.sin(dMeanAnomaly) + 0.00034894 * np.sin(
208
+ 2. * dMeanAnomaly) - 0.0001134 - 0.0000203 * np.sin(dOmega)
209
+ dEclipticObliquity = 0.4090928 - 6.2140e-9 * dElapsedJulianDays + 0.0000396 * np.cos(dOmega)
210
+
211
+ dSin_EclipticLongitude = np.sin(dEclipticLongitude)
212
+ dY = np.cos(dEclipticObliquity) * dSin_EclipticLongitude
213
+ dX = np.cos(dEclipticLongitude)
214
+ dRightAscension = np.arctan2(dY, dX)
215
+ if dRightAscension < 0.0:
216
+ dRightAscension = dRightAscension + 2.0 * np.pi
217
+ dDeclination = np.arcsin(np.sin(dEclipticObliquity) * dSin_EclipticLongitude)
218
+
219
+ dGreenwichMeanSiderealTime = 6.6974243242 + 0.0657098283 * dElapsedJulianDays + dDecimalHours
220
+ dLocalMeanSiderealTime = np.deg2rad(dGreenwichMeanSiderealTime * 15. + lon)
221
+ dHourAngle = dLocalMeanSiderealTime - dRightAscension
222
+ dLatitudeInRadians = np.deg2rad(lat)
223
+ dCos_Latitude = np.cos(dLatitudeInRadians)
224
+ dSin_Latitude = np.sin(dLatitudeInRadians)
225
+ dCos_HourAngle = np.cos(dHourAngle)
226
+ Zenith = (np.arccos(dCos_Latitude * dCos_HourAngle * np.cos(dDeclination)
227
+ + np.sin(dDeclination) * dSin_Latitude))
228
+ dY = -np.sin(dHourAngle)
229
+ dX = np.tan(dDeclination) * dCos_Latitude - dSin_Latitude * dCos_HourAngle
230
+ Azimuth = np.arctan2(dY, dX)
231
+ Azimuth[Azimuth < 0.0] = Azimuth[Azimuth < 0.0] + 2.0 * np.pi
232
+ Azimuth = np.rad2deg(Azimuth)
233
+ # Parallax Correction
234
+ dParallax = (dEarthMeanRadius / dAstronomicalUnit) * np.sin(Zenith)
235
+ Zenith = np.rad2deg(Zenith + dParallax)
236
+
237
+ flag = (lat <-90) | (lat > 90) | \
238
+ (lon < -180) | (lon > 180)
239
+ Azimuth[flag] = fillvalue
240
+ Zenith[flag] = fillvalue
241
+
242
+ return Azimuth, Zenith
243
+
244
+ def calSatAngle(self, lat, lon, fillvalue=65535):
245
+ ''' 计算卫星的天顶角和方位角 '''
246
+
247
+ S = self.subpoint / 180. * np.pi
248
+ N = lon / 180. * np.pi
249
+ L = lat / 180. * np.pi
250
+ G = S - N
251
+
252
+ LL = np.sqrt(1 - (np.cos(G) * np.cos(L)) ** 2)
253
+ E = np.arctan((np.cos(G) * np.cos(L) - 0.15127) / LL)
254
+ # Azimuth
255
+ A = np.pi - np.arctan2(np.tan(G), np.sin(L))
256
+ # 弧度->度
257
+ Azimuth = A / np.pi * 180
258
+ Elevat = E / np.pi * 180
259
+ Zenith = (90 - Elevat)
260
+
261
+ flag = (lat <-90) | (lat > 90) | \
262
+ (lon < -180) | (lon > 180)
263
+ Azimuth[flag] = fillvalue
264
+ Zenith[flag] = fillvalue
265
+
266
+ return Azimuth, Zenith
267
+
268
+ def calSunGL(self, satz, sunz, rela):
269
+ '''
270
+
271
+ :param satz:
272
+ :param sunz:
273
+ :param rela:
274
+ :return:
275
+ '''
276
+ fillflag = (satz < -360) | (satz > 360) | (sunz < -360) | (sunz > 360) | (rela < -360) | (rela > 360)
277
+
278
+ data = np.cos(satz * deg2rad) * np.cos(sunz * deg2rad) \
279
+ + np.sin(satz * deg2rad) * np.sin(sunz * deg2rad) * np.cos(rela * deg2rad)
280
+ # cos_solzen * cos_satzen + sin_solzen * sin_satzen * cos_relaz
281
+
282
+ data[data > 1.0] = 0.0
283
+ SunGL = np.arccos(data) * rad2deg
284
+ SunGL[fillflag] = -999.0
285
+
286
+ return SunGL
287
+
288
+ def calRelativeAzimuth(self, sata, suna, fillvalue=65535):
289
+ fillflag = (sata > 360) | (sata < 0) | (suna > 360) | (suna < 0)
290
+
291
+ RelativeAzi = np.fabs(sata - suna) + 180.0 # ???? + 180
292
+
293
+ RelativeAzi[fillflag] = fillvalue
294
+
295
+ return RelativeAzi
296
+
297
+
298
+