Skip to content

DE-3673 Fix levtype for time statistics on snow depth (228141) - #294

Closed
cplltr wants to merge 5 commits into
ecmwf:hotfix/2.10.3from
cplltr:feature/snow-depth-statistics-climdt
Closed

cplltr wants to merge 5 commits into
ecmwf:hotfix/2.10.3from
cplltr:feature/snow-depth-statistics-climdt

Conversation

@cplltr

@cplltr cplltr commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

The climate DT portfolio required for CY49R3 includes snow depth water equivalent, both instantaneous (228141) and time-averaged (235078). These parameters should be encoded as both levtype=sfc (vertical sum) and levtype=sol (per-level, five layers for snow variables). The branch used by 49r3 climate DT has a sfc->sol mapping for paramid 228141 (instantaneous), but not for 235078 (its time-averaged version).

JIRA: https://jira.ecmwf.int/browse/DE-3673

Description

The sfc->sol levtype fix in fixMapToSol() covered the instantaneous snow
depth (228141) but not its statistically processed variants produced by
statistics-mtg2 (average->235078, max->237078, min->238078, stddev->239078).
As a result the monthly-averaged snow depth kept the wrong levtype and did
not encode/archive. Add the four time-processed params to the rule.

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

cplltr added 3 commits August 24, 2026 15:02
…c -> sol

The sfc->sol levtype fix in fixMapToSol() covered the instantaneous snow
depth (228141) but not its statistically processed variants produced by
statistics-mtg2 (average->235078, max->237078, min->238078, stddev->239078).
As a result the monthly-averaged snow depth kept the wrong levtype and did
not encode/archive. Add the four time-processed params to the rule.
@cplltr

cplltr commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Targetting hotfix/2.10.3 because it is the multio version currently used in the 49r3 bundle in ifs-raps

@cplltr

cplltr commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Addresses this raised issue: #293

@cplltr cplltr changed the title Fix levtype for time statistics on snow depth (228141) DE-3673 Fix levtype for time statistics on snow depth (228141) Aug 28, 2026
@cplltr

cplltr commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

This should merge cleanly into develop. Also now covers 238038 and 238 -- which are not needed in production, but can be useful for research,

@tweska tweska left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move away from applying fixes late in the MultIO pipeline, we already discussed on Teams. For now this can serve as a temporary fix for the problem we have.

Could we merge the two functions? And test the behavior for levelist=0 for all params, not just one.

Comment on lines 168 to +184
auto fixMapToSol() {
return rule(
all(OneOf{&dm::FullMarsRecord::levtype, {dm::LevType::SFC}}, Has{&dm::FullMarsRecord::levelist},
NoneOf{&dm::FullMarsRecord::levelist, {0}},
matchParams(33, 238, 228038, 228141, 235080, 237080, 238080, 239080, 260360, 262000, 262024, 260199)), //
setKey(&dm::FullMarsRecord::levtype, dm::LevType::SOL)); //
}

auto fixSnowMapToSol() {
return rule(
all(OneOf{&dm::FullMarsRecord::levtype, {dm::LevType::SFC}}, Has{&dm::FullMarsRecord::levelist},
NoneOf{&dm::FullMarsRecord::levelist, {0}},
matchParams(235078, 237078, 238078, 239078, 235238, 237238, 238238, 239238,
235406, 237406, 238406, 239406)), //
setKey(&dm::FullMarsRecord::levtype, dm::LevType::SOL));
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason for putting these mappings in it's own function? The function above does the exact same for a different set of params.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, not really. It's more for "human" understanding. There are two functions because snow variables have five layers and soil ones have four. But I think having all mappings in one function would do the same thing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I don't know, up to you... keep sol/snow separated, or merge them?

Comment thread tests/multio/mars2mars/test_multio_mars2mars_mappings.cc Outdated
@cplltr

cplltr commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants