oafuncs 0.0.59__py2.py3-none-any.whl → 0.0.60__py2.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.
@@ -4,8 +4,8 @@
4
4
  Author: Liu Kun && 16031215@qq.com
5
5
  Date: 2024-11-01 10:31:09
6
6
  LastEditors: Liu Kun && 16031215@qq.com
7
- LastEditTime: 2024-11-12 16:22:33
8
- FilePath: \\Python\\My_Funcs\\OAFuncs\\OAFuncs\\oa_down\\hycom_3hourly.py
7
+ LastEditTime: 2024-11-21 12:55:56
8
+ FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\oa_down\\hycom_3hourly.py
9
9
  Description:
10
10
  EditPlatform: vscode
11
11
  ComputerInfo: XPS 15 9510
@@ -234,8 +234,7 @@ def draw_time_range(pic_save_folder=None):
234
234
  plt.tight_layout()
235
235
  if pic_save_folder:
236
236
  plt.savefig(Path(pic_save_folder) / 'HYCOM_time_range.png')
237
- print(f'[bold green]HYCOM_time_range.png has been saved in {
238
- pic_save_folder}')
237
+ print(f'[bold green]HYCOM_time_range.png has been saved in {pic_save_folder}')
239
238
  else:
240
239
  plt.savefig('HYCOM_time_range.png')
241
240
  print('[bold green]HYCOM_time_range.png has been saved in the current folder')
@@ -247,8 +246,7 @@ def draw_time_range(pic_save_folder=None):
247
246
  def transform_time(time_str):
248
247
  # old_time = '2023080203'
249
248
  # time_new = '2023-08-02T03%3A00%3A00Z'
250
- time_new = f'{time_str[:4]}-{time_str[4:6]
251
- }-{time_str[6:8]}T{time_str[8:10]}%3A00%3A00Z'
249
+ time_new = f'{time_str[:4]}-{time_str[4:6]}-{time_str[6:8]}T{time_str[8:10]}%3A00%3A00Z'
252
250
  return time_new
253
251
 
254
252
 
@@ -271,8 +269,7 @@ def get_time_list(time_s, time_e, delta_hour):
271
269
 
272
270
 
273
271
  def get_nearest_level_index(depth):
274
- level_depth = [0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 15.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 125.0,
275
- 150.0, 200.0, 250.0, 300.0, 350.0, 400.0, 500.0, 600.0, 700.0, 800.0, 900.0, 1000.0, 1250.0, 1500.0, 2000.0, 2500.0, 3000.0, 4000.0, 5000]
272
+ level_depth = [0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 15.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 125.0, 150.0, 200.0, 250.0, 300.0, 350.0, 400.0, 500.0, 600.0, 700.0, 800.0, 900.0, 1000.0, 1250.0, 1500.0, 2000.0, 2500.0, 3000.0, 4000.0, 5000]
276
273
  return min(range(len(level_depth)), key=lambda i: abs(level_depth[i]-depth))
277
274
 
278
275
 
@@ -325,11 +322,9 @@ def set_query_dict_full(var, lon_min, lon_max, lat_min, lat_max, time_str_ymdh):
325
322
 
326
323
  def get_query_dict_single_depth(var, lon_min, lon_max, lat_min, lat_max, depth, time_str_ymdh):
327
324
  if var in ['ssh']:
328
- query_dict = set_query_dict_no_vertical(
329
- var, lon_min, lon_max, lat_min, lat_max, time_str_ymdh)
325
+ query_dict = set_query_dict_no_vertical(var, lon_min, lon_max, lat_min, lat_max, time_str_ymdh)
330
326
  else:
331
- query_dict = set_query_dict_depth_or_level(
332
- var, lon_min, lon_max, lat_min, lat_max, time_str_ymdh)
327
+ query_dict = set_query_dict_depth_or_level(var, lon_min, lon_max, lat_min, lat_max, time_str_ymdh)
333
328
  if var in ['u', 'v', 'temp', 'salinity']:
334
329
  print('Please ensure the depth is in the range of 0-5000 m')
335
330
  query_dict['vertCoord'] = get_nearest_level_index(depth)+1
@@ -338,12 +333,10 @@ def get_query_dict_single_depth(var, lon_min, lon_max, lat_min, lat_max, depth,
338
333
 
339
334
  def get_query_dict_single_level(var, lon_min, lon_max, lat_min, lat_max, level_num, time_str_ymdh):
340
335
  if var in ['ssh']:
341
- query_dict = set_query_dict_no_vertical(
342
- var, lon_min, lon_max, lat_min, lat_max, time_str_ymdh)
336
+ query_dict = set_query_dict_no_vertical(var, lon_min, lon_max, lat_min, lat_max, time_str_ymdh)
343
337
  else:
344
338
  # level_num: 1-40
345
- query_dict = set_query_dict_depth_or_level(
346
- var, lon_min, lon_max, lat_min, lat_max, time_str_ymdh)
339
+ query_dict = set_query_dict_depth_or_level(var, lon_min, lon_max, lat_min, lat_max, time_str_ymdh)
347
340
  if var in ['u', 'v', 'temp', 'salinity']:
348
341
  print('Please ensure the level_num is in the range of 1-40')
349
342
  if level_num == 0:
@@ -384,8 +377,6 @@ def ymd_in_which_dataset_and_version(time_ymdh):
384
377
  have_data = False
385
378
  for dataset_name in data_info['hourly']['dataset'].keys():
386
379
  for version_name in data_info['hourly']['dataset'][dataset_name]['version'].keys():
387
- # print(data_info['hourly']['dataset'][dataset_name]
388
- # ['version'][version_name]['time_range'].values())
389
380
  time_s, time_e = list(
390
381
  data_info['hourly']['dataset'][dataset_name]['version'][version_name]['time_range'].values())
391
382
  time_s, time_e = str(time_s), str(time_e)
@@ -401,7 +392,6 @@ def ymd_in_which_dataset_and_version(time_ymdh):
401
392
  print(f'[bold red]{time_ymdh} is in the following dataset and version:')
402
393
  if have_data:
403
394
  for d, v, trange in zip(d_list, v_list, trange_list):
404
- # print(f'{time_ymd} is in {d} {v} {trange}')
405
395
  print(f'[bold blue]{d} {v} {trange}')
406
396
  else:
407
397
  raise ValueError(
@@ -412,18 +402,14 @@ def direct_choose_dataset_and_version(time_ymdh):
412
402
  time_ymdh = int(time_ymdh)
413
403
  for dataset_name in data_info['hourly']['dataset'].keys():
414
404
  for version_name in data_info['hourly']['dataset'][dataset_name]['version'].keys():
415
- [time_s, time_e] = list(data_info['hourly']['dataset'][dataset_name]['version'][version_name]['time_range'].values(
416
- ))
417
- # print(time_s, time_e, time_ymd)
405
+ [time_s, time_e] = list(data_info['hourly']['dataset'][dataset_name]['version'][version_name]['time_range'].values())
418
406
  time_s, time_e = str(time_s), str(time_e)
419
407
  if len(time_s) == 8:
420
408
  time_s = time_s + '00'
421
409
  if len(time_e) == 8:
422
410
  time_e = time_e + '21'
423
411
  if time_ymdh >= int(time_s) and time_ymdh <= int(time_e):
424
- print(
425
- f'[bold purple]dataset: {dataset_name}, version: {version_name} is chosen')
426
- # print(f'{time_ymdh} is in {dataset_name} {version_name}')
412
+ print(f'[bold purple]dataset: {dataset_name}, version: {version_name} is chosen')
427
413
  return dataset_name, version_name
428
414
 
429
415
 
@@ -590,13 +576,8 @@ def dlownload_file(target_url, store_path, file_name, check=False):
590
576
  try:
591
577
  headers = {
592
578
  'User-Agent': get_ua()}
593
- # response = s.get(target_url, headers=headers, stream=True)
594
- # response = s.get(target_url, headers=headers,
595
- # proxies=get_proxy(), timeout=5)
596
579
  response = s.get(target_url, headers=headers,
597
580
  timeout=5)
598
- # response = s.get(target_url, headers=headers)
599
- # print(target_url)
600
581
  response.raise_for_status() # 如果请求返回的不是200,将抛出HTTPError异常
601
582
 
602
583
  # 保存文件
oafuncs/oa_help.py CHANGED
@@ -4,8 +4,8 @@
4
4
  Author: Liu Kun && 16031215@qq.com
5
5
  Date: 2024-10-06 19:25:29
6
6
  LastEditors: Liu Kun && 16031215@qq.com
7
- LastEditTime: 2024-10-06 19:55:04
8
- FilePath: \\Python\\My_Funcs\\OAFuncs\\OAFuncs\\oa_help.py
7
+ LastEditTime: 2024-11-21 12:59:18
8
+ FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\oa_help.py
9
9
  Description:
10
10
  EditPlatform: vscode
11
11
  ComputerInfo: XPS 15 9510
@@ -13,15 +13,14 @@ SystemInfo: Windows 11
13
13
  Python Version: 3.11
14
14
  '''
15
15
 
16
- import OAFuncs
17
-
16
+ import oafuncs
18
17
 
19
18
  def query():
20
19
  '''
21
20
  description: 查看OAFuncs模块的函数列表
22
21
  example: query()
23
22
  '''
24
- funcs = [func for func in dir(OAFuncs) if callable(getattr(OAFuncs, func))]
23
+ funcs = [func for func in dir(oafuncs) if callable(getattr(oafuncs, func))]
25
24
  print('函数数量:')
26
25
  print(len(funcs))
27
26
  print('函数列表:')
@@ -35,6 +34,6 @@ def use(func='get_var'):
35
34
  example: use('get_var')
36
35
  '''
37
36
  print('模块全路径:')
38
- print(getattr(OAFuncs, func).__module__+'.'+func)
37
+ print(getattr(oafuncs, func).__module__+'.'+func)
39
38
  print('函数提示:')
40
- print(getattr(OAFuncs, func).__doc__)
39
+ print(getattr(oafuncs, func).__doc__)
oafuncs/oa_python.py CHANGED
@@ -4,8 +4,8 @@
4
4
  Author: Liu Kun && 16031215@qq.com
5
5
  Date: 2024-10-11 21:02:07
6
6
  LastEditors: Liu Kun && 16031215@qq.com
7
- LastEditTime: 2024-10-11 21:47:19
8
- FilePath: \\Python\\My_Funcs\\OAFuncs\\OAFuncs\\oa_python.py
7
+ LastEditTime: 2024-11-21 10:59:53
8
+ FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\oa_python.py
9
9
  Description:
10
10
  EditPlatform: vscode
11
11
  ComputerInfo: XPS 15 9510
@@ -17,7 +17,8 @@ import os
17
17
 
18
18
  __all__ = ['install_lib', 'upgrade_lib']
19
19
 
20
- def install_lib(libs=None,python_exe='python'):
20
+
21
+ def install_lib(libs=None, python_exe='python'):
21
22
  '''
22
23
  libs: list, 需要安装的库
23
24
  python_exe: str, python版本;如在windows下,将python.exe复制为python312.exe,然后python_exe='python312'
@@ -26,7 +27,7 @@ def install_lib(libs=None,python_exe='python'):
26
27
  os.system(python_exe + " -m pip install --upgrade pip")
27
28
  if libs is None:
28
29
  libs = [
29
- # "OAFuncs", # 自己的库,在这个函数不宜操作,避免报错
30
+ # "oafuncs", # 自己的库,在这个函数不宜操作,避免报错
30
31
  "requests", # 网页
31
32
  "xlwt", # excel文件
32
33
  "xlrd", # excel文件
@@ -94,7 +95,7 @@ def install_lib(libs=None,python_exe='python'):
94
95
  print("安装失败:", str(e))
95
96
 
96
97
 
97
- def upgrade_lib(libs=None,python_exe='python'):
98
+ def upgrade_lib(libs=None, python_exe='python'):
98
99
  if libs is None:
99
100
  installed_libs = os.popen(python_exe + ' -m pip list').read()
100
101
  libs = installed_libs
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oafuncs
3
- Version: 0.0.59
3
+ Version: 0.0.60
4
4
  Summary: My short description for my project.
5
- Home-page: https://github.com/Industry-Pays/oafuncs
5
+ Home-page: https://github.com/Industry-Pays/OAFuncs
6
6
  Author: Kun Liu
7
7
  Author-email: liukun0312@stu.ouc.edu.cn
8
8
  License: MIT
@@ -48,12 +48,12 @@ Python Function
48
48
 
49
49
  <mark>注</mark>:若有需求,可邮件至`liukun0312@stu.ouc.edu.cn`,能力范围内可考虑实现
50
50
 
51
- **精力有限,部分函数使用说明文档未能及时更新/添加,可参考`结构`部分简述,再使用`OAFuncs.oa_help.use('func_name')`函数调取函数本身说明**
51
+ **精力有限,部分函数使用说明文档未能及时更新/添加,可参考`结构`部分简述,再使用`oafuncs.oa_help.use('func_name')`函数调取函数本身说明**
52
52
 
53
53
  ## PyPI
54
54
 
55
55
  ```html
56
- https://pypi.org/project/OAFuncs
56
+ https://pypi.org/project/oafuncs
57
57
  ```
58
58
 
59
59
  ## Github
@@ -3,11 +3,11 @@ oafuncs/oa_cmap.py,sha256=-R45Z8_uZ_aGZP3G6pv4iUG9Rv-ZX2ae5P04vW1tQK4,5100
3
3
  oafuncs/oa_data.py,sha256=pI9GyROoBRDTM1RFMSxE0Pym2Wi7I7dxaghi2yG2PHQ,8478
4
4
  oafuncs/oa_draw.py,sha256=SWwh8t52GvGo-qtZj7NY2Ehi4FVcjsbMCmG_rCwFzz0,18168
5
5
  oafuncs/oa_file.py,sha256=-PM7wsbc_CQoW-c2p8IUBR7QkWVLGRi-NamicgOyADc,10231
6
- oafuncs/oa_help.py,sha256=WV-HyOLJ5yujvEx8XVcXUNBs7cI6jVKuqbg1htUpSFs,1002
6
+ oafuncs/oa_help.py,sha256=ppNktmtNzs15R20MD1bM7yImlTQ_ngMwvoIglePOKXA,1000
7
7
  oafuncs/oa_nc.py,sha256=59_UvWqm1mqh3323huw0H1-L1TETmUF5st7kEsiHv6U,12432
8
- oafuncs/oa_python.py,sha256=WTfVA6X09PJBojt3c_119v42a-3O4SDCKCwe0wA0OQQ,3990
8
+ oafuncs/oa_python.py,sha256=XPTP3o7zTFzfJR_YhsKfQksa3bSYwXsne9YxlJplCEA,3994
9
9
  oafuncs/oa_down/__init__.py,sha256=s-XGVJ4z5m3pwIJGfifvkbSt_VFVqtrfFvP7fJxbs04,538
10
- oafuncs/oa_down/hycom_3hourly.py,sha256=4EgEK1zMZA_FgGcCO1HW2lH3Rn5cZpTDNcLgjx6tQDM,45443
10
+ oafuncs/oa_down/hycom_3hourly.py,sha256=xtK4nKFBIgBD24_ryDYvFbk746NdFsm3UmX4iG3XbiQ,44667
11
11
  oafuncs/oa_down/refs_pdf.py,sha256=HTOkAerWpyRatY-zh4vyjh2vkOnmM2thrmU4O67VZCQ,18104
12
12
  oafuncs/oa_sign/__init__.py,sha256=QKqTFrJDFK40C5uvk48GlRRbGFzO40rgkYwu6dYxatM,563
13
13
  oafuncs/oa_sign/meteorological.py,sha256=B0Nr-w6gUnNSJvtrNSg4fslJH1rzhdpglcJQA9ixNbc,6658
@@ -15,8 +15,8 @@ oafuncs/oa_sign/ocean.py,sha256=s9BGtsFECbYGvCFmWRb_mFJwncBn_90aYGyDSEh8iA0,6025
15
15
  oafuncs/oa_sign/scientific.py,sha256=a4JxOBgm9vzNZKpJ_GQIQf7cokkraV5nh23HGbmTYKw,5064
16
16
  oafuncs/oa_tool/__init__.py,sha256=IKOlqpWlb4cMDCtq2VKR_RTxQHDNqR_vfqqsOsp_lKQ,466
17
17
  oafuncs/oa_tool/email.py,sha256=7EX3VkD8TxYAKPLOuC_yS104p9zbKilZlGfkVa2C6BQ,2947
18
- oafuncs-0.0.59.dist-info/LICENSE.txt,sha256=rMtLpVg8sKiSlwClfR9w_Dd_5WubTQgoOzE2PDFxzs4,1074
19
- oafuncs-0.0.59.dist-info/METADATA,sha256=tRIrU7no4F1i2vkLZeLE21pqB6m7h7-n_QAvgYX6BF0,22376
20
- oafuncs-0.0.59.dist-info/WHEEL,sha256=pxeNX5JdtCe58PUSYP9upmc7jdRPgvT0Gm9kb1SHlVw,109
21
- oafuncs-0.0.59.dist-info/top_level.txt,sha256=bgC35QkXbN4EmPHEveg_xGIZ5i9NNPYWqtJqaKqTPsQ,8
22
- oafuncs-0.0.59.dist-info/RECORD,,
18
+ oafuncs-0.0.60.dist-info/LICENSE.txt,sha256=rMtLpVg8sKiSlwClfR9w_Dd_5WubTQgoOzE2PDFxzs4,1074
19
+ oafuncs-0.0.60.dist-info/METADATA,sha256=pQ_tR-6foCuWYxERjCh3vWuqfLA3cwK-VuiuW8jEESs,22376
20
+ oafuncs-0.0.60.dist-info/WHEEL,sha256=pxeNX5JdtCe58PUSYP9upmc7jdRPgvT0Gm9kb1SHlVw,109
21
+ oafuncs-0.0.60.dist-info/top_level.txt,sha256=bgC35QkXbN4EmPHEveg_xGIZ5i9NNPYWqtJqaKqTPsQ,8
22
+ oafuncs-0.0.60.dist-info/RECORD,,