-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jigsaw_to_netcdf: bug fix for POINT coordinates #549
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small suggestion. If we're not assuming the mesh dimension has to be 3, let's be explicit about the fact that we assume it's either 2 or 3.
Co-authored-by: Xylar Asay-Davis <[email protected]>
@matthewhoffman and/or @trhille, is this a script you currently use? If so, could you try it out and make sure @cwsmith's changes fix issues and/or don't break anything in your current workflows? |
@matthewhoffman and @trhille, sorry, I hadn't read @cwsmith's description above carefully. It would appear you all need this fix for your workflows to work with the Jigsaw version we are now using in Compass. So it would be relatively urgent to get this reviewed and merged (and Compass updated to use a new version of MPAS-Tools with this fix). |
At least for the Greenland and Antarctica compass landice mesh gen test cases, the fix may not be required as the ID column/entry in the Jigsaw mesh file/data is always zero which is the coordinate that those cases need. |
I'm actually seeing failures during landice mesh creation due to this recent merge: #543. That's not a big deal in itself, although it shows that we need to update the data files on the LCRC server. But it makes me think I'm testing this incorrectly. |
@trhille Yeah, I use that same process to setup a dev branch of MPAS-Tools. I'm not sure why I didn't see that error. My only guess is that maybe the modified script from 543 wasn't copied into my previously existing 'install' dir. I can try to reproduce what you are seeing if that would be helpful. |
@trhille I rebased my dev branch on master and am hitting an assertion associated with the basal heat flux.
Is that what you saw? |
@cwsmith, yes that's the error I'm getting. I'll discuss with @matthewhoffman about the best way to fix this. |
@xylar and @cwsmith, I have two PRs open that will fix the issue with above landice mesh generation: #551 and MPAS-Dev/compass#767. We'll try to get those merged asap so that this can move ahead. |
@trhille, it looks like you don't need me to review either PR but let me know if you need any help testing. |
I tested this by checking out compass origin/main:
I then update MPAS-Tools to the current head:
I'll wait to confirm that everyone thinks this is adequate testing before I merge it. Thanks @cwsmith and @trhille for sorting out this complicated situation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cwsmith! I merged this into my local MPAS-Tools/master
, installed it in my compass dev using python -m pip install -e conda_package
, and ran all the landice mesh generation test cases with this fix. All tests passed. I have one small comment, but I'll let you decide whether to implement it.
elif msh['NDIMS'] == 3: | ||
zCell_full = msh['POINT'][:, 2] | ||
else: | ||
raise ValueError(f'Unexpected mesh NDIMS: {msh["NDIMS"]}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be helpful to specify in the error message that NDIMS should be 2 or 3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, @trhille. That's my fault for suggesting a relatively unhelpful error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. da0d533 has the verbose error message.
Okay, merging as soon as CI passes... |
This PR fixes a bug where the third column of the
POINTS
data from a Jigsaw file is read as a spatial coordinate for 2D when it should be read as an ID, or at least ignored. The change in this PR simply ignores it for 2D meshes. I may submit a follow up PR to extract the ID for ongoing landice work.The following Jigsaw wiki describes the mesh file format: https://github.com/dengwirda/jigsaw/wiki/MSH-File-Format#point-segment
Running
jigsaw_to_netcdf
andMpasMeshConverter.x
, with Jigsaw 1.0.0, on a 2dEUCLIDEAN-MESH
mesh (gis_2d_pointIds.zip) will demonstrate the bug withmaster
. Should I add this mesh to a test data set?All the compass
mesh_gen
tests are passing with this change. The testing setup and test output is below. As a sanity check I've also included the output ofpip show mpas_tools
that indicates that my local mpas_tools is used within the testing environment created withcompass setup
.details
compass test setup
env sanity check
run compass tests