File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed
Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 66import pandas as pd
77import xarray as xr
88
9+ import cubedynamics .viz as viz
910from cubedynamics import pipe , verbs as v
1011
1112
@@ -47,3 +48,21 @@ def test_to_netcdf_roundtrip(tmp_path):
4748 loaded = xr .load_dataarray (path )
4849 xr .testing .assert_identical (da , loaded )
4950 xr .testing .assert_identical (da , result )
51+
52+
53+ def test_show_cube_lexcube_returns_original_cube (monkeypatch ):
54+ da = _make_time_series ()
55+ captured = {}
56+
57+ def fake_show (cube , ** kwargs ):
58+ captured ["cube" ] = cube
59+ captured ["kwargs" ] = kwargs
60+ return "widget"
61+
62+ monkeypatch .setattr (viz , "show_cube_lexcube" , fake_show )
63+
64+ result = (pipe (da ) | v .show_cube_lexcube (cmap = "Blues" )).unwrap ()
65+
66+ assert result is da
67+ assert captured ["cube" ] is da
68+ assert captured ["kwargs" ] == {"cmap" : "Blues" }
Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5+ from .. import viz
56from ..ops .io import to_netcdf
67from ..ops .ndvi import ndvi_from_s2
78from ..ops .stats import correlation_cube , variance , zscore
89from ..ops .transforms import anomaly , month_filter
910
11+
12+ def show_cube_lexcube (** kwargs ):
13+ """Pipe verb that renders the current cube via Lexcube widgets."""
14+
15+ def _op (da ):
16+ viz .show_cube_lexcube (da , ** kwargs )
17+ return da
18+
19+ return _op
20+
21+
1022__all__ = [
1123 "anomaly" ,
1224 "month_filter" ,
1527 "to_netcdf" ,
1628 "zscore" ,
1729 "ndvi_from_s2" ,
30+ "show_cube_lexcube" ,
1831]
Original file line number Diff line number Diff line change 1- """Subpackage for cubedynamics."""
1+ """Visualization helpers exposed at the package level."""
2+
3+ from __future__ import annotations
4+
5+ from .lexcube_viz import show_cube_lexcube
6+ from .qa_plots import plot_median_over_space
7+
8+ __all__ = ["show_cube_lexcube" , "plot_median_over_space" ]
You can’t perform that action at this time.
0 commit comments