shancx 1.9.33.224__tar.gz → 1.9.33.226__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 (99) hide show
  1. {shancx-1.9.33.224 → shancx-1.9.33.226}/PKG-INFO +1 -1
  2. {shancx-1.9.33.224 → shancx-1.9.33.226}/setup.py +1 -1
  3. shancx-1.9.33.226/shancx/Read.py +111 -0
  4. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx.egg-info/PKG-INFO +1 -1
  5. shancx-1.9.33.224/shancx/Read.py +0 -58
  6. {shancx-1.9.33.224 → shancx-1.9.33.226}/README.md +0 -0
  7. {shancx-1.9.33.224 → shancx-1.9.33.226}/setup.cfg +0 -0
  8. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/3D/__init__.py +0 -0
  9. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/Class.py +0 -0
  10. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/CudaPrefetcher1.py +0 -0
  11. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/Fake_image.py +0 -0
  12. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/Hsml.py +0 -0
  13. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/L2Loss.py +0 -0
  14. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/MetricTracker.py +0 -0
  15. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/Normalize.py +0 -0
  16. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/OptimizerWScheduler.py +0 -0
  17. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/Rmageresize.py +0 -0
  18. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/Savemodel.py +0 -0
  19. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/SmoothL1_losses.py +0 -0
  20. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/Tqdm.py +0 -0
  21. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/__init__.py +0 -0
  22. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/checknan.py +0 -0
  23. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/dsalgor.py +0 -0
  24. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/iouJU.py +0 -0
  25. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/mask.py +0 -0
  26. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/psnr.py +0 -0
  27. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/ssim.py +0 -0
  28. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/structural_similarity.py +0 -0
  29. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Algo/tool.py +0 -0
  30. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Calmetrics/__init__.py +0 -0
  31. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Calmetrics/calmetrics.py +0 -0
  32. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Calmetrics/calmetricsmatrixLib.py +0 -0
  33. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Calmetrics/rmseR2score.py +0 -0
  34. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Clip/__init__.py +0 -0
  35. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Cmd.py +0 -0
  36. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Config_.py +0 -0
  37. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Df/DataFrame.py +0 -0
  38. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Df/__init__.py +0 -0
  39. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Df/tool.py +0 -0
  40. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Diffm/Psamples.py +0 -0
  41. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Diffm/__init__.py +0 -0
  42. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Diffm/test.py +0 -0
  43. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Doc/__init__.py +0 -0
  44. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/E/__init__.py +0 -0
  45. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Fillmiss/__init__.py +0 -0
  46. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Fillmiss/imgidwJU.py +0 -0
  47. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Fillmiss/imgidwLatLonJU.py +0 -0
  48. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Gpu/__init__.py +0 -0
  49. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/H9/__init__.py +0 -0
  50. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/H9/ahi_read_hsd.py +0 -0
  51. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/H9/ahisearchtable.py +0 -0
  52. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/H9/geometry.py +0 -0
  53. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Hug/__init__.py +0 -0
  54. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Inst.py +0 -0
  55. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Lib.py +0 -0
  56. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Mos/__init__.py +0 -0
  57. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/NN/__init__.py +0 -0
  58. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/NN/chainMul.py +0 -0
  59. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Path1.py +0 -0
  60. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Plot/GlobMap.py +0 -0
  61. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Plot/Gray2RGB.py +0 -0
  62. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Plot/__init__.py +0 -0
  63. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Plot/draw_day_CR_PNG.py +0 -0
  64. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Plot/exam.py +0 -0
  65. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Plot/plotGlobal.py +0 -0
  66. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Plot/radarNmc.py +0 -0
  67. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Plot/single_china_map.py +0 -0
  68. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Point.py +0 -0
  69. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/QC.py +0 -0
  70. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/RdPzl/__init__.py +0 -0
  71. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Resize.py +0 -0
  72. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/SN/__init__.py +0 -0
  73. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Time/GetTime.py +0 -0
  74. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Time/__init__.py +0 -0
  75. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Time/timeCycle.py +0 -0
  76. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Time/tool.py +0 -0
  77. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Train/__init__.py +0 -0
  78. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Train/makelist.py +0 -0
  79. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Train/multiGpu.py +0 -0
  80. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Train/prepare.py +0 -0
  81. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/Train/renet50.py +0 -0
  82. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/ZR.py +0 -0
  83. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/__init__.py +0 -0
  84. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/args.py +0 -0
  85. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/bak.py +0 -0
  86. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/cmp.py +0 -0
  87. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/df2database.py +0 -0
  88. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/geosProj.py +0 -0
  89. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/getResponse.py +0 -0
  90. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/info.py +0 -0
  91. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/netdfJU.py +0 -0
  92. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/npz.py +0 -0
  93. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/sendM.py +0 -0
  94. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/tensBoard/__init__.py +0 -0
  95. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx/wait.py +0 -0
  96. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx.egg-info/SOURCES.txt +0 -0
  97. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx.egg-info/dependency_links.txt +0 -0
  98. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx.egg-info/requires.txt +0 -0
  99. {shancx-1.9.33.224 → shancx-1.9.33.226}/shancx.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shancx
3
- Version: 1.9.33.224
3
+ Version: 1.9.33.226
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.224",
6
+ version="1.9.33.226",
7
7
  packages=find_packages(),
8
8
  description="A simple timer decorator",
9
9
  long_description=open("README.md").read(),
@@ -0,0 +1,111 @@
1
+ import xarray as xr
2
+ import numpy as np
3
+ import gzip
4
+ import tempfile
5
+ import os
6
+ def getGrib(filepath):
7
+ tmp_path = filepath
8
+ if filepath.endswith('.gz'):
9
+ with gzip.open(filepath, 'rb') as f:
10
+ with tempfile.NamedTemporaryFile(suffix='.grib2', delete=False) as tmp:
11
+ tmp.write(f.read())
12
+ tmp_path = tmp.name
13
+ try:
14
+ ds = xr.open_dataset(tmp_path, engine='cfgrib')
15
+ var_name = list(ds.data_vars)[0]
16
+ data_var = ds[var_name]
17
+ data_values = np.where(data_var.values < -900, np.nan, data_var.values)
18
+ if 'latitude' in ds.coords and 'longitude' in ds.coords:
19
+ lats = ds.latitude.values
20
+ lons = ds.longitude.values
21
+ elif 'lat' in ds.coords and 'lon' in ds.coords:
22
+ lats = ds.lat.values
23
+ lons = ds.lon.values
24
+ elif hasattr(ds, 'latitude') and hasattr(ds, 'longitude'):
25
+ lats = ds.latitude.values
26
+ lons = ds.longitude.values
27
+ else:
28
+ for var_name in ds.data_vars:
29
+ var = ds[var_name]
30
+ if hasattr(var, 'latitude') and hasattr(var, 'longitude'):
31
+ lats = var.latitude.values
32
+ lons = var.longitude.values
33
+ break
34
+ else:
35
+ raise ValueError("未找到经纬度坐标")
36
+ lat_range = (float(np.nanmin(lats)), float(np.nanmax(lats)))
37
+ lon_range = (float(np.nanmin(lons)), float(np.nanmax(lons)))
38
+ return {
39
+ 'data': data,
40
+ 'lats': lats,
41
+ 'lons': lons
42
+ }
43
+ finally:
44
+ os.unlink(tmp_path)
45
+ """
46
+ input_Path = './Composite_00.50_20250701-010044.grib2.gz'
47
+ result = getGrib(input_Path)
48
+ """
49
+
50
+ import pygrib
51
+ import numpy as np
52
+ import pandas as pd
53
+ def readGrib(file_path, target_param=None):
54
+ try:
55
+ with pygrib.open(file_path) as grbs:
56
+ file_path= file_path
57
+ if filepath.endswith('.gz'):
58
+ with gzip.open(filepath, 'rb') as f:
59
+ with tempfile.NamedTemporaryFile(suffix='.grib2', delete=False) as tmp:
60
+ tmp.write(f.read())
61
+ file_path = tmp.name
62
+ if target_param:
63
+ try:
64
+ grb = grbs.select(shortName=target_param)[0]
65
+ except:
66
+ try:
67
+ grb = grbs.select(parameterName=target_param)[0]
68
+ except:
69
+ raise ValueError(f"未找到参数: {target_param}")
70
+ else:
71
+ grb = grbs[1]
72
+ data = grb.values
73
+ lats, lons = grb.latlons()
74
+ #data2
75
+ field_info = []
76
+ for grb in grbs:
77
+ field_info.append({
78
+ 'messageNumber': grb.messagenumber,
79
+ 'parameterName': getattr(grb, 'parameterName', 'N/A'),
80
+ 'shortName': getattr(grb, 'shortName', 'N/A'),
81
+ 'level': getattr(grb, 'level', -999),
82
+ 'typeOfLevel': getattr(grb, 'typeOfLevel', 'N/A'),
83
+ 'validDate': getattr(grb, 'validDate', 'N/A'),
84
+ 'units': getattr(grb, 'units', 'N/A'),
85
+ 'shape': grb.values.shape
86
+ })
87
+ return {
88
+ 'data': data,
89
+ 'lats': lats,
90
+ 'lons': lons,
91
+ 'metadata': {
92
+ 'parameterName': grb.parameterName,
93
+ 'level': grb.level,
94
+ 'validDate': grb.validDate,
95
+ 'units': grb.units,
96
+ "field_info":field_info
97
+ }
98
+ }
99
+ except Exception as e:
100
+ print(f"GRIB读取错误: {str(e)}")
101
+ return None
102
+ if __name__ == "__main__":
103
+ path = "/mnt/wtx_weather_forecast/CMA_DATA/NAFP/EC/C1D/2024/2024112720/ECMFC1D_PRTY_1_2024112712_GLB_1_2.grib2"
104
+ result = readGrib(path)
105
+ if result:
106
+ print("\n数据矩阵形状:", result['data'].shape)
107
+ print("经度范围:", np.min(result['lons']), "~", np.max(result['lons']))
108
+ print("纬度范围:", np.min(result['lats']), "~", np.max(result['lats']))
109
+ print("参数单位:", result['metadata']['units'])
110
+
111
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shancx
3
- Version: 1.9.33.224
3
+ Version: 1.9.33.226
4
4
  Summary: A simple timer decorator
5
5
  Home-page: https://gitee.com/shancx
6
6
  Author: shancx
@@ -1,58 +0,0 @@
1
- import pygrib
2
- import numpy as np
3
- import pandas as pd
4
- def readGrib(file_path, target_param=None):
5
- try:
6
- with pygrib.open(file_path) as grbs:
7
- field_info = []
8
- for grb in grbs:
9
- field_info.append({
10
- 'messageNumber': grb.messagenumber,
11
- 'parameterName': getattr(grb, 'parameterName', 'N/A'),
12
- 'shortName': getattr(grb, 'shortName', 'N/A'),
13
- 'level': getattr(grb, 'level', -999),
14
- 'typeOfLevel': getattr(grb, 'typeOfLevel', 'N/A'),
15
- 'validDate': getattr(grb, 'validDate', 'N/A'),
16
- 'units': getattr(grb, 'units', 'N/A'),
17
- 'shape': grb.values.shape
18
- })
19
- if target_param:
20
- try:
21
- grb = grbs.select(shortName=target_param)[0]
22
- except:
23
- try:
24
- grb = grbs.select(parameterName=target_param)[0]
25
- except:
26
- raise ValueError(f"未找到参数: {target_param}")
27
- else:
28
- grb = grbs[1]
29
- data = grb.values
30
- lats, lons = grb.latlons()
31
- return {
32
- 'data': data,
33
- 'lats': lats,
34
- 'lons': lons,
35
- 'metadata': {
36
- 'parameterName': grb.parameterName,
37
- 'level': grb.level,
38
- 'validDate': grb.validDate,
39
- 'units': grb.units
40
- }
41
- }
42
- except Exception as e:
43
- print(f"GRIB读取错误: {str(e)}")
44
- return None
45
- if __name__ == "__main__":
46
- path = "/mnt/wtx_weather_forecast/CMA_DATA/NAFP/EC/C1D/2024/2024112720/ECMFC1D_PRTY_1_2024112712_GLB_1_2.grib2"
47
- result = readGrib(path)
48
- if result:
49
- print("\n数据矩阵形状:", result['data'].shape)
50
- print("经度范围:", np.min(result['lons']), "~", np.max(result['lons']))
51
- print("纬度范围:", np.min(result['lats']), "~", np.max(result['lats']))
52
- print("参数单位:", result['metadata']['units'])
53
- """
54
- latArr = latMat[:,0]
55
- lonArr = lonMat[0]
56
- """
57
-
58
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes