freva-client 2507.0.0__tar.gz → 2508.0.0__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.
Potentially problematic release.
This version of freva-client might be problematic. Click here for more details.
- {freva_client-2507.0.0 → freva_client-2508.0.0}/PKG-INFO +1 -1
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/__init__.py +1 -1
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/utils/auth_utils.py +1 -1
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/utils/databrowser_utils.py +24 -11
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/utils/logger.py +1 -1
- {freva_client-2507.0.0 → freva_client-2508.0.0}/MANIFEST.in +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/README.md +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/assets/share/freva/freva.toml +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/pyproject.toml +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/__main__.py +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/auth.py +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/cli/__init__.py +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/cli/auth_cli.py +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/cli/cli_app.py +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/cli/cli_parser.py +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/cli/cli_utils.py +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/cli/databrowser_cli.py +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/py.typed +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/query.py +0 -0
- {freva_client-2507.0.0 → freva_client-2508.0.0}/src/freva_client/utils/__init__.py +0 -0
|
@@ -86,7 +86,7 @@ def is_jupyter_notebook() -> bool:
|
|
|
86
86
|
True if inside a Jupyter notebook or Jupyter kernel.
|
|
87
87
|
"""
|
|
88
88
|
try:
|
|
89
|
-
from IPython import get_ipython
|
|
89
|
+
from IPython import get_ipython # type: ignore[attr-defined]
|
|
90
90
|
|
|
91
91
|
return get_ipython() is not None # pragma: no cover
|
|
92
92
|
except Exception:
|
|
@@ -215,7 +215,7 @@ class UserDataHandler:
|
|
|
215
215
|
def __init__(self, userdata_items: List[Union[str, xr.Dataset]]) -> None:
|
|
216
216
|
self._suffixes = [".nc", ".nc4", ".grb", ".grib", ".zarr", "zar"]
|
|
217
217
|
self.user_metadata: List[
|
|
218
|
-
Dict[str, Union[str, List[str], Dict[str, str]]]
|
|
218
|
+
Dict[str, Union[str, List[str], Dict[str, str], None]]
|
|
219
219
|
] = []
|
|
220
220
|
self._metadata_collection: List[Dict[str, Union[str, List[str]]]] = []
|
|
221
221
|
try:
|
|
@@ -228,9 +228,12 @@ class UserDataHandler:
|
|
|
228
228
|
|
|
229
229
|
def _gather_files(self, path: Path, pattern: str = "*") -> Iterator[Path]:
|
|
230
230
|
"""Gather all valid files from directory and wildcard pattern."""
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
try:
|
|
232
|
+
for item in path.rglob(pattern):
|
|
233
|
+
if item.is_file() and item.suffix in self._suffixes:
|
|
234
|
+
yield item
|
|
235
|
+
except (OSError, PermissionError) as e: # pragma: no cover
|
|
236
|
+
logger.warning(f"Error accessing path {path}: {e}")
|
|
234
237
|
|
|
235
238
|
def _validate_user_data(
|
|
236
239
|
self,
|
|
@@ -328,7 +331,7 @@ class UserDataHandler:
|
|
|
328
331
|
|
|
329
332
|
def _get_metadata(
|
|
330
333
|
self, path: Union[os.PathLike[str], xr.Dataset]
|
|
331
|
-
) -> Dict[str, Union[str, List[str], Dict[str, str]]]:
|
|
334
|
+
) -> Dict[str, Optional[Union[str, List[str], Dict[str, str]]]]:
|
|
332
335
|
"""Get metadata from a path or xarray dataset."""
|
|
333
336
|
time_coder = xr.coders.CFDatetimeCoder(use_cftime=True)
|
|
334
337
|
try:
|
|
@@ -352,9 +355,12 @@ class UserDataHandler:
|
|
|
352
355
|
return {}
|
|
353
356
|
if len(times) > 0:
|
|
354
357
|
try:
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
+
try:
|
|
359
|
+
time_str = (
|
|
360
|
+
f"[{times[0].isoformat()}Z TO {times[-1].isoformat()}Z]"
|
|
361
|
+
)
|
|
362
|
+
except (AttributeError, IndexError):
|
|
363
|
+
time_str = "fx"
|
|
358
364
|
dt = (
|
|
359
365
|
abs((times[1] - times[0]).total_seconds())
|
|
360
366
|
if len(times) > 1
|
|
@@ -389,8 +395,15 @@ class UserDataHandler:
|
|
|
389
395
|
and var.lower() not in ["rotated_pole", "rot_pole"]
|
|
390
396
|
]
|
|
391
397
|
|
|
392
|
-
_data: Dict[str, Union[str, List[str], Dict[str, str]]] = {}
|
|
393
|
-
|
|
398
|
+
_data: Dict[str, Optional[Union[str, List[str], Dict[str, str]]]] = {}
|
|
399
|
+
if variables:
|
|
400
|
+
_data.setdefault("variable", variables[0])
|
|
401
|
+
elif data_vars: # pragma: no cover
|
|
402
|
+
_data.setdefault("variable", data_vars[0])
|
|
403
|
+
logger.info(f"No filtered variables found in {path}, using {data_vars[0]}")
|
|
404
|
+
else: # pragma: no cover
|
|
405
|
+
_data.setdefault("variable", None)
|
|
406
|
+
logger.warning(f"No data variables found in {path}")
|
|
394
407
|
_data.setdefault(
|
|
395
408
|
"time_frequency", self._get_time_frequency(dt, time_freq)
|
|
396
409
|
)
|
|
@@ -400,5 +413,5 @@ class UserDataHandler:
|
|
|
400
413
|
if isinstance(path, Path):
|
|
401
414
|
_data["file"] = str(path)
|
|
402
415
|
if isinstance(path, xr.Dataset):
|
|
403
|
-
_data["file"] =
|
|
416
|
+
_data["file"] = dset.encoding.get("source", None)
|
|
404
417
|
return _data
|
|
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
|