Skip to content

Plume refactor for wind at height field computation by Plume#23

Open
cducher wants to merge 4 commits intodevelopfrom
feature/model-data-extension-to-derived-fields
Open

Plume refactor for wind at height field computation by Plume#23
cducher wants to merge 4 commits intodevelopfrom
feature/model-data-extension-to-derived-fields

Conversation

@cducher
Copy link
Contributor

@cducher cducher commented Jan 7, 2026

Description

This PR equips Plume with the ability to control its own share of the data, via an observer/publisher pattern and update strategies.
This need comes from the GRIB2 migration which impacts the height levels computed by IFS. Instead of deferring the wind at height computation to the plugin, Plume can manage this diagnostic field and serve it to the plugins as it would for any model field.
The strategy mechanism implemented is generic and allows extension to other data types beyond fields (see README in plume/data/ for steps to add new strategies). The only concrete strategy implemented computes the wind at a given height from a wind field and the geopotential, compare to vdfvint subroutine for scientific correctness.
To apply the strategies, Plume model data and parameter representations have been refactored to allow model variables to be observed by Plume-owned variables, such that updates trigger a recomputation of the observing parameters. A templated approach was followed to allow seamless extension to more data types and dependency types.

This PR is separated in two main commits, the first one introduces the model data and parameter refactor with the new patterns, and the second one focuses on the Plume Manager, and handling the change from the client side (requesting derived fields, negotiating them, and creating them).

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.

@cducher cducher requested review from antons-it and dsarmany January 7, 2026 19:21
@cducher cducher self-assigned this Jan 7, 2026
@cducher cducher marked this pull request as draft January 7, 2026 19:29
@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2026

Codecov Report

❌ Patch coverage is 85.52223% with 140 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.53%. Comparing base (0b25e71) to head (a4aaae7).

Files with missing lines Patch % Lines
src/plume/data/ModelData.cc 56.60% 23 Missing ⚠️
examples/example3.cc 0.00% 17 Missing ⚠️
examples/example1.cc 0.00% 14 Missing ⚠️
examples/example2.cc 0.00% 14 Missing ⚠️
src/plume/data/ParameterCatalogue.cc 83.75% 13 Missing ⚠️
src/plume/data/ParameterValue.cc 71.42% 10 Missing ⚠️
src/plume/data/ParameterType.h 68.18% 7 Missing ⚠️
src/plume/data/ModelData.h 87.75% 6 Missing ⚠️
src/plume/api/plume.cc 78.26% 5 Missing ⚠️
src/plume/data/FieldProvider.h 91.52% 5 Missing ⚠️
... and 11 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #23      +/-   ##
===========================================
+ Coverage    69.16%   72.53%   +3.37%     
===========================================
  Files           78       88      +10     
  Lines         3162     3587     +425     
  Branches       273      313      +40     
===========================================
+ Hits          2187     2602     +415     
- Misses         975      985      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cducher cducher force-pushed the feature/model-data-extension-to-derived-fields branch from d79c935 to c4dc104 Compare January 8, 2026 17:03
@cducher cducher force-pushed the feature/model-data-extension-to-derived-fields branch from c4dc104 to 23c124a Compare January 8, 2026 17:41
@cducher cducher marked this pull request as ready for review January 9, 2026 09:12
ASSERT(target);

const auto& field3d = target->get();
// @question: Should we make this a 3D field with nlevels = 1 to keep consistency with ifs Plume field provider ?
Copy link
Contributor Author

@cducher cducher Feb 20, 2026

Choose a reason for hiding this comment

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

Hi reviewers, please take a moment to look at this question because this has a strong impact on how the plugins will access the underlying data (see here).
I am under the impression that in the Plume module in IFS the 2D fields are built with a level key, so the atlas array has two dimensions and the second one is sized 1 for 2D fields, e.g. lnsp. Therefore, plugins using 2D fields will still use the same interface as 3D fields but hardcode the level to 0: lnspArr(index, 0) instead of lnspArr(index).
Should the strategies reproduce this structure ? Is it in fact necessary for the partitioning to happen correctly ? Or is it more idiomatic to create truly 1d atlas arrays like is currently done here ?

Copy link
Member

Choose a reason for hiding this comment

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

Partitioning is independent of the levels. Only the horizontal dimension is partitioned.

It is possible to follow this pattern to treat horizontal-only (2d) field as a field with also a single vertical level:

template <typename T>
atlas::array::View<const T, 2> make_3d_view(const atlas::Field& field) {
    using namespace atlas::array;
    if (field.levels()) {
        return make_view<const T, 2>(field);
    }
    else {
        return make_view<const T, 1>(field).slice(Range::all(), Range::dummy());
    }
}

The use is then:

auto const_view1_3d = make_3d_view<double>( field1_2d );
auto const_view2_3d = make_3d_view<double>( field2_3d );

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.

3 participants