Skip to content

feat(styling)!: grouped render parameters + a large vendored preset-library expansion - #275

Merged
MAfarrag merged 29 commits into
mainfrom
feat/widen-style-overrides
Aug 11, 2026
Merged

feat(styling)!: grouped render parameters + a large vendored preset-library expansion#275
MAfarrag merged 29 commits into
mainfrom
feat/widen-style-overrides

Conversation

@MAfarrag

@MAfarrag MAfarrag commented Aug 9, 2026

Copy link
Copy Markdown
Member

Description

Finalizes the grouped-parameter render API and substantially expands the vendored preset library.

Grouped render parameters (breaking). Completes the migration of ArrayGlyph / MeshGlyph
plot / animate / facet from flat keyword arguments to typed group objects —
data_style=DataStyle(...), color=ColorScaling(...), contour=Contour(...), cells=CellValues(...),
classify=Classify(...). The legacy-keyword shims are removed; passing a moved keyword now raises with a
pointer to the group object it belongs on. Per-call styled-preset overrides (bands / alpha / alpha_range)
ride on DataStyle, are sticky across calls on a reused glyph, and clear / switch opacity mode correctly.

Preset library expansionDATA_STYLES grows to ~200 presets across seven vendored libraries (built-in, ocean, NCL, terrain, scientific, radar, weather):

  • The full CAMS atmospheric-composition set (surface + total-column species, particulate matter, UV index,
    wildfire, and the pressure-level slices).
  • 39 perceptually-uniform scientific colour maps (scientific_presets.json) — so a caller can pick a colour
    map by name (style="batlow"), not only a variable.
  • 11 radar & satellite meteorology colour tables (radar_presets.json) — reflectivity (standard / expanded /
    clear-air), radial velocity, spectrum width, precipitation accumulation, and infrared / water-vapour enhancement.
  • The operational weather long tail — waves, upper-air temperature / wind / geopotential, vorticity /
    potential vorticity / divergence, humidity, hydrology, and instability indices.

Provenance naming. Vendored colour data is treated as derived data under neutral naming; the maintainer
download scripts are kept local-only (out of version control).

Notebooks. Seven example gallery notebooks (four CAMS + scientific / radar-satellite / operational-weather
galleries), executed end-to-end and committed output-free (the docs build re-executes them).

No new runtime dependency. An optional cleopatra[science-colors] extra enables namespaced colour maps
(cmocean:thermal, ...) via the numpy-only cmap aggregator.

Integration with main. main independently re-implemented much of this surface (the grouped-parameter refactor and the scientific / radar / terrain preset files) via #287 / #246, but without the neutral-source scrub. This branch merges origin/main in and reconciles the two: it keeps main's more complete grouped-parameter rollback (whole-merge, not style-only) and mesh contour support, keeps this branch's superset weather library (+28 presets) and the scrubbed, neutral-source naming, and re-strips every notebook the merge re-inflated. Post-merge the full suite is green (2232 passed) and SonarCloud is clean (quality gate OK, 0 open issues).

Issues

How Has This Been Tested?

  • Full non-e2e suite via the project's uv environment (uv run --active pytest) — 2232 passed.
  • /review-rounds — two independent adversarial review rounds + a SonarCloud sweep; every finding resolved
    (override clear/mode-switch bugs, a bands-on-diverging-preset warning, alpha_range validation, and S5778
    test smells).
  • Every vendored preset renders on realistic in-scale data (all assets schema-valid, no key collisions across
    the loaded libraries); the seven example notebooks execute end-to-end with zero errors.

