Skip to content

CDDSO-648: Unify cell_methods when reading ocean data by removing "interval" specifications#453

Merged
Matthew Mizielinski (matthew-mizielinski) merged 3 commits into
v3.1_releasefrom
CDDSO-648_ignore_cell_methods_interval
Apr 25, 2025
Merged

CDDSO-648: Unify cell_methods when reading ocean data by removing "interval" specifications#453
Matthew Mizielinski (matthew-mizielinski) merged 3 commits into
v3.1_releasefrom
CDDSO-648_ignore_cell_methods_interval

Conversation

@matthew-mizielinski
Copy link
Copy Markdown
Collaborator

Some UKESM models have experienced problems due to changes in ocean timestep being made mid year as this propagates into the cell_methods attribute attached to data variables in the model input files.

This change adds an extra step before cubes are concatenated together within MIP Convert where the cell_methods are checked and, if necessary, unified by removing the "intervals" component of the CellMethod.

Note: this change should not affect PP atmosphere data as the timestep is not encoded in the PP header.

Copy link
Copy Markdown
Collaborator

@mo-kerstinschmatzer mo-kerstinschmatzer left a comment

Choose a reason for hiding this comment

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

LGTM

But tests are failing because of code style issues.

@matthew-mizielinski
Copy link
Copy Markdown
Collaborator Author

LGTM

But tests are failing because of code style issues.

Thanks -- I've fixed these tests and amended the docstring for the new function.

Copy link
Copy Markdown
Collaborator

@mo-jareddrayton Jared Drayton (mo-jareddrayton) left a comment

Choose a reason for hiding this comment

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

A few docstring/naming things (still looking at code changes).

  • The docstring return section can go as cubes are modified in place
  • The docstring cubes argument should be a iris.cube.CubeList rather than iris.cube.Cube.
  • The function says remove_cell... but as far as I can tell it is unifying the interval cell methods rather than removing them. Might be better to rename the function. EDIT: I see that they are removed.
  • The docstring format like a mix of both NumPy and Google style. (not that it matters that much as there are already at least three distinct docstring styles used throughout mip_convert...)

@matthew-mizielinski
Copy link
Copy Markdown
Collaborator Author

A few docstring/naming things (still looking at code changes).

  • The docstring return section can go as cubes are modified in place
  • The docstring cubes argument should be a iris.cube.CubeList rather than iris.cube.Cube.
  • The function says remove_cell... but as far as I can tell it is unifying the interval cell methods rather than removing them. Might be better to rename the function. EDIT: I see that they are removed.
  • The docstring format like a mix of both NumPy and Google style. (not that it matters that much as there are already at least three distinct docstring styles used throughout mip_convert...)

Thanks for catching this Jared, I think I started the docstring when I had accidentally put the code within one of the iris modules (don't ask) and failed to correct it when I moved the function to its current home.

Docstring simplified and updated format in 51c74cb

@matthew-mizielinski Matthew Mizielinski (matthew-mizielinski) merged commit 0f0bcd4 into v3.1_release Apr 25, 2025
1 check passed
Matthew Mizielinski (matthew-mizielinski) added a commit that referenced this pull request Apr 25, 2025
…terval" specifications (#453)

* CDDSO-648: Adding code to remove intervals from cell_methods in input data
@matthew-mizielinski
Copy link
Copy Markdown
Collaborator Author

cherry picked to main in 42c182f

@matthew-mizielinski Matthew Mizielinski (matthew-mizielinski) deleted the CDDSO-648_ignore_cell_methods_interval branch April 25, 2025 13:18
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