shancx 1.9.33.227__tar.gz → 1.9.33.229__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.
- {shancx-1.9.33.227 → shancx-1.9.33.229}/PKG-INFO +1 -1
- {shancx-1.9.33.227 → shancx-1.9.33.229}/setup.py +1 -1
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Read.py +15 -25
- shancx-1.9.33.229/shancx/npz.py +29 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx.egg-info/PKG-INFO +1 -1
- shancx-1.9.33.227/shancx/npz.py +0 -15
- {shancx-1.9.33.227 → shancx-1.9.33.229}/README.md +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/setup.cfg +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/3D/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/Class.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/CudaPrefetcher1.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/Fake_image.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/Hsml.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/L2Loss.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/MetricTracker.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/Normalize.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/OptimizerWScheduler.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/Rmageresize.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/Savemodel.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/SmoothL1_losses.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/Tqdm.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/checknan.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/dsalgor.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/iouJU.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/mask.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/psnr.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/ssim.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/structural_similarity.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Algo/tool.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Calmetrics/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Calmetrics/calmetrics.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Calmetrics/calmetricsmatrixLib.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Calmetrics/rmseR2score.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Clip/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Cmd.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Config_.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Df/DataFrame.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Df/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Df/tool.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Diffm/Psamples.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Diffm/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Diffm/test.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Doc/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/E/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Fillmiss/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Fillmiss/imgidwJU.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Fillmiss/imgidwLatLonJU.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Gpu/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/H9/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/H9/ahi_read_hsd.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/H9/ahisearchtable.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/H9/geometry.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Hug/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Inst.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Lib.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Mos/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/NN/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/NN/chainMul.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Path1.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Plot/GlobMap.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Plot/Gray2RGB.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Plot/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Plot/draw_day_CR_PNG.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Plot/exam.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Plot/plotGlobal.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Plot/radarNmc.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Plot/single_china_map.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Point.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/QC.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/RdPzl/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Resize.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/SN/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Time/GetTime.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Time/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Time/timeCycle.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Time/tool.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Train/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Train/makelist.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Train/multiGpu.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Train/prepare.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/Train/renet50.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/ZR.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/args.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/bak.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/cmp.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/df2database.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/geosProj.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/getResponse.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/info.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/netdfJU.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/sendM.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/tensBoard/__init__.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx/wait.py +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx.egg-info/SOURCES.txt +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx.egg-info/dependency_links.txt +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx.egg-info/requires.txt +0 -0
- {shancx-1.9.33.227 → shancx-1.9.33.229}/shancx.egg-info/top_level.txt +0 -0
|
@@ -55,30 +55,9 @@ result = getGrib(input_Path)
|
|
|
55
55
|
import pygrib
|
|
56
56
|
import numpy as np
|
|
57
57
|
import pandas as pd
|
|
58
|
-
|
|
59
|
-
import tempfile
|
|
60
|
-
def readGrib(filepath, target_param=None):
|
|
61
|
-
filepath= filepath
|
|
62
|
-
if filepath.endswith('.gz'):
|
|
63
|
-
with gzip.open(filepath, 'rb') as f:
|
|
64
|
-
with tempfile.NamedTemporaryFile(suffix='.grib2', delete=False) as tmp:
|
|
65
|
-
tmp.write(f.read())
|
|
66
|
-
filepath = tmp.name
|
|
58
|
+
def readGrib(file_path, target_param=None):
|
|
67
59
|
try:
|
|
68
|
-
with pygrib.open(
|
|
69
|
-
if target_param:
|
|
70
|
-
try:
|
|
71
|
-
grb = grbs.select(shortName=target_param)[0]
|
|
72
|
-
except:
|
|
73
|
-
try:
|
|
74
|
-
grb = grbs.select(parameterName=target_param)[0]
|
|
75
|
-
except:
|
|
76
|
-
raise ValueError(f"未找到参数: {target_param}")
|
|
77
|
-
else:
|
|
78
|
-
grb = grbs[1]
|
|
79
|
-
data = grb.values
|
|
80
|
-
lats, lons = grb.latlons()
|
|
81
|
-
#data2
|
|
60
|
+
with pygrib.open(file_path) as grbs:
|
|
82
61
|
field_info = []
|
|
83
62
|
for grb in grbs:
|
|
84
63
|
field_info.append({
|
|
@@ -91,6 +70,18 @@ def readGrib(filepath, target_param=None):
|
|
|
91
70
|
'units': getattr(grb, 'units', 'N/A'),
|
|
92
71
|
'shape': grb.values.shape
|
|
93
72
|
})
|
|
73
|
+
if target_param:
|
|
74
|
+
try:
|
|
75
|
+
grb = grbs.select(shortName=target_param)[0]
|
|
76
|
+
except:
|
|
77
|
+
try:
|
|
78
|
+
grb = grbs.select(parameterName=target_param)[0]
|
|
79
|
+
except:
|
|
80
|
+
raise ValueError(f"未找到参数: {target_param}")
|
|
81
|
+
else:
|
|
82
|
+
grb = grbs[1]
|
|
83
|
+
data = grb.values
|
|
84
|
+
lats, lons = grb.latlons()
|
|
94
85
|
return {
|
|
95
86
|
'data': data,
|
|
96
87
|
'lats': lats,
|
|
@@ -99,8 +90,7 @@ def readGrib(filepath, target_param=None):
|
|
|
99
90
|
'parameterName': grb.parameterName,
|
|
100
91
|
'level': grb.level,
|
|
101
92
|
'validDate': grb.validDate,
|
|
102
|
-
'units': grb.units
|
|
103
|
-
"field_info":field_info
|
|
93
|
+
'units': grb.units
|
|
104
94
|
}
|
|
105
95
|
}
|
|
106
96
|
except Exception as e:
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import os
|
|
4
|
+
import uuid
|
|
5
|
+
import traceback
|
|
6
|
+
def npzSave(output, data):
|
|
7
|
+
try:
|
|
8
|
+
output_path = Path(output)
|
|
9
|
+
if output_path.suffix in ['.npy', '.nc', '.h5', '.hdf5']:
|
|
10
|
+
output_path = output_path.with_suffix('.npz')
|
|
11
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
12
|
+
temp_filename = output_path.with_suffix(f'.tmp.{uuid.uuid4()}.npz')
|
|
13
|
+
np.savez_compressed(temp_filename, data=data)
|
|
14
|
+
os.replace(temp_filename, output_path)
|
|
15
|
+
print(f"{output_path} done")
|
|
16
|
+
except Exception as e:
|
|
17
|
+
print(traceback.format_exc())
|
|
18
|
+
if temp_filename and temp_filename.exists():
|
|
19
|
+
try:
|
|
20
|
+
os.remove(temp_filename)
|
|
21
|
+
print(f"⚠ Temporary files have been cleared: {temp_filename}")
|
|
22
|
+
except:
|
|
23
|
+
pass
|
|
24
|
+
def npzLoad(output_path):
|
|
25
|
+
return np.load(Path(output_path).with_suffix('.npz'))['data']
|
|
26
|
+
"""
|
|
27
|
+
npzSave(output, data)
|
|
28
|
+
npzLoad(output_path)
|
|
29
|
+
"""
|
shancx-1.9.33.227/shancx/npz.py
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
def npzSave(output, data):
|
|
4
|
-
output = output.replace('.npy', '.npz')
|
|
5
|
-
output_path = Path(output).with_suffix('.npz')
|
|
6
|
-
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
7
|
-
np.savez_compressed(output_path, data=data)
|
|
8
|
-
print(f"{output_path} done")
|
|
9
|
-
def npzLoad(output_path):
|
|
10
|
-
return np.load(Path(output_path).with_suffix('.npz'))['data']
|
|
11
|
-
|
|
12
|
-
"""
|
|
13
|
-
npzSave(output, data)
|
|
14
|
-
npzLoad(output_path)
|
|
15
|
-
"""
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|