Skip to content

Commit d8dbb22

Browse files
committed
Refactor SchismOut2DUIManager and SchismOutputUIDataManager to remove identity_key_columns and update catalog initialization
1 parent 1cca3e0 commit d8dbb22

3 files changed

Lines changed: 23 additions & 12 deletions

File tree

AGENTS.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,30 @@ All `viz` sub-commands support YAML config with CLI overrides:
6767

6868
## Pitfalls
6969

70-
- When extending with mixed catalogs (raw + math references), guard against NaN in filename columns — see `dvue/AGENTS.md` for the safe pattern.
70+
- When extending with mixed catalogs (raw + math references), guard against NaN in the
71+
**`source` column** (not `filename`) — see `dvue/AGENTS.md` for the safe pattern.
72+
`SchismDataUIManager.get_data_reference()` already does this correctly.
7173
- HoloViews has issues with dots in dataset dimension names; see workaround in [calibplot.py](schismviz/calibplot.py).
7274
- `schout_reader.py` is pre-xarray; avoid extending it — use xarray-based paths instead.
7375
- Spatial operations assume UTM Zone 10 N (EPSG:32610); do not add CRS auto-detection without testing.
7476

77+
## SchismDataUIManager — Catalog Pattern
78+
79+
`SchismDataUIManager` uses **dvue Pattern A** (live `DataCatalog`) with:
80+
81+
```python
82+
catalog = DataCatalog(primary_key=["source_num", "id", "variable"], crs=crs)
83+
```
84+
85+
- Multi-source by design — each SCHISM study output directory is a separate `source`.
86+
- The observation datastore uses `source="datastore"`.
87+
- `source_num` is auto-assigned in the order studies are passed to the constructor.
88+
- Refs are added with an **explicit `name`** (`f"{source}::{id}/{variable}"`) to preserve
89+
human-readable study-path identity; auto-derivation is skipped when `name` is set.
90+
- `_build_dvue_catalog()` is called after `super().__init__()` once the reader is ready.
91+
- Do **not** pass `url_column`, `url_num_column`, or `identity_key_columns` to `super().__init__()`
92+
these parameters no longer exist in dvue.
93+
7594
## Docs & References
7695

7796
- [README.md](README.md) — overview and quick-start

schismviz/out2dui.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,6 @@ class SchismOut2DUIManager(TimeSeriesDataUIManager):
123123
"""
124124

125125
study_name = param.String(default="out2d", doc="Label for this study")
126-
identity_key_columns = param.List(
127-
default=["variable", "node_name"],
128-
doc="Columns that identify a unique variable/node pair; used for Transform and Source Compare naming.",
129-
)
130126
show_source_compare = param.Boolean(
131127
default=True,
132128
doc="Show the Source Compare action in the Add to Catalog menu.",
@@ -155,7 +151,7 @@ def __init__(
155151
# calls get_data_catalog() and get_time_range() during setup.
156152
self._dfcat = self._build_catalog()
157153

158-
super().__init__(url_column="filename", **kwargs)
154+
super().__init__(**kwargs)
159155

160156
# Set visual styling param defaults *after* super().__init__()
161157
self.study_name = study_name

schismviz/schismui.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ def create_title(self, v):
129129
class SchismOutputUIDataManager(TimeSeriesDataUIManager):
130130

131131
convert_units = param.Boolean(default=True, doc="Convert units to SI")
132-
identity_key_columns = param.List(
133-
default=["id", "variable"],
134-
doc="Columns that identify a unique station/variable pair; used for Transform and Source Compare naming.",
135-
)
136132
show_source_compare = param.Boolean(
137133
default=True,
138134
doc="Show the Source Compare action in the Add to Catalog menu.",
@@ -162,7 +158,7 @@ def __init__(self, *studies, datastore=None, time_range=None, **kwargs):
162158
# data_catalog property returns None during base-class init (which triggers
163159
# the correct get_data_catalog() path rather than crashing with AttributeError).
164160
self._dvue_catalog = None
165-
super().__init__(url_column="filename", **kwargs)
161+
super().__init__(**kwargs)
166162
self.color_cycle_column = "id"
167163
self.dashed_line_cycle_column = "source"
168164
self.marker_cycle_column = "variable"
@@ -231,7 +227,7 @@ def _make_plot_action(self):
231227
return SchismTimeSeriesPlotAction()
232228

233229
def _build_dvue_catalog(self, crs=None) -> DataCatalog:
234-
catalog = DataCatalog(crs=crs)
230+
catalog = DataCatalog(primary_key=["source_num", "id", "variable"], crs=crs)
235231
for _, row in self.catalog.iterrows():
236232
ref_name = f"{row['source']}::{row['id']}/{row['variable']}"
237233
attrs = {k: v for k, v in row.items() if k != "geometry"}

0 commit comments

Comments
 (0)