ebas-plot 0.1.2__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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ebas-plot
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ebas-plot
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
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 +7,7 @@ import requests
7
7
  from netCDF4 import num2date
8
8
  import pandas as pd
9
9
 
10
- __version__ = "0.1.2"
10
+ __version__ = "0.1.3"
11
11
 
12
12
 
13
13
  class DatasetAccessError(Exception):
@@ -109,8 +109,6 @@ def validate_dataset(path: str) -> xr.Dataset | None:
109
109
  warnings.append(f"'{name}' has no 'ebas_unit' or 'units' attribute — unit label will be blank.")
110
110
 
111
111
  # --- Optional ---
112
- if "time_bnds" not in ds:
113
- warnings.append("Missing 'time_bnds' — hover text will show timestamps instead of sample periods.")
114
112
  if not ds.attrs.get("title") and not ds.attrs.get("ebas_station_name") and not ds.attrs.get("site_name"):
115
113
  warnings.append("Missing 'title'/'ebas_station_name'/'site_name' — plot title will be 'Unknown Site'.")
116
114
  if not ds.attrs.get("ebas_resolution_code"):
@@ -482,6 +480,8 @@ def _gap_fill_threshold(
482
480
  var_data: dict[str, np.ndarray] | None = None,
483
481
  ) -> int:
484
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
485
485
  gaps = []
486
486
  for name in plot_vars:
487
487
  arr = var_data[name] if var_data is not None and name in var_data else ds[name].values
@@ -652,6 +652,8 @@ def plot_timeseries(
652
652
 
653
653
  _time_step = pd.Series(pd.to_datetime(x_time)).diff().median()
654
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.")
655
657
  _max_gap_steps = _gap_fill_threshold(ds, plot_vars, _time_step, _var_data)
656
658
  if not use_scatter and not _has_line_segments(ds, plot_vars, _max_gap_steps, _var_data):
657
659
  raise ValueError(
File without changes
File without changes
File without changes
File without changes