oafuncs 0.0.98.40__tar.gz → 0.0.98.41__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 (50) hide show
  1. {oafuncs-0.0.98.40/oafuncs.egg-info → oafuncs-0.0.98.41}/PKG-INFO +2 -1
  2. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_script/cprogressbar.py +2 -1
  3. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_file.py +12 -8
  4. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_nc.py +27 -4
  5. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41/oafuncs.egg-info}/PKG-INFO +2 -1
  6. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs.egg-info/requires.txt +1 -0
  7. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/setup.py +2 -1
  8. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/LICENSE.txt +0 -0
  9. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/MANIFEST.in +0 -0
  10. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/README.md +0 -0
  11. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/__init__.py +0 -0
  12. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_data/hycom.png +0 -0
  13. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_data/oafuncs.png +0 -0
  14. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_script/data_interp.py +0 -0
  15. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_script/email.py +0 -0
  16. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_script/netcdf_merge.py +0 -0
  17. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_script/netcdf_modify.py +0 -0
  18. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_script/netcdf_write.py +0 -0
  19. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_script/parallel.py +0 -0
  20. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_script/parallel_bak.py +0 -0
  21. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_script/plot_dataset.py +0 -0
  22. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/_script/replace_file_content.py +0 -0
  23. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_cmap.py +0 -0
  24. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_data.py +0 -0
  25. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_date.py +0 -0
  26. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_down/User_Agent-list.txt +0 -0
  27. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_down/__init__.py +0 -0
  28. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_down/hycom_3hourly.py +0 -0
  29. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_down/idm.py +0 -0
  30. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_down/literature.py +0 -0
  31. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_down/read_proxy.py +0 -0
  32. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_down/test_ua.py +0 -0
  33. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_down/user_agent.py +0 -0
  34. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_draw.py +0 -0
  35. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_help.py +0 -0
  36. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_model/__init__.py +0 -0
  37. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_model/roms/__init__.py +0 -0
  38. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_model/roms/test.py +0 -0
  39. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_model/wrf/__init__.py +0 -0
  40. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_model/wrf/little_r.py +0 -0
  41. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_python.py +0 -0
  42. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_sign/__init__.py +0 -0
  43. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_sign/meteorological.py +0 -0
  44. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_sign/ocean.py +0 -0
  45. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_sign/scientific.py +0 -0
  46. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs/oa_tool.py +0 -0
  47. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs.egg-info/SOURCES.txt +0 -0
  48. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs.egg-info/dependency_links.txt +0 -0
  49. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/oafuncs.egg-info/top_level.txt +0 -0
  50. {oafuncs-0.0.98.40 → oafuncs-0.0.98.41}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oafuncs
3
- Version: 0.0.98.40
3
+ Version: 0.0.98.41
4
4
  Summary: Oceanic and Atmospheric Functions
5
5
  Home-page: https://github.com/Industry-Pays/OAFuncs
6
6
  Author: Kun Liu
@@ -24,6 +24,7 @@ Requires-Dist: pandas
24
24
  Requires-Dist: xarray
25
25
  Requires-Dist: rich
26
26
  Requires-Dist: pathlib
27
+ Requires-Dist: lxml
27
28
  Requires-Dist: requests
28
29
  Requires-Dist: bs4
29
30
  Requires-Dist: httpx
@@ -189,7 +189,8 @@ class ColorProgressBar:
189
189
  self._is_jupyter = "ipykernel" in sys.modules
190
190
 
191
191
  # 输出样式
192
- filled_list = ["▊", "█", "▓", "▒", "░", "#", "=", ">", "▌", "▍", "▎", "▏", "*"]
192
+ # filled_list = ["▊", "█", "▓", "▒", "░", "#", "=", ">", "▌", "▍", "▎", "▏", "*"]
193
+ filled_list = ["█", "▓", "▒", "░", "#", "=", ">", "*"]
193
194
  self.filled = random.choice(filled_list)
194
195
 
195
196
  def _generate_gradient(self) -> Optional[List[str]]:
@@ -160,14 +160,18 @@ def move_file(source_pattern: str, destination: str) -> None:
160
160
  if dst_dir:
161
161
  os.makedirs(dst_dir, exist_ok=True)
162
162
 
