oafuncs 0.0.98.13__py3-none-any.whl → 0.0.98.14__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.
- oafuncs/_script/netcdf_merge.py +20 -4
- {oafuncs-0.0.98.13.dist-info → oafuncs-0.0.98.14.dist-info}/METADATA +1 -1
- {oafuncs-0.0.98.13.dist-info → oafuncs-0.0.98.14.dist-info}/RECORD +6 -6
- {oafuncs-0.0.98.13.dist-info → oafuncs-0.0.98.14.dist-info}/WHEEL +0 -0
- {oafuncs-0.0.98.13.dist-info → oafuncs-0.0.98.14.dist-info}/licenses/LICENSE.txt +0 -0
- {oafuncs-0.0.98.13.dist-info → oafuncs-0.0.98.14.dist-info}/top_level.txt +0 -0
oafuncs/_script/netcdf_merge.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding=utf-8
|
3
|
+
"""
|
4
|
+
Author: Liu Kun && 16031215@qq.com
|
5
|
+
Date: 2025-03-30 11:16:29
|
6
|
+
LastEditors: Liu Kun && 16031215@qq.com
|
7
|
+
LastEditTime: 2025-04-25 14:23:10
|
8
|
+
FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\_script\\netcdf_merge.py
|
9
|
+
Description
|
10
|
+
EditPlatform: vscode
|
11
|
+
ComputerInfo: XPS 15 9510
|
12
|
+
SystemInfo: Windows 11
|
13
|
+
Python Version: 3.12
|
14
|
+
"""
|
15
|
+
|
1
16
|
import os
|
2
17
|
from typing import List, Optional, Union
|
3
18
|
|
@@ -5,6 +20,7 @@ import numpy as np
|
|
5
20
|
import xarray as xr
|
6
21
|
|
7
22
|
from oafuncs import pbar
|
23
|
+
import logging
|
8
24
|
|
9
25
|
|
10
26
|
def merge_nc(file_list: Union[str, List[str]], var_name: Optional[Union[str, List[str]]] = None, dim_name: Optional[str] = None, target_filename: Optional[str] = None) -> None:
|
@@ -74,13 +90,13 @@ def merge_nc(file_list: Union[str, List[str]], var_name: Optional[Union[str, Lis
|
|
74
90
|
merged_data[var] = xr.concat(merged_data[var], dim=dim_name).fillna(0)
|
75
91
|
|
76
92
|
if os.path.exists(target_filename):
|
77
|
-
print("Warning: The target file already exists. Removing it ...")
|
93
|
+
# print("Warning: The target file already exists. Removing it ...")
|
94
|
+
logging.warning("The target file already exists. Removing it ...")
|
78
95
|
os.remove(target_filename)
|
79
|
-
|
80
|
-
save_to_nc(target_filename, merged_data)
|
81
96
|
|
82
|
-
|
97
|
+
save_to_nc(target_filename, xr.Dataset(merged_data))
|
83
98
|
|
99
|
+
print(f'File "{target_filename}" has been successfully created.')
|
84
100
|
|
85
101
|
|
86
102
|
# Example usage
|
@@ -12,7 +12,7 @@ oafuncs/_data/hycom.png,sha256=MadKs6Gyj5n9-TOu7L4atQfTXtF9dvN9w-tdU9IfygI,10945
|
|
12
12
|
oafuncs/_data/oafuncs.png,sha256=o3VD7wm-kwDea5E98JqxXl04_78cBX7VcdUt7uQXGiU,3679898
|
13
13
|
oafuncs/_script/cprogressbar.py,sha256=UIgGcLFs-6IgWlITuBLaQqrpt4OAK3Mst5RlCiNfZdQ,15772
|
14
14
|
oafuncs/_script/email.py,sha256=lL4HGKrr524-g0xLlgs-4u7x4-u7DtgNoD9AL8XJKj4,3058
|
15
|
-
oafuncs/_script/netcdf_merge.py,sha256
|
15
|
+
oafuncs/_script/netcdf_merge.py,sha256=-Ke-Da6US0tM63Os5Uyl4fAOZ_1CNVuEpWbo_r2btGU,4299
|
16
16
|
oafuncs/_script/netcdf_modify.py,sha256=sGRUYNhfGgf9JV70rnBzw3bzuTRSXzBTL_RMDnDPeLQ,4552
|
17
17
|
oafuncs/_script/netcdf_write.py,sha256=iO1Qv9bp6RLiw1D8Nrv7tX_8X-diUZaX3Nxhk6pJ5Nw,8556
|
18
18
|
oafuncs/_script/parallel.py,sha256=T9Aie-e4LcbKlFTLZ0l4lhEN3SBVa84jRcrAsIm8s0I,8767
|
@@ -37,8 +37,8 @@ oafuncs/oa_sign/__init__.py,sha256=QKqTFrJDFK40C5uvk48GlRRbGFzO40rgkYwu6dYxatM,5
|
|
37
37
|
oafuncs/oa_sign/meteorological.py,sha256=8091SHo2L8kl4dCFmmSH5NGVHDku5i5lSiLEG5DLnOQ,6489
|
38
38
|
oafuncs/oa_sign/ocean.py,sha256=xrW-rWD7xBWsB5PuCyEwQ1Q_RDKq2KCLz-LOONHgldU,5932
|
39
39
|
oafuncs/oa_sign/scientific.py,sha256=a4JxOBgm9vzNZKpJ_GQIQf7cokkraV5nh23HGbmTYKw,5064
|
40
|
-
oafuncs-0.0.98.
|
41
|
-
oafuncs-0.0.98.
|
42
|
-
oafuncs-0.0.98.
|
43
|
-
oafuncs-0.0.98.
|
44
|
-
oafuncs-0.0.98.
|
40
|
+
oafuncs-0.0.98.14.dist-info/licenses/LICENSE.txt,sha256=rMtLpVg8sKiSlwClfR9w_Dd_5WubTQgoOzE2PDFxzs4,1074
|
41
|
+
oafuncs-0.0.98.14.dist-info/METADATA,sha256=1PncdzppTVKdYUjg_Njkg72cbwrri3GIrqexxl0_sVs,4273
|
42
|
+
oafuncs-0.0.98.14.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
43
|
+
oafuncs-0.0.98.14.dist-info/top_level.txt,sha256=bgC35QkXbN4EmPHEveg_xGIZ5i9NNPYWqtJqaKqTPsQ,8
|
44
|
+
oafuncs-0.0.98.14.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|