Skip to content

Update to jigsawpy - #301

Merged
mark-petersen merged 10 commits into
MPAS-Dev:ocean/developfrom
sbrus89:update_to_jigsawpy
Jun 28, 2019
Merged

mark-petersen merged 10 commits into
MPAS-Dev:ocean/developfrom
sbrus89:update_to_jigsawpy

Conversation

@sbrus89

@sbrus89 sbrus89 commented Jun 26, 2019

Copy link
Copy Markdown

Replaces the jigsaw-geo-matlab library in the mesh generation workflow with jigsawpy which is now a part of a new conda package. This conda environment can be activated on IC with the commands:

source /usr/projects/climate/SHARED_CLIMATE/anaconda_envs/base/etc/profile.d/conda.sh
conda activate compass_jigsawpy_py3.7

This PR is mostly @xylar's work. I just made a few tweaks to get it working.

xylar and others added 6 commits June 21, 2019 11:51
This merge:
* explicitly adds versions for mpas_tools, geometric_features and
  jigsaw
* clarifies replacing FULL_PATH_TO_MPAS_MODEL_REPO in 6 places (not
  just 1)
* makes a link to README_ocean.md in the ocean subdirectory
This is the first draft at switching from the Matlab to the python 3
interface to jigsaw.
 jigsawpy.lib.jigsaw -> jigsawpy.cmd.jigsaw
 - Needed for inject_meshDensity

 - Also, add a print statement for the JIGSAW step and update
   subsequent step numbers
@sbrus89

sbrus89 commented Jun 26, 2019

Copy link
Copy Markdown
Author

There's one thing I'd like other people's opinion on:

Do we still want to save the cellWidth.mat file? This used to be necessary to pass the results of the define_base_mesh.cellWidthVsLatLon() function to jigsaw_driver.m. Now that we've gotten rid of MATLAB, the actual arrays are being passed as calling arguments in jigsaw_driver.py. However, in its current form, inject_meshDensity.py still uses cellWidth.mat to read in the cellWidth, lon, and lat arrays.

It could be cleaner to pass the cellWidth, lon, and lat arrays in the inject_meshDensity function call, but to me that kind of makes inject_meshDensity less flexible because define_base_mesh.cellWidthVsLatLon() always has to be run beforehand. Maybe that's okay though?

@sbrus89

sbrus89 commented Jun 26, 2019

Copy link
Copy Markdown
Author

This isn't BFB with the meshes I had made previously. I guess I shouldn't expect them to be given that I'm now using the @xylar's conda package instead of my own conda installation and complied versions of jigsaw/mpas_tools executables.

Having a standard conda package from here on out should fix this issue.

@xylar

xylar commented Jun 26, 2019

Copy link
Copy Markdown
Collaborator

Do we still want to save the cellWidth.mat file? This used to be necessary to pass the results of the define_base_mesh.cellWidthVsLatLon() function to jigsaw_driver.m. Now that we've gotten rid of MATLAB, the actual arrays are being passed as calling arguments in jigsaw_driver.py. However, in its current form, inject_meshDensity.py still uses cellWidth.mat to read in the cellWidth, lon, and lat arrays.

