ebas-plot 0.1.2__tar.gz → 0.1.4__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.4
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.4
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.4"
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"):
@@ -404,7 +402,11 @@ def plot_pnsd(ds: xr.Dataset) -> go.Figure:
404
402
  z=z,
405
403
  zmin=log_min,
406
404
  zmax=log_max,
407
- zsmooth='best',
405
+ # False renders each cell as its own actual value; 'best' smooths/
406
+ # interpolates between cells, which can paint spurious solid-color
407
+ # blocks at data gaps or resolution boundaries that don't match
408
+ # the underlying data (confirmed via hover z-value mismatch).
409
+ zsmooth=False,
408
410
  colorscale=plotly_discrete_colorscale,
409
411
  showscale=True,
410
412
  colorbar=dict(
@@ -482,6 +484,8 @@ def _gap_fill_threshold(
482
484
  var_data: dict[str, np.ndarray] | None = None,
483
485
  ) -> int:
484
486
  """Return how many consecutive NaN steps to interpolate over based on sampling frequency for line plots."""
487
+ if time_step <= pd.Timedelta(0): # duplicate/overlapping timestamps -- nothing to bridge
488
+ return 0
485
489
  gaps = []
486
490
  for name in plot_vars:
487
491
  arr = var_data[name] if var_data is not None and name in var_data else ds[name].values
@@ -652,6 +656,8 @@ def plot_timeseries(
652
656
 
653
657
  _time_step = pd.Series(pd.to_datetime(x_time)).diff().median()
654
658
  use_scatter = (mode or _default_plot_mode(ds, _time_step)) == "scatter"
659
+ if use_scatter and "time_bnds" not in ds:
660
+ print("WARNING: Missing 'time_bnds' — scatter-plot hover text will show timestamps instead of sample periods.")
655
661
  _max_gap_steps = _gap_fill_threshold(ds, plot_vars, _time_step, _var_data)
656
662
  if not use_scatter and not _has_line_segments(ds, plot_vars, _max_gap_steps, _var_data):
657
663
  raise ValueError(
File without changes
File without changes
File without changes
File without changes