added a method to get discrete colour from dataset config#1286
Merged
JustinElms merged 21 commits intomasterfrom Mar 23, 2026
Merged
added a method to get discrete colour from dataset config#1286JustinElms merged 21 commits intomasterfrom
JustinElms merged 21 commits intomasterfrom
Conversation
JustinElms
reviewed
Mar 19, 2026
JustinElms
reviewed
Mar 19, 2026
Contributor
|
Great start overall! A couple more thoughts in addition to the suggestions above:
|
JustinElms
previously approved these changes
Mar 23, 2026
JustinElms
approved these changes
Mar 23, 2026
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.
Background: Discrete Colormap Range Support
Ocean Navigator had no proper support for discrete/categorical variables (like seabed lithology or potential sub-surface channels) that represent distinct named categories rather than a continuous numeric range.
Previously these variables were:
Rendered with continuous color interpolation, which visually blurred distinct category boundaries
Displayed with a generic numeric colorbar that gave no indication of what each color meant
Controlled by min/max range inputs and an "Auto Range" toggle, which are meaningless for discrete categories
The "Potential Sub Surface Channel" colormap had its labels hardcoded directly in tile.py
Fix
Added map_colors and legend_labels properties to VariableConfig in dataset_config.py, reading per-variable color lists and human-readable category names from the dataset config files
Moved colormap color definitions out of hardcoded Python into the dataset config (e.g. psubsurfacechannel, lithology), making it data-driven
Rendering (Map, Tile, Hovmöller plots):
When a variable has legend_labels, rendering now uses BoundaryNorm instead of linear normalization, this produces sharp, discrete color boundaries rather than smooth gradients
The colorbar now shows the category names as tick labels instead of raw numbers, across map plots, tile scale bars, and Hovmöller plots
Frontend (UI):
ScaleViewer: when a variable has both legend_labels and map_colors, the range slider is replaced with a proper color swatch legend showing each category's color and name
AreaWindow: the "Auto Range" checkbox and manual range inputs are hidden entirely for discrete variables
api_v2_0: map_colors and legend_labels are now exposed through the variables API endpoint so the frontend can consume them
Checks
black ..Hint To run all python unit tests run the following command from the root repository directory: