ebas-plot 0.1.1__tar.gz → 0.1.3__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.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ebas-plot
3
- Version: 0.1.1
4
- Summary: Plotting utilities for EBAS datasets served via THREDDS/OPeNDAP.
3
+ Version: 0.1.3
4
+ Summary: Plotting utilities for EBAS netCDF datasets.
5
5
  Author-email: Lise Eder Murberg <lemu@nilu.no>, Marthe Brevig <mbre@nilu.no>, Jonathan Elias Holme <jhol@nilu.no>
6
6
  License-Expression: AGPL-3.0-or-later
7
7
  Project-URL: Homepage, https://git.nilu.no/ebas/ebas-web/ebas-web-plotting
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ebas-plot
3
- Version: 0.1.1
4
- Summary: Plotting utilities for EBAS datasets served via THREDDS/OPeNDAP.
3
+ Version: 0.1.3
4
+ Summary: Plotting utilities for EBAS netCDF datasets.
5
5
  Author-email: Lise Eder Murberg <lemu@nilu.no>, Marthe Brevig <mbre@nilu.no>, Jonathan Elias Holme <jhol@nilu.no>
6
6
  License-Expression: AGPL-3.0-or-later
7
7
  Project-URL: Homepage, https://git.nilu.no/ebas/ebas-web/ebas-web-plotting
@@ -7,7 +7,7 @@ import requests
7
7
  from netCDF4 import num2date
8
8
  import pandas as pd
9
9
 
10
- __version__ = "0.1.1"
10
+ __version__ = "0.1.3"
11
11
 
12
12
 
13
13
  class DatasetAccessError(Exception):
@@ -99,16 +99,16 @@ def validate_dataset(path: str) -> xr.Dataset | None:
99
99
  errors.append("Missing required 'time' dimension/coordinate.")
100
100
 
101
101
  plot_vars = _plot_vars(ds)
102
- if not plot_vars:
102
+ pnsd_var = _pnsd_var(ds)
103
+ valid_vars = plot_vars or ([pnsd_var] if pnsd_var is not None else [])
104
+ if not valid_vars:
103
105
  errors.append("No plottable variables found — need at least one 'v_*' float variable with a 'time' dimension.")
104
106
  else:
105
- for name in plot_vars:
107
+ for name in valid_vars:
106
108
  if not ds[name].attrs.get("ebas_unit") and not ds[name].attrs.get("units"):
107
109
  warnings.append(f"'{name}' has no 'ebas_unit' or 'units' attribute — unit label will be blank.")
108
110
 
109
111
  # --- Optional ---
110
- if "time_bnds" not in ds:
111
- warnings.append("Missing 'time_bnds' — hover text will show timestamps instead of sample periods.")
112
112
  if not ds.attrs.get("title") and not ds.attrs.get("ebas_station_name") and not ds.attrs.get("site_name"):
113
113
  warnings.append("Missing 'title'/'ebas_station_name'/'site_name' — plot title will be 'Unknown Site'.")
114
114
  if not ds.attrs.get("ebas_resolution_code"):
@@ -480,6 +480,8 @@ def _gap_fill_threshold(
480
480
  var_data: dict[str, np.ndarray] | None = None,
481
481
  ) -> int:
482
482
  """Return how many consecutive NaN steps to interpolate over based on sampling frequency for line plots."""
483
+ if time_step <= pd.Timedelta(0): # duplicate/overlapping timestamps -- nothing to bridge
484
+ return 0
483
485
  gaps = []
484
486
  for name in plot_vars:
485
487
  arr = var_data[name] if var_data is not None and name in var_data else ds[name].values
@@ -650,6 +652,8 @@ def plot_timeseries(
650
652
 
651
653
  _time_step = pd.Series(pd.to_datetime(x_time)).diff().median()
652
654
  use_scatter = (mode or _default_plot_mode(ds, _time_step)) == "scatter"
655
+ if use_scatter and "time_bnds" not in ds:
656
+ print("WARNING: Missing 'time_bnds' — scatter-plot hover text will show timestamps instead of sample periods.")
653
657
  _max_gap_steps = _gap_fill_threshold(ds, plot_vars, _time_step, _var_data)
654
658
  if not use_scatter and not _has_line_segments(ds, plot_vars, _max_gap_steps, _var_data):
655
659
  raise ValueError(
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "ebas-plot"
7
7
  dynamic = ["version"]
8
- description = "Plotting utilities for EBAS datasets served via THREDDS/OPeNDAP."
8
+ description = "Plotting utilities for EBAS netCDF datasets."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
11
11
  license = "AGPL-3.0-or-later"
File without changes
File without changes
File without changes