It's okay to write these out to a file. But I really think a .mat file is inappropriate. I think we don't want anything to do with Matlab. They should be written to NetCDF either using xarray or NetCDF4, or if absolutely necessary to a standard format for numpy arrays (http://lagrange.univ-lyon1.fr/docs/numpy/1.11.0/reference/generated/numpy.save.html).

This isn't BFB with the meshes I had made previously. I guess I shouldn't expect them to be given that I'm now using the @xylar's conda package instead of my own conda installation and complied versions of jigsaw/mpas_tools executables.

I wouldn't count on this if the version of jigsaw changes or such. I don't think we have any reliable way of reconstructing an identical conda environment to what was used to build a given mesh (reconstructing a conda environment exactly is currently not an option with conda/conda-forge at the moment). So I think we have to live with bit-for-bit recreation of meshes not being possible once the conda environment that created them is no longer available.

@sbrus89

sbrus89 commented Jun 26, 2019

Copy link
Copy Markdown
Author

@xylar, writing it to netCDF is a good idea. I went ahead and did that in the commits above.

@pwolfram pwolfram left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @sbrus89 for this great update!

@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<config case="base_mesh">
<get_file dest_path="work_case_dir" file_name="topo.msh">

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@xylar, I don't think topo.msh is actually being used in the workflow right now. It might be a good idea to keep it around for visualization purposes. Was that the intention?

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.

i couldn't tell why this was part of so many test cases...

@mark-petersen mark-petersen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sbrus89 and @xylar thanks for your work on this.

After the above bug fix, I ran the nightly test suite successfully on IC, which includes the base mesh generation with jigsaw. Everything passes, but results on global meshes are not bfb with previous due to mesh alterations, as expected. Also tested EC60to30 base mesh creation, and that works.

@xylar, this is a convenient time to merge in for an E3SM PR. Can you approve? If small details remain, I'd rather correct them on a later PR.

@xylar xylar 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.

I don't have time to review this in detail. I'm on the London Tube home

@sbrus89

sbrus89 commented Jun 28, 2019

Copy link
Copy Markdown
Author

@mark-petersen, let me know if you want me to squash this down before you merge.

@mark-petersen

Copy link
Copy Markdown
Contributor

I removed those wget lines for topo.msh. It is not needed, and I don't want our COMPASS process to download a file every time we run an init case.

@mark-petersen

Copy link
Copy Markdown
Contributor

Merged locally, tested nightly regression suite once more, and EC60to30. All looks fine. Thanks @dengwirda, @xylar, and @sbrus89!

@mark-petersen
mark-petersen merged commit 9ec631e into MPAS-Dev:ocean/develop Jun 28, 2019
mark-petersen added a commit that referenced this pull request Jun 28, 2019
Replaces the jigsaw-geo-matlab library in the mesh generation workflow
with jigsawpy which is now a part of a new conda package. This conda
environment can be activated on IC with the commands:

source
/usr/projects/climate/SHARED_CLIMATE/anaconda_envs/base/etc/profile.d/conda.sh
conda activate compass_jigsawpy_py3.7

This PR is mostly @xylar's work. I just made a few tweaks to get it
working.
@sbrus89 sbrus89 mentioned this pull request Jun 28, 2019
@pwolfram
pwolfram deleted the update_to_jigsawpy branch August 13, 2019 16:39
ashwathsv pushed a commit to ashwathsv/MPAS-Model that referenced this pull request Jul 21, 2020
Replaces the jigsaw-geo-matlab library in the mesh generation workflow
with jigsawpy which is now a part of a new conda package. This conda
environment can be activated on IC with the commands:

source
/usr/projects/climate/SHARED_CLIMATE/anaconda_envs/base/etc/profile.d/conda.sh
conda activate compass_jigsawpy_py3.7

This PR is mostly @xylar's work. I just made a few tweaks to get it
working.
caozd999 pushed a commit to caozd999/MPAS-Model that referenced this pull request Jan 14, 2021
Replaces the jigsaw-geo-matlab library in the mesh generation workflow
with jigsawpy which is now a part of a new conda package. This conda
environment can be activated on IC with the commands:

source
/usr/projects/climate/SHARED_CLIMATE/anaconda_envs/base/etc/profile.d/conda.sh
conda activate compass_jigsawpy_py3.7

This PR is mostly @xylar's work. I just made a few tweaks to get it
working.
dustinswales added a commit to dustinswales/MPAS-Model that referenced this pull request Oct 29, 2026
…-Dev#301)

* update mpas init temperature extrapolation options

* fix bugs and enhance code for init extrapolation updates

* remove empty line

* Update README.md

---------

Co-authored-by: Jili Dong <[email protected]>
Co-authored-by: Dustin Swales <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants