Add support for Omega split mesh and vertical coordinate datasets#736
Open
xylar wants to merge 5 commits into
Open
Add support for Omega split mesh and vertical coordinate datasets#736xylar wants to merge 5 commits into
xylar wants to merge 5 commits into
Conversation
ruff-format was added late in development and not all files were updated. Reformat depth.py, barotropic.py and plot.py to satisfy the ruff-format, flynt and import-sorting hooks, and add an explicit strict=True to the existing zip() calls flagged by ruff (B905), so the subsequent Omega changes land on a pre-commit-clean base. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Omega stores the vertical coordinate variables (minLevelCell, maxLevelCell and bottomDepth) in a dataset separate from the horizontal mesh. Add an optional ds_vert_coord argument (the same as ds_mesh by default) to compute_vertically_integrated_velocity, compute_barotropic_streamfunction and plot_feature_transects, and a corresponding --vert_coord option to the plot_feature_transects command, so these variables can be read from a separate dataset. layerThickness is a dynamic field, so it is now always read from the dynamic dataset rather than the mesh, and add_zmid reads it from its input file rather than the coordinate file. This is not backwards compatible. add_depth and compute_depth rely on the 1D refBottomDepth, which Omega and other general vertical coordinates do not provide. They now raise a clear error when refBottomDepth is missing and are documented as not supported for Omega, pointing users to the 3D zMid coordinate instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
add_zmid now reads layerThickness from the input file, so include it there in test_add_zmid. Add a test that add_depth raises a clear error when refBottomDepth is missing, as is the case for Omega. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a warning to the "Adding a Depth Coordinate" docs that add_depth and compute_depth rely on refBottomDepth and so assume a z-level/z-star vertical coordinate, which Omega does not provide. Point users to the 3D zMid coordinate instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bump the major version to reflect the non-backwards-compatible Omega changes: layerThickness must now come from the dynamic dataset rather than the mesh, and the refBottomDepth-based 1D depth coordinate is no longer supported for Omega. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
|
I will try to test this in Polaris soon, maybe over the weekend if I have some time to kill. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding support for Omega
Omega is the next-generation ocean model being developed alongside MPAS-Ocean. A key difference is how Omega organizes its data: instead of bundling the horizontal mesh, the vertical coordinate, and the model state all into a single file (as MPAS-Ocean has historically done), Omega keeps these as separate datasets. This PR updates the ocean tools in MPAS-Tools to work with that split layout, so the same analysis and visualization tools can be used for both MPAS-Ocean and Omega output.
What changed for users
A new, optional vertical-coordinate dataset. The barotropic streamfunction tools (
compute_barotropic_streamfunction,compute_vertically_integrated_velocity) and the transect plotting tool (plot_feature_transects) now accept an optionalds_vert_coordargument for the vertical coordinate variables (minLevelCell,maxLevelCell,bottomDepth). If you don't provide it, it defaults to your mesh dataset, so existing MPAS-Ocean workflows keep working unchanged.A new command-line option. The
plot_feature_transectscommand gains a--vert_coordoption to point at a separate vertical-coordinate file.Backwards-incompatible changes (why this is version 2.0.0)
Layer thickness now comes from the data file, not the mesh file. Layer thickness changes over time, so it is part of the model state, not the static mesh. Tools that previously read
layerThicknessfrom a mesh dataset now read it from the data (state) dataset. In the common case where your mesh and data are the same file, nothing changes. If you relied on passing a separate mesh file that carriedlayerThickness, that variable now needs to be in your data file. This also affectsadd_zmid, which now readslayerThicknessfrom its input file rather than the coordinate file.The 1D depth coordinate is no longer supported for Omega.
add_depth(and the underlyingcompute_depth) build an approximate 1Ddepthcoordinate fromrefBottomDepth, which only makes sense for a z-level/z-star vertical coordinate. Omega uses general vertical coordinates and does not providerefBottomDepth, so these tools now raise a clear error explaining the situation and pointing you to the 3DzMidcoordinate (add_zmid) instead. MPAS-Ocean z-star runs are unaffected.Testing
A pre-release,
2.0.0rc1, has been tagged for downstream testing. Existing depth unit tests were updated to match the new layer-thickness behavior, and a new test confirms the clear error whenrefBottomDepthis missing.🤖 Generated with Claude Code
Fixes #735