Skip to content

Move landice conda package scripts #596

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

Merged
merged 13 commits into from
Apr 3, 2025

Conversation

xylar
Copy link
Collaborator

@xylar xylar commented Jan 8, 2025

This merge aims to move 8 scrips used primarily or exclusively by MALI into the mpas_tools package as entry points.

The motivation for this is that we are engaging in Python package modernization on all MPAS-Dev and E3SM-Project repos, and in that process we discovered that modern packaging approaches do not support standalone scripts as the old approach did.

I have moved most of the code from the 8 scripts into modules within mpas_tools. They are inside of functions, as required for entry points into a Python package, in all cases. The original scripts are preserved as stubs that call the entry points.

The entry points cannot have the same names as the original scripts: the .py extention is not allowed. I have also dropped capitalization, since changes are being made in any case.

While I have been fine with standalone scripts using loose Python code styles, code in the mpas_tools should conform to PEP8 to the extent feasible. Therefore, most of the changes I have made here are related to updating the 8 scripts to be close to PEP8 compliant.

@xylar
Copy link
Collaborator Author

xylar commented Jan 8, 2025

@matthewhoffman, @trhille and @hollyhan, I'd like to discuss this with you when there's time (but not tonight -- I'm busy unfortunately).

We would have to make corresponding changes in Compass before this gets released, but I don't think that will be hard.

I've tried to be careful about the formatting and linting changes I made but it's a lot of code so mistakes are hard to rule out completely.

@xylar xylar force-pushed the move-landice-conda-package-scripts branch 3 times, most recently from f0b8c5a to 58681c9 Compare January 8, 2025 22:44
@xylar xylar marked this pull request as ready for review January 9, 2025 12:18
@xylar xylar mentioned this pull request Jan 9, 2025
4 tasks
@xylar xylar force-pushed the move-landice-conda-package-scripts branch 2 times, most recently from 0cbc62d to af4e9cf Compare January 29, 2025 22:54
@xylar
Copy link
Collaborator Author

xylar commented Mar 7, 2025

@trhille and @matthewhoffman, I'm getting to a point where it would be quite helpful to make progress on this. There are several updates and fixes needed for the next MPAS-Tools release, and this change is a necessary first step.

@matthewhoffman
Copy link
Member

@xylar , sorry for letting this sit so long. We'll address this early next week when Trevor is in town.

@trhille
Copy link
Collaborator

trhille commented Mar 10, 2025

Testing

Using #596 rebased onto MPAS-Dev/master.

  • Full integration suite
  • landice/antarctica/mesh_gen
  • landice/crane/mesh_gen
  • landice/humboldt/mesh_gen
  • landice/greenland/mesh_gen
  • landice/isunnguata_sermia/mesh_gen
  • landice/kangerlussuaq/mesh_gen
  • landice/koge_bugt_s/mesh_gen
  • landice/ismip6_forcing/atmosphere
  • landice/ismip6_forcing/ocean_basal
  • landice/ismip6_forcing/ocean_thermal
  • landice/ismip6_forcing/shelf_collapse
  • landice/ismip6_run/ismip6_ais_proj_2300

@xylar xylar force-pushed the move-landice-conda-package-scripts branch from af4e9cf to 701c8d9 Compare March 11, 2025 18:52
@xylar
Copy link
Collaborator Author

xylar commented Mar 11, 2025

@matthewhoffman (and @trhille), I have made the suggested changes -- removing most of the stub scripts and moving set_lat_lon into mesh. The latter won't be reflected in the release candidate you're testing in Compass, obviously, but the entry point will have the same name, it just points to a different location.

@xylar
Copy link
Collaborator Author

xylar commented Mar 24, 2025

@trhille, @matthewhoffman, just checking in on this. Anything I can do to help?

@trhille
Copy link
Collaborator

trhille commented Mar 24, 2025

@xylar, so sorry for the delay on this. I'm going to work on the remaining tests today.

Copy link
Collaborator

@trhille trhille left a comment

Choose a reason for hiding this comment

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

Approved based on testing. Most of the mesh creation testing was done prior to the force push from f4e9cf to 701c8d9, but I re-ran the Thwaites mesh generation to make sure that didn't break anything. For the ismip6_forcing and ismip6_run tests I used the Thwaites_2to10km mesh in the $CFS/fanssie/MALI_projects/thwaites_convergence directory. I confirmed that relevant fields in forcing files were identical to those created previously for the Thwaites mesh convergence runs, and hist, ctrlAE, and expAE03 experiments were all set up and run successfully (only ran for a 30-minute debug job).

This testing also applies to MPAS-Dev/compass#881.

@xylar
Copy link
Collaborator Author

xylar commented Mar 25, 2025

Thanks so much @trhille!

@matthewhoffman and @hollyhan, let me know if you'd like to review or if you're happy to leave this to @trhille. I'll assume we're good if I don't hear anything by the end of the week.

@xylar xylar force-pushed the move-landice-conda-package-scripts branch from 701c8d9 to f141c04 Compare March 31, 2025 17:21
@xylar xylar removed the request for review from hollyhan March 31, 2025 17:21
xylar added 13 commits April 2, 2025 20:12
Clean up a little bit for PEP8.

Leave a stub in the location of the original script that calls
the entry point in the conda package.
The contents of the script have been moved into the `mpas_tools`
package and cleaned up for PEP8 formatting.

The original script is now a stub that calls the entry point,
similar to `create_SCRIP_file_from_MPAS_mesh.py`.
The contents of the script have been moved into the `mpas_tools`
package and cleaned up for PEP8 formatting.

The original script is now a stub that calls the entry point.
The contents of the script have been moved into the `mpas_tools`
package and cleaned up for PEP8 formatting.

The sphere_radius is also now taken from CIME constants

The original script is now a stub that calls the entry point.
The contents of the script have been moved into the `mpas_tools`
package and cleaned up for PEP8 formatting.

The original script `define_cullMask.py` is now a stub that calls
the entry point.
The contents of the script have been moved into the `mpas_tools`
package and cleaned up for PEP8 formatting.

The original script `interpolate_to_mpasli_grid.py` is now a stub
that calls the entry point.
The contents of the script have been moved into the `mpas_tools`
package and cleaned up for PEP8 formatting.

The original script `mark_domain_boundaries_dirichlet.py` is now
a stub that calls the entry point.
Folks can use the conda package.
@xylar xylar force-pushed the move-landice-conda-package-scripts branch from 40897f6 to 10fdec8 Compare April 3, 2025 01:13
@xylar
Copy link
Collaborator Author

xylar commented Apr 3, 2025

Okay, thanks @matthewhoffman and @trhille! Merging this.

@xylar xylar merged commit 2153c54 into MPAS-Dev:master Apr 3, 2025
5 checks passed
@xylar xylar deleted the move-landice-conda-package-scripts branch April 3, 2025 01:13
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.

3 participants