163
- # Remove existing destination if it exists
164
- if os.path.exists(dst_file):
165
- if os.path.isdir(dst_file):
166
- shutil.rmtree(dst_file)
167
- else:
168
- os.remove(dst_file)
169
-
170
- shutil.move(src_file, dst_file)
163
+ if os.path.exists(src_file):
164
+ # Remove existing destination if it exists
165
+ if os.path.exists(dst_file):
166
+ if os.path.isdir(dst_file):
167
+ shutil.rmtree(dst_file)
168
+ else:
169
+ os.remove(dst_file)
170
+
171
+ shutil.move(src_file, dst_file)
172
+ else:
173
+ print(f"[yellow]Source file not found:[/yellow] [bold]{src_file}[/bold]")
174
+ continue
171
175
  print(f"[green]Successfully moved:[/green] [bold]{src_file}[/bold] -> [bold]{dst_file}[/bold]")
172
176
  except Exception as e:
173
177
  print(f"[red]Failed to move:[/red] [bold]{src_file}[/bold]. Error: {e}")
@@ -207,14 +207,37 @@ def convert_longitude(
207
207
  >>> dataset = convert_longitude(dataset, longitude_name="lon", target_range=360)
208
208
  """
209
209
  if target_range not in [180, 360]:
210
- raise ValueError("target_range value must be 180 or 360")
210
+ raise ValueError("target_range must be 180 or 360")
211
211
 
212
+ lon = dataset[longitude_name]
213
+ current_min, current_max = np.nanmin(lon), np.nanmax(lon)
214
+
215
+ # 检查是否已在目标范围
216
+ if target_range == 180:
217
+ if -180 <= current_min and current_max <= 180:
218
+ return dataset # 已在[-180,180]范围
219
+ else:
220
+ if 0 <= current_min and current_max <= 360:
221
+ return dataset # 已在[0,360]范围
222
+
223
+ # 执行转换(带边界平滑)
212
224
  if target_range == 180:
213
- dataset = dataset.assign_coords({longitude_name: (dataset[longitude_name] + 180) % 360 - 180})
225
+ # >180 的值减去360,保持连续性
226
+ new_lon = xr.where(lon > 180, lon - 360, lon)
227
+ # 处理负值(如-200 -> 160)
228
+ new_lon = xr.where(new_lon < -180, new_lon + 360, new_lon)
214
229
  else:
215
- dataset = dataset.assign_coords({longitude_name: (dataset[longitude_name] + 360) % 360})
230
+ new_lon = lon % 360 # 自动处理负值
231
+
232
+ # 检查并处理重复坐标
233
+ if len(new_lon) != len(np.unique(new_lon)):
234
+ raise ValueError("转换导致经度坐标重复,请检查数据边界值")
235
+
236
+ # 仅当非单调时排序
237
+ if not new_lon.is_monotonic_increasing:
238
+ dataset = dataset.sortby(longitude_name)
216
239
 
217
- return dataset.sortby(longitude_name)
240
+ return dataset.assign_coords({longitude_name: new_lon})
218
241
 
219
242
 
220
243
  def isel(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oafuncs
3
- Version: 0.0.98.40
3
+ Version: 0.0.98.41
4
4
  Summary: Oceanic and Atmospheric Functions
5
5
  Home-page: https://github.com/Industry-Pays/OAFuncs
6
6
  Author: Kun Liu
@@ -24,6 +24,7 @@ Requires-Dist: pandas
24
24
  Requires-Dist: xarray
25
25
  Requires-Dist: rich
26
26
  Requires-Dist: pathlib
27
+ Requires-Dist: lxml
27
28
  Requires-Dist: requests
28
29
  Requires-Dist: bs4
29
30
  Requires-Dist: httpx
@@ -4,6 +4,7 @@ pandas
4
4
  xarray
5
5
  rich
6
6
  pathlib
7
+ lxml
7
8
  requests
8
9
  bs4
9
10
  httpx
@@ -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.10.0" # 2025/03/13
21
- VERSION = "0.0.98.40"
21
+ VERSION = "0.0.98.41"
22
22
 
23
23
  # What packages are required for this module to be executed?
24
24
  REQUIRED = [
@@ -32,6 +32,7 @@ REQUIRED = [
32
32
  # ------ Path ------
33
33
  "pathlib",
34
34
  # ------ Internet ------
35
+ "lxml",
35
36
  "requests",
36
37
  "bs4",
37
38
  "httpx",
File without changes
File without changes
File without changes
File without changes