|
| 1 | +# schismviz — Agent Instructions |
| 2 | + |
| 3 | +## Scope |
| 4 | + |
| 5 | +Use this file when working in the `schismviz/` workspace root. |
| 6 | + |
| 7 | +## Purpose |
| 8 | + |
| 9 | +`schismviz` provides interactive Panel + HoloViews visualizations and CLI tools for |
| 10 | +[SCHISM](https://ccrm.vims.edu/schismweb/) coastal hydrodynamic model outputs, calibration |
| 11 | +metrics, and observation data. It builds on **dvue** (sibling package) for catalog/manager/action |
| 12 | +patterns. |
| 13 | + |
| 14 | +## Fast Start For Agents |
| 15 | + |
| 16 | +```bash |
| 17 | +pip install -e ".[dev]" # development install |
| 18 | +pytest # run all tests |
| 19 | +pytest -m serial # run only serial tests (avoids race conditions) |
| 20 | +schismviz --help # CLI entry point |
| 21 | +``` |
| 22 | + |
| 23 | +Run examples: |
| 24 | +```bash |
| 25 | +schismviz output --yaml-file examples/schism_slr_studies.yaml |
| 26 | +schismviz calib examples/batch_metrics_itp2024.yaml |
| 27 | +schismviz viz mesh-view --help |
| 28 | +``` |
| 29 | + |
| 30 | +## Key Modules |
| 31 | + |
| 32 | +| Module | Purpose | |
| 33 | +|--------|---------| |
| 34 | +| [schismviz/cli.py](schismviz/cli.py) | Click CLI router; entry point `schismviz` | |
| 35 | +| [schismviz/schismui.py](schismviz/schismui.py) | `SchismDataUIManager`; extends `dvue.tsdataui.TimeSeriesDataUIManager` | |
| 36 | +| [schismviz/schismstudy.py](schismviz/schismstudy.py) | `SchismStudy`; reads SCHISM netCDF/station/flux outputs; unit conversion | |
| 37 | +| [schismviz/datastore.py](schismviz/datastore.py) | `StationDatastore`; reads observation time series from DMS datastore via CSV inventory | |
| 38 | +| [schismviz/viz_cli.py](schismviz/viz_cli.py) | `schismviz viz` sub-commands (mesh, elevation, velocity, stations) | |
| 39 | +| [schismviz/suxarray.py](schismviz/suxarray.py) | `UxDataset` wrapper for unstructured-mesh xarray + PyVista 3D rendering | |
| 40 | +| [schismviz/calibplot.py](schismviz/calibplot.py) | Low-level calibration scatter/KDE/time-series plot generation | |
| 41 | +| [schismviz/schismcalibplotui.py](schismviz/schismcalibplotui.py) | Calibration UI; extends `dvue.dataui.DataUI` | |
| 42 | + |
| 43 | +## Architecture |
| 44 | + |
| 45 | +Data flow: **CLI/YAML → UIManager → Catalog → Actions → Panel dashboard** |
| 46 | + |
| 47 | +- dvue framework provides base classes for managers, catalogs, and actions |
| 48 | +- SCHISM outputs read via xarray/netCDF4 and `schimpy` |
| 49 | +- Observation data via DMS datastore (CSV inventory + disk cache) |
| 50 | +- Panel for dashboards; HoloViews/Bokeh for plots |
| 51 | + |
| 52 | +## CLI Pattern |
| 53 | + |
| 54 | +All `viz` sub-commands support YAML config with CLI overrides: |
| 55 | +- YAML sections use underscores; CLI flags use hyphens |
| 56 | +- `--config` / `-c` accepts a YAML file; CLI args override YAML values |
| 57 | +- See [examples/viz_config_example.yaml](examples/viz_config_example.yaml) for reference |
| 58 | + |
| 59 | +## Conventions |
| 60 | + |
| 61 | +- UI manager classes: `*UI`, `*UIManager`, `*DataUIManager` (subclass dvue base classes) |
| 62 | +- Data classes use `param.Parameterized` |
| 63 | +- Logger per module: `logger = logging.getLogger(__name__)` |
| 64 | +- Flake8: max-line-length=100; see [setup.cfg](setup.cfg) |
| 65 | +- CRS hardcoded to EPSG:32610 (UTM Zone 10 N) for spatial data |
| 66 | +- Observation inventory CSV columns: `station_id`, `subloc`, `name`, `unit`, `param`, `filename`, `lat`, `lon`, `x`, `y` |
| 67 | + |
| 68 | +## Pitfalls |
| 69 | + |
| 70 | +- When extending with mixed catalogs (raw + math references), guard against NaN in filename columns — see `dvue/AGENTS.md` for the safe pattern. |
| 71 | +- HoloViews has issues with dots in dataset dimension names; see workaround in [calibplot.py](schismviz/calibplot.py). |
| 72 | +- `schout_reader.py` is pre-xarray; avoid extending it — use xarray-based paths instead. |
| 73 | +- Spatial operations assume UTM Zone 10 N (EPSG:32610); do not add CRS auto-detection without testing. |
| 74 | + |
| 75 | +## Docs & References |
| 76 | + |
| 77 | +- [README.md](README.md) — overview and quick-start |
| 78 | +- [README-cli.md](README-cli.md) — `schismviz output` and `schismviz calib` reference |
| 79 | +- [README-viz.md](README-viz.md) — `schismviz viz` reference |
| 80 | +- [examples/](examples/) — YAML configurations |
| 81 | +- [notebooks/](notebooks/) — Panel interactive dashboards (00–09) |
| 82 | +- Full docs: https://cadwrdeltamodeling.github.io/schismviz/html/index.html |
| 83 | + |
| 84 | +## Downstream Integration |
| 85 | + |
| 86 | +- Uses **dvue** for catalog/UI patterns — read `dvue/AGENTS.md` before changing manager or catalog behavior. |
| 87 | +- Observation data from **dms_datastore** package; do not add datastore logic inside schismviz. |
0 commit comments