Skip to content

Enable independent HC and RC in wind downscaling#2324

Draft
mo-AliceLake wants to merge 24 commits intofeature_update_wind_downscalingfrom
alice-split-winddownscaling
Draft

Enable independent HC and RC in wind downscaling#2324
mo-AliceLake wants to merge 24 commits intofeature_update_wind_downscalingfrom
alice-split-winddownscaling

Conversation

@mo-AliceLake
Copy link
Contributor

@mo-AliceLake mo-AliceLake commented Mar 9, 2026

DRAFT since this branches off #2315 so needs rebasing after that is reviewed and merged.

Description

This PR restructures the WindTerrainAdjustment plugin (previously RoughnessCorrection) to provide clean, explicit control over applying Roughness Correction (RC), Height Correction (HC), or their combined behaviour. The goal is to make HC‑only and RC‑only configurations explicitly selectable, allowing clearer scientific experimentation and operational configurations (e.g. HC‑only over UK-domain, etc).

Previously, HC and RC were tightly coupled within a single routine. Running only one of the corrections was possible but relied on implicit side‑effects (e.g. suppressing RC by passing z0=None), which was neither obvious nor robust. This PR replaces those implicit behaviours with a clear interface.

Previously, HC and RC were tightly coupled inside a single routine (do_rc_hc_all). This made it difficult to:

  • run HC or RC independently for testing or research,
  • apply only one component in operational setups,
  • clearly isolate the individual contribution, performance impacts, or numerical behaviour of HC vs RC.

Summary of Changes

Introduced explicit correction modes:

  • Split the existing do_rc_hc_all routine into three:
    • do_hc()
    • do_rc()
    • do_hc_and_rc() (chained, preserving legacy HC+RC behaviour)
  • Added a mode argument to the plugin constructor, allowing users to select:
    • "hc_and_rc" (default, identical to previous behaviour)
    • "hc"
    • "rc"

Clarified RC dependency on z0:
In the new interface, requesting RC (mode="rc" or "hc_and_rc") now requires a valid roughness‑length (z0) field. If it is missing, the plugin raises a clear ValueError.
This replaces the old implicit behaviour where suppressing RC was only achievable indirectly by passing z0=None. The new behaviour is explicit and predictable.

Unified masking and validation
Missing‑data, sea‑point, and invalid‑height masking has been consolidated and made consistent across RC, HC, and combined modes.

Testing

  • Ran tests and they passed OK
  • Added new tests for the new feature(s)

@mo-AliceLake mo-AliceLake changed the base branch from master to feature_update_wind_downscaling March 10, 2026 14:12
@mo-AliceLake mo-AliceLake force-pushed the alice-split-winddownscaling branch from 82e18ff to 41f9625 Compare March 11, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant