feat(vrt): single-band viewer VRTs for scalar datasets#68
Merged
Conversation
Adds a `viewer_bands()` hook to `Dataset` (analogous to `rgb_composites()`) and a `build_single_band_vrt_xml()` function to `vrt.py`. `_publish_rgb_vrts` now falls back to single-band Gray mosaic VRTs when no RGB composite exists, grouping by CRS WKT so a multi-UTM-zone run (e.g. SWOT France) emits one VRT per zone (`run-wse-epsg32631.vrt`). `SwotRaster100mDataset` overrides `viewer_bands()` to expose one composite per configured variable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #66.
Summary
SingleBandCompositedataclass todatasets/base.py(mirrorsRgbCompositebut for 1-band/scalar products)viewer_bands() -> list[SingleBandComposite]hook toDatasetbase (default:[])SwotRaster100mDatasetoverridesviewer_bands()to expose one composite per configured variable (e.g.wse)build_single_band_vrt_xml(grids)tovrt.py— same mosaic logic as RGB but emits a 1-band Gray VRTcrs_epsg(crs_wkt)helper to extract the outermost EPSG code from WKT (used for per-zone VRT naming)_publish_rgb_vrtsinrunner.pyto also iterateviewer_bands()after the RGB composites loop:run-wse-epsg32630.vrt,run-wse-epsg32631.vrt,run-wse-epsg32632.vrtinstead of nothingrun-wse.vrtTest plan
test_single_band_vrt_has_one_gray_band— Gray colorinterp, correct pixel valuetest_single_band_vrt_mosaics_two_tiles— union extent, correct DstRect placementtest_single_band_vrt_raises_on_empty_gridstest_crs_epsg_extracts_from_wkt— extracts outermost EPSG (not nested datum/spheroid codes)test_crs_epsg_returns_none_for_unknowntest_swot_viewer_bands_default— defaultwse→SingleBandComposite(name="wse", band="wse")test_swot_viewer_bands_custom_variablestest_base_dataset_viewer_bands_returns_empty— SingleObjectDataset returns[]🤖 Generated with Claude Code