Skip to content

Fix handling of optional variables in Unified BGC datasets#320

Merged
NoraLoose merged 9 commits into
CWorthy-ocean:mainfrom
NoraLoose:updated-unified-bgc
Jun 2, 2025
Merged

Fix handling of optional variables in Unified BGC datasets#320
NoraLoose merged 9 commits into
CWorthy-ocean:mainfrom
NoraLoose:updated-unified-bgc

Conversation

@NoraLoose
Copy link
Copy Markdown
Collaborator

@NoraLoose NoraLoose commented May 29, 2025

Summary

This PR fixes a bug in SurfaceForcing and ensures that optional variables in UnifiedBGCDataset and UnifiedBGCSurfaceDataset (used by InitialConditions, BoundaryForcing and SurfaceForcing) are handled correctly. Specifically, if an optional variable is present in the source data, it is now read from there rather than treated as missing and filled with a default value. This is especially relevant because Pierre has updated his "unified BGC dataset" so that it now includes not only required but also all optional variables (see #313).

Changes

  • Corrected logic to correctly detect and use available optional variables in SurfaceForcing.

  • Updated external test data to reflect a mix of present and missing optional variables for UnifiedBGCDataset and UnifiedBGCSurfaceDataset. The updated external data led to a necessary overwriting of the validation test data.

  • Added tests for SurfaceForcing, InitialConditions, BoundaryForcing to verify:

    • Present optional variables in UnifiedBGCDataset and UnifiedBGCSurfaceDataset retain their original (non-constant) values.
    • Missing optional variables are filled with constant default values.
  • Updated example notebooks to read from Pierre's extended unified BGC dataset, which now includes all optional variables.

Checklist

@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@ScottEilerman
Copy link
Copy Markdown
Contributor

Only looked at the .py files, but those look fine to me!

@NoraLoose
Copy link
Copy Markdown
Collaborator Author

Thanks @ScottEilerman!

@NoraLoose NoraLoose merged commit 3291d07 into CWorthy-ocean:main Jun 2, 2025
11 checks passed
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.

Integrate Pierre's updated unified BGC dataset

2 participants