Checklist:

  • updated version number in pyproject.toml
  • added changes to History.rst
  • updated the latest version in README file
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Follow-up to the grouped render-parameter refactor (#274): drop the
backward-compatible shims for the old loose keywords and complete the
facet parameter grouping.

- remove all deprecation shims (_resolve_point_overlay,
  _resolve_frame_label, _resolve_renamed_kwarg, _warn_deprecated_cbar_kwargs,
  _pop_first) across array_glyph, colorbar, and the six other glyphs
- remove the no_elem alias; rename text_colors to cell_value_text_colors
- group facet coordinate labels into PanelLabels; rename facet figsize
  to figure_size
- add a grouped render-parameter migration guide and wire it into mkdocs
- drop the deprecation tests, unwrap the still-functional
  cbar_*/ticks_spacing tests, and convert bare-array point tests to
  PointOverlay

BREAKING CHANGE: removed loose keywords now raise the ordinary TypeError,
and a bare array for points raises AttributeError. text_colors is renamed
to cell_value_text_colors, no_elem to num_domain_cells, and facet's figsize
to figure_size. Loose cbar_* / ticks_spacing keys still work but no longer
emit a deprecation warning.
Closes #281, #283, #285
…CAMS presets

Rebased the widen-style-overrides work onto the grouped render-parameter
refactor + legacy-kwarg-shim removal (PR #286). Squashes the branch's own
16 commits into one integration commit; all code is preserved, the loose
pre-shim-removal kwargs it relied on are dropped in favour of the group
objects already on main.

- widen per-call DATA_STYLES overrides (extend/levels/bands/alpha/
  alpha_range) via data_style=DataStyle, with resolve_style_overrides()
- vendor the full scientific perceptually-uniform colour-map set and the
  CAMS atmospheric-composition preset set; neutral provenance naming
- DataStyle alpha_range / bands validation and opacity-mode clearing
- keep colour-map download scripts local-only
- add example notebooks and the style-override test suite

Integrated cleanly onto the shim-removed API: full suite 2210 passed.
…CAMS presets

Rebased the widen-style-overrides work onto the grouped render-parameter
refactor + legacy-kwarg-shim removal (PR #286). Squashes the branch's own
16 commits into one integration commit; all code is preserved, the loose
pre-shim-removal kwargs it relied on are dropped in favour of the group
objects already on main.

- widen per-call DATA_STYLES overrides (extend/levels/bands/alpha/
  alpha_range) via data_style=DataStyle, with resolve_style_overrides()
- vendor the full scientific perceptually-uniform colour-map set and the
  CAMS atmospheric-composition preset set; neutral provenance naming
- DataStyle alpha_range / bands validation and opacity-mode clearing
- keep colour-map download scripts local-only
- add example notebooks and the style-override test suite

Integrated cleanly onto the shim-removed API: full suite 2210 passed.
@MAfarrag
MAfarrag force-pushed the feat/widen-style-overrides branch from 112835d to 6238a41 Compare August 10, 2026 19:17
…al source naming

Extend the vendored weather preset set with the operational long tail (84 -> 112
presets): wave/marine fields, cloud base/ceiling, pressure-level temperature /
wind / geopotential, vorticity / potential vorticity / divergence, humidity,
hydrology (runoff, snow-water-equivalent, river discharge, soil wetness), 2 m
temperature extremes, visibility, freezing rain, radiation and several indices;
16 fields now take the reference optimal look over the Magics palette. Four
contour-only upstream fields (mean sea-level pressure, sea-surface temperature,
500 hPa potential vorticity) are skipped.

Also drop the source-institution name from the codebase: the reference-basemap
styles are renamed to 'light'/'dark' (add_reference_map default is now 'light'),
provenance and prose across code, tests, docs and notebooks are neutralised, and
the example notebook is renamed. No new dependency.
Remove the maintainer weather-preset build script from version control and
gitignore it, matching the colour-map download scripts. It fetches the vendored
colour data from upstream mirrors and is kept only on the maintainer machine;
the baked weather_presets.json ships as normal and regeneration is a local-only
step.
…operational preset sets

Three executed-then-stripped gallery notebooks covering the newly vendored
presets: the 39 perceptually-uniform scientific colour maps (grouped
sequential/diverging/cyclic/multi), the 11 radar & satellite colour tables, and
the operational weather long tail (waves, upper-air temperature/wind, dynamics,
cloud & humidity, hydrology, indices). Each renders every preset on a synthetic
field mapped through its own scale.
@MAfarrag MAfarrag changed the title Feat/widen style overrides feat(styling)!: grouped render parameters + a large vendored preset-library expansion Aug 10, 2026
…y (Sonar S3776)

Extract the LINEAR and BOUNDARY_NORM cases (each carried a nested branch) into
_linear_norm/_boundary_norm helpers and fold the extend default into one
expression, dropping build_norm's cognitive complexity from 17 to under the 15
allowed. Behaviour unchanged.
Move the DataStyle/Classify constructions and the array/rng builders out of the
pytest.raises blocks in the style/scheme rejection tests, so each block has a
single throwing invocation under test.
'function' is the default pytest fixture scope, so the explicit argument is
redundant.
…358)

Restore the plain if/else form for the extend default; the nested ternary the
prior complexity fix introduced tripped S3358.
…alleries

Clear the leftover output cells and the iopub execution-timing metadata from
the CAMS, operational-weather, radar/satellite and scientific-colormap preset
notebooks so the committed copies are deterministic.
…wide

Remove output cells and iopub execution-timing metadata from every tracked
docs notebook so none carry rendered outputs in version control; the docs
build re-executes them.
…den-style-overrides

# Conflicts:
#	.gitignore
#	docs/notebooks/presets/cams_aerosols_and_particulates.ipynb
#	docs/notebooks/presets/cams_greenhouse_gases.ipynb
#	docs/notebooks/presets/cams_reactive_gases.ipynb
#	docs/notebooks/presets/cams_uv_and_fire.ipynb
#	docs/notebooks/presets/data_style_presets_examples.ipynb
#	docs/notebooks/presets/operational_temperature_animation.ipynb
#	docs/notebooks/projection/projection_examples.ipynb
#	examples/notebooks/temperature_colormap_comparison.ipynb
#	src/cleopatra/glyphs/gridded/array_glyph.py
#	src/cleopatra/glyphs/gridded/mesh_glyph.py
#	src/cleopatra/glyphs/stats/kde_glyph.py
#	src/cleopatra/styling/colors.py
#	src/cleopatra/styling/data/__init__.py
#	src/cleopatra/styling/data/weather_presets.json
#	tests/test_array_glyph.py
#	tests/test_colors.py
#	tests/test_kde_glyph.py
#	tests/test_review_fixes.py
#	tools/build_weather_presets.py
@sonarqubecloud

Copy link
Copy Markdown

@MAfarrag
MAfarrag merged commit 5802457 into main Aug 11, 2026
11 checks passed
@MAfarrag
MAfarrag deleted the feat/widen-style-overrides branch August 11, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant