Skip to content

Enable parsing a 1D JEDI variable into a multi-level OPS variable - #306

Merged
Matt Shin (matthewrmshin) merged 8 commits into
developfrom
feature/jedi-1d-to-ops-levels
Dec 2, 2026
Merged

Matt Shin (matthewrmshin) merged 8 commits into
developfrom
feature/jedi-1d-to-ops-levels

Conversation

@lewisn-met

@lewisn-met lewisn-met commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR enables opsinputs to parse a 1D JEDI variable into a multi-level (2D) OPS variable explicitly. This is to enable feature parity between the obsGroup and OSDF when the switch is made.

This change should be net zero for the current KGO path and passes all ctests: KGOs

Previous behaviour

Currently this is possible purely due to a defect in the ObsGroup:

  • When querying MetaData/pressure (which has no channels) on the no_records 2D write path and a non-empty channel list, opsinputs calls obsspace_has() on MetaData/pressure_<channelnumber> for each channel number in the channel list.
  • The obsspace does not contain MetaData/pressure_<channelnumber>
  • The obsgroup strips _<channelnumber> off the variable name on each call performs a get_db on MetaData/pressure into the 2D array a number of times equal to the size of the channel list. In the OSDF case, the variable is not in the ObsSpace so we don't populate the array.
  • This is not tested for in opsinputs.

Behaviour after this PR

Following this PR, the parameter JediVarHasChannels (which defaults to true to preserve existing behaviour) can be set to false to allow the querying of MetaData/pressure by its unsuffixed name when constructing a 2D variable. In this case, the variable is retrieved once using get_db, then copied into the remaining levels of the 2D variable.

This behaviour is extended to variables other than MetaData/pressure, though these variables are not encountered during any KGO run.

@lewisn-met
lewisn-met marked this pull request as draft November 24, 2026 18:05
@lewisn-met
lewisn-met marked this pull request as ready for review November 24, 2026 18:13
@DJDavies2

Copy link
Copy Markdown
Collaborator

There are a few failures in the coding_norms task from fortitude, some lines with trailing whitespace.

@lewisn-met

Copy link
Copy Markdown
Contributor Author

David Davies (@DJDavies2) many thanks for flagging this - there's also a couple of ctests failing which I'll need to investigate, but I don't have much time to over the next few days. Will put this back into draft in the meantime.

@lewisn-met
lewisn-met marked this pull request as draft November 25, 2026 12:18
@lewisn-met
lewisn-met marked this pull request as ready for review November 26, 2026 09:50

@ctgh Chris Thomas (ctgh) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the fix!

@ctgh

Copy link
Copy Markdown
Collaborator

Can you please try triggering the CI again?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Regression coverage is still needed for unsuffixed-variable broadcasting across multiple channels, including missing metadata values and lookups that cannot be masked by ObsGroup’s suffix-stripping fallback.

1 open issue
What changed in this PR

This PR explicitly supports broadcasting 1D JEDI variables across multiple OPS output levels, removing reliance on ObsGroup’s channel-suffix fallback ahead of the OSDF transition.

Changes:

  • Adds optional JediVarHasChannels control, defaulting to true to preserve existing behavior.
  • Reads unchannelized real, time, and coordinate data once and copies it across output channels.
  • Enables this behavior for pressure and selected radar and level metadata.
File Description
src/​opsinputs/​opsinputs_varobswriter_mod.F90 Enables unsuffixed metadata reads at relevant writer call sites.
src/​opsinputs/​opsinputs_fill_mod.F90 Implements and documents channel-aware lookup and 1D-to-2D broadcasting.

Review effort: Balanced

Comment thread src/opsinputs/opsinputs_fill_mod.F90 Resolved
@lewisn-met

Copy link
Copy Markdown
Contributor Author

It is unlikely that I am going to have time to add the extra ctest that copilot has requested today - if the reviewers agree, as this is the last KGO blocking the OSDF switch-on, I'd advocate for merging now and adding the testing in a future PR. I'm happy that this functionality is tested by the KGOs being unchanged in the meantime.

@matthewrmshin
Matt Shin (matthewrmshin) merged commit bfaa3c7 into develop Dec 2, 2026
3 checks passed
@matthewrmshin
Matt Shin (matthewrmshin) deleted the feature/jedi-1d-to-ops-levels branch December 2, 2026 09:19
@lewisn-met lewisn-met modified the milestone: fot Dec 3, 2026
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.

6 participants