oafuncs 0.0.95__tar.gz → 0.0.97__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.
- {oafuncs-0.0.95/oafuncs.egg-info → oafuncs-0.0.97}/PKG-INFO +2 -1
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/__init__.py +12 -5
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/data_store/OAFuncs.png +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_down/hycom_3hourly.py +14 -5
- oafuncs-0.0.97/oafuncs/oa_model/__init__.py +19 -0
- oafuncs-0.0.97/oafuncs/oa_model/roms/__init__.py +20 -0
- oafuncs-0.0.97/oafuncs/oa_model/roms/test.py +19 -0
- oafuncs-0.0.97/oafuncs/oa_model/wrf/__init__.py +18 -0
- oafuncs-0.0.97/oafuncs/oa_model/wrf/little_r.py +186 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_nc.py +2 -2
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_tool/__init__.py +1 -0
- oafuncs-0.0.97/oafuncs/oa_tool/time.py +22 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97/oafuncs.egg-info}/PKG-INFO +2 -1
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs.egg-info/SOURCES.txt +7 -1
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs.egg-info/requires.txt +1 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/setup.py +5 -3
- {oafuncs-0.0.95 → oafuncs-0.0.97}/LICENSE.txt +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/MANIFEST.in +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/README.md +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_cmap.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_data.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_down/User_Agent-list.txt +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_down/__init__.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_down/hycom_3hourly_20250129.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_down/idm.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_down/literature.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_down/test_ua.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_down/user_agent.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_draw.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_file.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_help.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_python.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_sign/__init__.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_sign/meteorological.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_sign/ocean.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_sign/scientific.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_tool/email.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs/oa_tool/parallel.py +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs.egg-info/dependency_links.txt +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/oafuncs.egg-info/top_level.txt +0 -0
- {oafuncs-0.0.95 → oafuncs-0.0.97}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: oafuncs
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.97
|
4
4
|
Summary: Oceanic and Atmospheric Functions
|
5
5
|
Home-page: https://github.com/Industry-Pays/OAFuncs
|
6
6
|
Author: Kun Liu
|
@@ -33,6 +33,7 @@ Requires-Dist: geopandas
|
|
33
33
|
Requires-Dist: Cartopy
|
34
34
|
Requires-Dist: rasterio
|
35
35
|
Requires-Dist: salem
|
36
|
+
Requires-Dist: calendar
|
36
37
|
Dynamic: author
|
37
38
|
Dynamic: author-email
|
38
39
|
Dynamic: classifier
|
@@ -4,8 +4,8 @@
|
|
4
4
|
Author: Liu Kun && 16031215@qq.com
|
5
5
|
Date: 2024-09-17 16:09:20
|
6
6
|
LastEditors: Liu Kun && 16031215@qq.com
|
7
|
-
LastEditTime:
|
8
|
-
FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\
|
7
|
+
LastEditTime: 2025-03-09 16:28:01
|
8
|
+
FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\__init__.py
|
9
9
|
Description:
|
10
10
|
EditPlatform: vscode
|
11
11
|
ComputerInfo: XPS 15 9510
|
@@ -14,6 +14,7 @@ Python Version: 3.12
|
|
14
14
|
"""
|
15
15
|
|
16
16
|
|
17
|
+
|
17
18
|
# 会导致OAFuncs直接导入所有函数,不符合模块化设计
|
18
19
|
# from oafuncs.oa_s.oa_cmap import *
|
19
20
|
# from oafuncs.oa_s.oa_data import *
|
@@ -27,18 +28,24 @@ Python Version: 3.12
|
|
27
28
|
# path: My_Funcs/OAFuncs/oafuncs/
|
28
29
|
from .oa_cmap import *
|
29
30
|
from .oa_data import *
|
31
|
+
|
32
|
+
# ------------------- 2024-12-13 12:31:06 -------------------
|
33
|
+
# path: My_Funcs/OAFuncs/oafuncs/oa_down/
|
34
|
+
from .oa_down import *
|
30
35
|
from .oa_draw import *
|
31
36
|
from .oa_file import *
|
32
37
|
from .oa_help import *
|
33
38
|
from .oa_nc import *
|
34
39
|
from .oa_python import *
|
35
|
-
|
36
|
-
# path: My_Funcs/OAFuncs/oafuncs/oa_down/
|
37
|
-
from .oa_down import *
|
40
|
+
|
38
41
|
# ------------------- 2024-12-13 12:31:06 -------------------
|
39
42
|
# path: My_Funcs/OAFuncs/oafuncs/oa_sign/
|
40
43
|
from .oa_sign import *
|
44
|
+
|
41
45
|
# ------------------- 2024-12-13 12:31:06 -------------------
|
42
46
|
# path: My_Funcs/OAFuncs/oafuncs/oa_tool/
|
43
47
|
from .oa_tool import *
|
44
48
|
# ------------------- 2024-12-13 12:31:06 -------------------
|
49
|
+
# path: My_Funcs/OAFuncs/oafuncs/oa_model/
|
50
|
+
from .oa_model import *
|
51
|
+
# ------------------- 2025-03-09 16:28:01 -------------------
|
Binary file
|
@@ -536,8 +536,10 @@ def _get_base_url(dataset_name, version_name, var, ymdh_str):
|
|
536
536
|
mdh_str = ymdh_str[4:]
|
537
537
|
# GLBy0.08 93.0
|
538
538
|
# data time range in each year: year-01-01 12:00 to year+1-01-01 09:00
|
539
|
-
if mdh_str <= "010109":
|
539
|
+
if "010100" <= mdh_str <= "010109":
|
540
540
|
year_str = int(ymdh_str[:4]) - 1
|
541
|
+
else:
|
542
|
+
year_str = int(ymdh_str[:4])
|
541
543
|
base_url = None
|
542
544
|
for key, value in var_group.items():
|
543
545
|
if var in value:
|
@@ -547,6 +549,13 @@ def _get_base_url(dataset_name, version_name, var, ymdh_str):
|
|
547
549
|
print("Please ensure the var is in [u,v,temp,salt,ssh,u_b,v_b,temp_b,salt_b]")
|
548
550
|
elif classification_method == "single_var_year_different":
|
549
551
|
base_url = None
|
552
|
+
if dataset_name == "ESPC_D" and version_name == "V02":
|
553
|
+
mdh_str = ymdh_str[4:]
|
554
|
+
# ESPC-D-V02
|
555
|
+
if "010100" <= mdh_str <= "010109":
|
556
|
+
year_str = int(ymdh_str[:4]) - 1
|
557
|
+
else:
|
558
|
+
year_str = int(ymdh_str[:4])
|
550
559
|
for key, value in single_var_group.items():
|
551
560
|
if var in value:
|
552
561
|
base_url = url_dict[key][str(year_str)]
|
@@ -1276,9 +1285,9 @@ if __name__ == "__main__":
|
|
1276
1285
|
|
1277
1286
|
options = {
|
1278
1287
|
"var": var_list,
|
1279
|
-
"time_s": "
|
1280
|
-
"time_e": "
|
1281
|
-
"store_path": r"
|
1288
|
+
"time_s": "2025010300",
|
1289
|
+
"time_e": "2025010321",
|
1290
|
+
"store_path": r"I:\Data\HYCOM\3hourly",
|
1282
1291
|
"lon_min": 105,
|
1283
1292
|
"lon_max": 130,
|
1284
1293
|
"lat_min": 15,
|
@@ -1289,7 +1298,7 @@ if __name__ == "__main__":
|
|
1289
1298
|
"level": None, # or 1-40 levels
|
1290
1299
|
"ftimes": 1,
|
1291
1300
|
# "idm_engine": r"D:\Programs\Internet Download Manager\IDMan.exe", # 查漏补缺不建议开启
|
1292
|
-
"fill_time":
|
1301
|
+
"fill_time": None,
|
1293
1302
|
}
|
1294
1303
|
|
1295
1304
|
if single_var:
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding=utf-8
|
3
|
+
"""
|
4
|
+
Author: Liu Kun && 16031215@qq.com
|
5
|
+
Date: 2025-03-09 16:28:42
|
6
|
+
LastEditors: Liu Kun && 16031215@qq.com
|
7
|
+
LastEditTime: 2025-03-09 16:28:42
|
8
|
+
FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\oa_model\\__init__.py
|
9
|
+
Description:
|
10
|
+
EditPlatform: vscode
|
11
|
+
ComputerInfo: XPS 15 9510
|
12
|
+
SystemInfo: Windows 11
|
13
|
+
Python Version: 3.12
|
14
|
+
"""
|
15
|
+
|
16
|
+
|
17
|
+
# 会导致OAFuncs直接导入所有函数,不符合模块化设计
|
18
|
+
from .roms import *
|
19
|
+
from .wrf import *
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding=utf-8
|
3
|
+
"""
|
4
|
+
Author: Liu Kun && 16031215@qq.com
|
5
|
+
Date: 2025-03-09 16:30:02
|
6
|
+
LastEditors: Liu Kun && 16031215@qq.com
|
7
|
+
LastEditTime: 2025-03-09 18:23:30
|
8
|
+
FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\oa_model\\roms\\__init__.py
|
9
|
+
Description:
|
10
|
+
EditPlatform: vscode
|
11
|
+
ComputerInfo: XPS 15 9510
|
12
|
+
SystemInfo: Windows 11
|
13
|
+
Python Version: 3.12
|
14
|
+
"""
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
# 会导致OAFuncs直接导入所有函数,不符合模块化设计
|
20
|
+
from .test import *
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding=utf-8
|
3
|
+
"""
|
4
|
+
Author: Liu Kun && 16031215@qq.com
|
5
|
+
Date: 2025-03-09 16:30:54
|
6
|
+
LastEditors: Liu Kun && 16031215@qq.com
|
7
|
+
LastEditTime: 2025-03-09 16:30:54
|
8
|
+
FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\oa_model\\roms\\depth.py
|
9
|
+
Description:
|
10
|
+
EditPlatform: vscode
|
11
|
+
ComputerInfo: XPS 15 9510
|
12
|
+
SystemInfo: Windows 11
|
13
|
+
Python Version: 3.12
|
14
|
+
"""
|
15
|
+
|
16
|
+
__all__ = ['test']
|
17
|
+
|
18
|
+
def test():
|
19
|
+
print('test')
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding=utf-8
|
3
|
+
"""
|
4
|
+
Author: Liu Kun && 16031215@qq.com
|
5
|
+
Date: 2025-03-09 16:29:59
|
6
|
+
LastEditors: Liu Kun && 16031215@qq.com
|
7
|
+
LastEditTime: 2025-03-09 16:29:59
|
8
|
+
FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\oa_model\\wrf\\__init__.py
|
9
|
+
Description:
|
10
|
+
EditPlatform: vscode
|
11
|
+
ComputerInfo: XPS 15 9510
|
12
|
+
SystemInfo: Windows 11
|
13
|
+
Python Version: 3.12
|
14
|
+
"""
|
15
|
+
|
16
|
+
|
17
|
+
# 会导致OAFuncs直接导入所有函数,不符合模块化设计
|
18
|
+
from .little_r import *
|
@@ -0,0 +1,186 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding=utf-8
|
3
|
+
"""
|
4
|
+
Author: Liu Kun && 16031215@qq.com
|
5
|
+
Date: 2025-03-09 16:31:45
|
6
|
+
LastEditors: Liu Kun && 16031215@qq.com
|
7
|
+
LastEditTime: 2025-03-09 16:31:45
|
8
|
+
FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\oa_model\\wrf\\little_r.py
|
9
|
+
Description:
|
10
|
+
EditPlatform: vscode
|
11
|
+
ComputerInfo: XPS 15 9510
|
12
|
+
SystemInfo: Windows 11
|
13
|
+
Python Version: 3.12
|
14
|
+
"""
|
15
|
+
|
16
|
+
__all__ = ["header_record", "data_record", "ending_record", "tail_record"]
|
17
|
+
|
18
|
+
import sys
|
19
|
+
|
20
|
+
|
21
|
+
def header_record(Latitude, Longitude, ID, Platform, Elevation, Bogus, Date, SLP, name):
|
22
|
+
"""
|
23
|
+
Latitude : F20.5 纬度,浮点数,总共20位,小数点后保留5位
|
24
|
+
Lontitude : F20.5 经度,浮点数,总共20位,小数点后保留5位
|
25
|
+
Platform : A40 FM 编码的浮标编号,总共40位
|
26
|
+
Elevation : F20.5 浮标高度,单位为米,浮点数,总共20位,小数点后保留5位
|
27
|
+
Bogus : logical 标志数据是否有效,True为无效,False为有效
|
28
|
+
Date : A20 日期,总共20位
|
29
|
+
"""
|
30
|
+
# 存放header record的字典
|
31
|
+
dict_header = {}
|
32
|
+
dict_header["Latitude"] = str_F20p5(Latitude)
|
33
|
+
dict_header["Longitude"] = str_F20p5(Longitude)
|
34
|
+
dict_header["ID"] = str_A40_Front_Space(ID)
|
35
|
+
dict_header["Name"] = str_A40_Front_Space(name)
|
36
|
+
dict_header["Platform"] = str_A40_Front_Space(Platform)
|
37
|
+
dict_header["Source"] = " N/A" # A40
|
38
|
+
dict_header["Elevation"] = str_F20p5(Elevation)
|
39
|
+
dict_header["ValidFields"] = " 1" # I10
|
40
|
+
dict_header["NumErrors"] = " -888888" # I10
|
41
|
+
dict_header["NumWarnings"] = " -888888" # I10
|
42
|
+
dict_header["SequenceNumber"] = " 890" # I10
|
43
|
+
dict_header["NumDuplicates"] = " -888888" # I10
|
44
|
+
dict_header["IsSounding"] = " F" # logical 10
|
45
|
+
dict_header["IsBogus"] = str_L10(Bogus)
|
46
|
+
dict_header["Discard"] = " F" # logical 10
|
47
|
+
dict_header["UnixTime"] = " -888888" # I10
|
48
|
+
dict_header["JulianDay"] = " -888888" # I10
|
49
|
+
dict_header["Date"] = str_A20_Behind_Space(Date)
|
50
|
+
dict_header["SLP-QC"] = str_F13p5(SLP) + " 0" # F13.5 I7
|
51
|
+
dict_header["RefPressure-QC"] = "-888888.00000 0" # F13.5 I7
|
52
|
+
dict_header["GroundTemp-QC"] = "-888888.00000 0" # F13.5 I7
|
53
|
+
dict_header["SST-QC"] = "-888888.00000 0" # F13.5 I7
|
54
|
+
dict_header["SFCPressure-QC"] = "-888888.00000 0" # F13.5 I7
|
55
|
+
dict_header["Precip-QC"] = "-888888.00000 0" # F13.5 I7
|
56
|
+
dict_header["DailyMaxT-QC"] = "-888888.00000 0" # F13.5 I7
|
57
|
+
dict_header["DailyMinT-QC"] = "-888888.00000 0" # F13.5 I7
|
58
|
+
dict_header["NightMinT-TC"] = "-888888.00000 0" # F13.5 I7
|
59
|
+
dict_header["3hrPresChange-QC"] = "-888888.00000 0" # F13.5 I7
|
60
|
+
dict_header["24hrChange-QC"] = "-888888.00000 0" # F13.5 I7
|
61
|
+
dict_header["CloudCover-QC"] = "-888888.00000 0" # F13.5 I7
|
62
|
+
dict_header["Ceiling-QC"] = "-888888.00000 0" # F13.5 I7
|
63
|
+
dict_header["PrecipitableWater-QC"] = "-888888.00000 0" # F13.5 I7
|
64
|
+
|
65
|
+
# 生成文件头的字符串,固定长度为620
|
66
|
+
header_str = ""
|
67
|
+
for iKey in dict_header.keys():
|
68
|
+
header_str = header_str + dict_header[iKey]
|
69
|
+
if len(header_str) != 620:
|
70
|
+
print("Error: The header record len =", len(header_str), ",The correct length should be 620!")
|
71
|
+
sys.exit(1)
|
72
|
+
return header_str
|
73
|
+
|
74
|
+
|
75
|
+
def data_record(Pressure, Height, Temperature, DewPoint, WindSpeed, WindDirection, WindU, WindV, RelativeHumidity, Thickness):
|
76
|
+
"""
|
77
|
+
Pressure : F13.5, Pa
|
78
|
+
Height : F13.5, m
|
79
|
+
Temperature : F13.5, K
|
80
|
+
DewPoint : F13.5, K
|
81
|
+
WindSpeed : F13.5, m/s
|
82
|
+
WindDirection : F13.5, deg
|
83
|
+
WindU : F13.5, m/s
|
84
|
+
WindV : F13.5, m/s
|
85
|
+
RelativeHumidity : F13.5, %
|
86
|
+
Thickness : F13.5, m
|
87
|
+
"""
|
88
|
+
dict_data = {}
|
89
|
+
dict_data["Pressure"] = str_F13p5(Pressure) # F13.5
|
90
|
+
dict_data["QC1"] = " 0" # I7
|
91
|
+
dict_data["Height"] = str_F13p5(Height) # F13.5
|
92
|
+
dict_data["QC2"] = " 0" # I7
|
93
|
+
dict_data["Temperature"] = str_F13p5(Temperature) # F13.5
|
94
|
+
dict_data["QC3"] = " 0" # I7
|
95
|
+
dict_data["DewPoint"] = str_F13p5(DewPoint) # F13.5
|
96
|
+
dict_data["QC4"] = " 0" # I7
|
97
|
+
dict_data["WindSpeed"] = str_F13p5(WindSpeed) # F13.5
|
98
|
+
dict_data["QC5"] = " 0" # I7
|
99
|
+
dict_data["WindDirection"] = str_F13p5(WindDirection) # F13.5
|
100
|
+
dict_data["QC6"] = " 0" # I7
|
101
|
+
dict_data["WindU"] = str_F13p5(WindU) # F13.5
|
102
|
+
dict_data["QC7"] = " 0" # I7
|
103
|
+
dict_data["WindV"] = str_F13p5(WindV) # F13.5
|
104
|
+
dict_data["QC8"] = " 0" # I7
|
105
|
+
dict_data["RelativeHumidity"] = str_F13p5(RelativeHumidity) # F13.5
|
106
|
+
dict_data["QC9"] = " 0" # I7
|
107
|
+
dict_data["Thickness"] = str_F13p5(Thickness) # F13.5
|
108
|
+
dict_data["QC10"] = " 0" # I7
|
109
|
+
|
110
|
+
# 生成数据记录,固定长度为200
|
111
|
+
data_str = ""
|
112
|
+
for iKey in dict_data.keys():
|
113
|
+
data_str = data_str + dict_data[iKey]
|
114
|
+
if len(data_str) != 200:
|
115
|
+
print("Error: The data record len =", len(data_str), ",The correct length should be 200!")
|
116
|
+
sys.exit(1)
|
117
|
+
return data_str
|
118
|
+
|
119
|
+
|
120
|
+
def ending_record():
|
121
|
+
ending_str = "-777777.00000 0-777777.00000 0-888888.00000 0-888888.00000 0-888888.00000 0-888888.00000 0-888888.00000 0-888888.00000 0-888888.00000 0-888888.00000 0"
|
122
|
+
return ending_str
|
123
|
+
|
124
|
+
|
125
|
+
def tail_record(ValidFields):
|
126
|
+
"""
|
127
|
+
ValidFields : integer
|
128
|
+
"""
|
129
|
+
NumErrors = " 0"
|
130
|
+
NumWarnings = " 0"
|
131
|
+
tail_str = str_I7(ValidFields) + NumErrors + NumWarnings
|
132
|
+
if len(tail_str) != 21:
|
133
|
+
print("Error: The tail record len =", len(tail_str), ",The correct length should be 21!")
|
134
|
+
sys.exit(1)
|
135
|
+
return tail_str
|
136
|
+
|
137
|
+
|
138
|
+
# 将浮点数格式化为长度为13位,小数点后保留5位的字符串,并在前面添加合适的空格
|
139
|
+
def str_F13p5(float):
|
140
|
+
a = "%.5f" % float
|
141
|
+
space = " " * (13 - len(a))
|
142
|
+
return space + str(a)
|
143
|
+
|
144
|
+
|
145
|
+
# 将浮点数格式化为长度为20位,小数点后保留5位的字符串,并在前面添加合适的空格
|
146
|
+
def str_F20p5(float):
|
147
|
+
a = "%.5f" % float
|
148
|
+
space = " " * (20 - len(a))
|
149
|
+
return space + str(a)
|
150
|
+
|
151
|
+
|
152
|
+
# 将字符串格式化为长度为40位的字符串,并在前面添加合适的空格。如果原始字符串超过了40位,会将其截断为前40位。
|
153
|
+
def str_A40_Front_Space(string):
|
154
|
+
# valid string in Front of space
|
155
|
+
string0 = str(string).strip()
|
156
|
+
space = " " * (40 - len(string0))
|
157
|
+
return string0 + space
|
158
|
+
|
159
|
+
|
160
|
+
# 将字符串格式化为长度为20位的字符串,并在后面添加合适的空格。如果原始字符串超过了20位,会将其截断为前20位。
|
161
|
+
def str_A20_Behind_Space(string):
|
162
|
+
# valid string Behind space
|
163
|
+
string0 = str(string).strip()
|
164
|
+
space = " " * (20 - len(string0))
|
165
|
+
return space + string0
|
166
|
+
|
167
|
+
|
168
|
+
# 将整数格式化为长度为10位的字符串,并在前面添加合适的空格
|
169
|
+
def str_I10(int0):
|
170
|
+
space = " " * (10 - len(int0))
|
171
|
+
return space + str(int0)
|
172
|
+
|
173
|
+
|
174
|
+
# 将整数格式化为长度为7位的字符串,并在前面添加合适的空格
|
175
|
+
def str_I7(int0):
|
176
|
+
space = " " * (7 - len(str(int0)))
|
177
|
+
return space + str(int0)
|
178
|
+
|
179
|
+
|
180
|
+
# 将布尔值格式化为长度为10位的字符串,如果为True则返回字符串' T',如果为False则返回字符串' F'
|
181
|
+
def str_L10(logical):
|
182
|
+
if logical:
|
183
|
+
string = " T"
|
184
|
+
else:
|
185
|
+
string = " F"
|
186
|
+
return string
|
@@ -254,13 +254,13 @@ def merge(file_list, var_name=None, dim_name=None, target_filename=None):
|
|
254
254
|
|
255
255
|
merged_data = xr.Dataset(merged_data)
|
256
256
|
|
257
|
-
print("
|
257
|
+
print("\nWriting data to file ...")
|
258
258
|
if os.path.exists(target_filename):
|
259
259
|
print("Warning: The target file already exists.")
|
260
260
|
print("Removing existing file ...")
|
261
261
|
os.remove(target_filename)
|
262
262
|
merged_data.to_netcdf(target_filename)
|
263
|
-
print(f'
|
263
|
+
print(f'\nFile "{target_filename}" has been created.')
|
264
264
|
|
265
265
|
|
266
266
|
def _modify_var(nc_file_path, variable_name, new_value):
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding=utf-8
|
3
|
+
"""
|
4
|
+
Author: Liu Kun && 16031215@qq.com
|
5
|
+
Date: 2025-03-09 13:55:46
|
6
|
+
LastEditors: Liu Kun && 16031215@qq.com
|
7
|
+
LastEditTime: 2025-03-09 13:55:46
|
8
|
+
FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\oa_tool\\time.py
|
9
|
+
Description:
|
10
|
+
EditPlatform: vscode
|
11
|
+
ComputerInfo: XPS 15 9510
|
12
|
+
SystemInfo: Windows 11
|
13
|
+
Python Version: 3.12
|
14
|
+
"""
|
15
|
+
|
16
|
+
|
17
|
+
import calendar
|
18
|
+
|
19
|
+
__all__ = ["get_days"]
|
20
|
+
|
21
|
+
def get_days(year, month):
|
22
|
+
return calendar.monthrange(year, month)[1]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: oafuncs
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.97
|
4
4
|
Summary: Oceanic and Atmospheric Functions
|
5
5
|
Home-page: https://github.com/Industry-Pays/OAFuncs
|
6
6
|
Author: Kun Liu
|
@@ -33,6 +33,7 @@ Requires-Dist: geopandas
|
|
33
33
|
Requires-Dist: Cartopy
|
34
34
|
Requires-Dist: rasterio
|
35
35
|
Requires-Dist: salem
|
36
|
+
Requires-Dist: calendar
|
36
37
|
Dynamic: author
|
37
38
|
Dynamic: author-email
|
38
39
|
Dynamic: classifier
|
@@ -24,10 +24,16 @@ oafuncs/oa_down/idm.py
|
|
24
24
|
oafuncs/oa_down/literature.py
|
25
25
|
oafuncs/oa_down/test_ua.py
|
26
26
|
oafuncs/oa_down/user_agent.py
|
27
|
+
oafuncs/oa_model/__init__.py
|
28
|
+
oafuncs/oa_model/roms/__init__.py
|
29
|
+
oafuncs/oa_model/roms/test.py
|
30
|
+
oafuncs/oa_model/wrf/__init__.py
|
31
|
+
oafuncs/oa_model/wrf/little_r.py
|
27
32
|
oafuncs/oa_sign/__init__.py
|
28
33
|
oafuncs/oa_sign/meteorological.py
|
29
34
|
oafuncs/oa_sign/ocean.py
|
30
35
|
oafuncs/oa_sign/scientific.py
|
31
36
|
oafuncs/oa_tool/__init__.py
|
32
37
|
oafuncs/oa_tool/email.py
|
33
|
-
oafuncs/oa_tool/parallel.py
|
38
|
+
oafuncs/oa_tool/parallel.py
|
39
|
+
oafuncs/oa_tool/time.py
|
@@ -18,7 +18,7 @@ URL = 'https://github.com/Industry-Pays/OAFuncs'
|
|
18
18
|
EMAIL = 'liukun0312@stu.ouc.edu.cn'
|
19
19
|
AUTHOR = 'Kun Liu'
|
20
20
|
REQUIRES_PYTHON = '>=3.9.0' # 2025/01/05
|
21
|
-
VERSION = '0.0.
|
21
|
+
VERSION = '0.0.97'
|
22
22
|
|
23
23
|
# What packages are required for this module to be executed?
|
24
24
|
REQUIRED = [
|
@@ -43,8 +43,10 @@ REQUIRED = [
|
|
43
43
|
"geopandas",
|
44
44
|
"Cartopy",
|
45
45
|
# ------- Data ------
|
46
|
-
"rasterio",
|
47
|
-
"salem",
|
46
|
+
"rasterio", # 裁剪数据
|
47
|
+
"salem",
|
48
|
+
# ------ Time ------
|
49
|
+
"calendar",
|
48
50
|
# ------ Other ------
|
49
51
|
]
|
50
52
|
|
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
|