Integration of mom6_forge & regional_mom6 (Remerged)#267
Integration of mom6_forge & regional_mom6 (Remerged)#267manishvenu wants to merge 34 commits intoCOSIMA:mainfrom
Conversation
This reverts commit f28f4e6.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
On testing, one thing I noticed is that regridding the bathymetry outputs this message: It works fine, but the printed message is confusing, because the "given instructions for using mpi and esmf_regrid" don't seem to print out any more. These instructions used to print at the top of the cell. I'll go find where this should be printed and see if it's a matter of changing its log level |
|
I also get this MOM error, which suggests that this refactor has changed the units of vcoord:
Do the CROCODILE runs use 'meter' rather than 'meters' as units? I can't actually see where this is specified in our MOM_input files, so am puzzled why ALE is looking for a specific unit in the first place. edit: mom6 seems to have 'meters' hardcoded. Does crocodile override this? |
Huh, it should just be a print statement in mpi_set_from_datasaet in mom6_bathy/topo.py. You do have to run that instead of the original set_from_dataset that's called from setup_bathyemtry.. This print statement needs to be updated for setup_bathymetry. Maybe a flag that calls the mpi_setup? |
Shoot, this is most likely a bug. Crocodile using the Vgrid.write() method which doesn't use thickness. Rm6 uses thickness so it calls a different vgrid method called write_z_file() that must have a dispelling. I'll make a pr fixing the mistake tomorrow, and we can use that to review this PR? Basically instead of using the git install in the pyproject, clone mom6_bathy to this PR, then pip install -e, in that folder. |
Thanks @manishvenu ! Since these bugs are COSIMA specific, how about I make a draft PR that fixes this and any other issues that I find in using Also: looks like all of the units in the vcoord class, including |
Hey no this is my bad I misunderstood before! No issues, ignore me |
|
Weird bug I found: When using the pint convert (already merged) at the boundaries, the manual K->C conversion happens first. Later, the old units are inherited again when attempting the pint convert, so if the manual conversion succeeded, then you do the K->C conversion twice Weirdly, this only happens on this branch, not on the current main. So presumably the manual conversion was like accidentally failing before, so the bug accidentally didn't happen I'm just making sure that the manual convert happens after now which should fix it |
|
This fix has worked, but due to a change in NaN masking value (I think) somewhere in this PR, we now fill the land areas with -273. I'll work on this tomorrow |
If ya want me to take a look at this one, happy to help |
Does the output print out that the conversion was done twice? Might be nice to have some kind of warning for this |
No, you're right! This should be updated with at least a more descriptive message. (Also small bug) let me push one commit |
No it doesn't print out twice. I've turned off the manual conversion for now, and the pint convert turns all of the zeros to -273. Does this happen for you too? Or is there something different about our workflows? On the main branch, the land points remain 0. Presumably I just need to leave them as NaNs for a while longer, and fill with zeros after the pint convert |
|
@ashjbarnes Looks like all the tests are passing in the CI with some minor changes to mom6_bathy if this PR needs to be merged. It's still very tentative, so still probably best to wait until we get it on pypi (or maybe being explicit this is a development version)! This should mean the installation problems are fixed hopefully! |
|
Thanks @manishvenu ! Next week I'll focus on this and try get this merged. Hopefully now that NCAR's mom6_bathy tools works for us, it will just be a matter of giving the main branch of your repo as a dependency (as you've done) and ironing out whatever's going on with the pytests Could call and chat next week if that would be helpful / it's more complicated than I think! |
Hey Ashley, I am working on updating the python version so that we can pass tests (visualCaseGen can't update python because of an issue so it needs to be updated). We can def call next week to wrap this up, but let me finish that first. I'll make sure to get the tests passing. Thanks, |
|
@ashjbarnes Once this most recent PR is merged, we should be good to go, mom6_bathy was renamed to forge & passes the tests |
|
One holdup is I need to make sure that we can deploy this properly on gadi with the dependency being a github repo. Hopefully it's fine, but there's a bit more faff than usual because can't just test it on gadi, I also need to make sure that when the curated python environments (to which regional-mom6 belongs) are updated to new regional-mom6 version, it successfully picks up and installs the github repo. I've reached out to the ACCESS-NRI people for help and clarification :) |
|
ok one issue I've found so far: It looks like the supergrid as written by mom6_forge is missing the
when running the check_mask tool. Do you still use FRE NCtools at all any more @manishvenu ? If we decide as a community to no longer support these runs that's a possibility - we could point them to GFDL's regional mom6 ecosystem. Ideally, we'd find a way to keep things compatible with people who use FREtools / FMS though These lines used to be included before writing the hgrid to disk. edit: hmm this comment suggests that mom6_forge is meant to be compatible with FRE tools? I'm then either misinterpreting something, or there's an issue with the lack of the |
|
Ok my thinking is that adding these silly tile attributes and dimensions to things for the minority of users who will continue using FREtools is silly. What I'll do instead is just add the tile attributes to files inside the |
|
Last commit ensures FMS / FRE tool backward compatibility. Instead of modifying mom6_forge to shoehorn in the tile dimension that FRE tools requires, now the I've also added comments in the demo files to explain that we're now less committed to maintain FMS runs generally |
ashjbarnes
left a comment
There was a problem hiding this comment.
This works great - tested with OM2 forcing. The resultant input files are identical to the current main branch numerically, with some small changes to encoding. e.g., bathymetry now has coords named x/y instead of lat/lon. This is consistent with naming of the initial conditions anyway, and doesn't affect anything except how users plot them in notebooks.
I've now tested this workflow with FMS runs too, and with some tweaks to the run_fre_tools function, this is now backwards compatible.
Contrary to what I said this morning, I'm happy for this to be merged! Turns out that regional-mom6 has already been kicked off the curated analysis env since we're still requiring numpy <2 so no-one will even know if we can't load mom6_forge properly! I'll work on the bespoke regional-mom6 deployment env next week. #
|
but I'll let you merge this time... |
|
Ok awesome! I'll merge this soon then! |
Co-authored-by: @ashjbarnes
Closes CROCODILE-CESM/CrocoDash#183
Summary:
Integrate mom6_bathy into regional_mom6. There are NO front-end changes to this PR (the one exception is slight changes to what is printed out in the setup_bathymetry function).
Shift the grid functions from regional_mom6 to mom6_bathy to eventually take advantage of the functions in mom6_bathy. For now, this PR just reproduces the user facing functions.
This PR will add the mom6_bathy as a dependency (mom6_bathy is soon to be renamed and released on pypi).
Changes:
expt.make_hgrid, make_vgrid, setup_bathymetry now use mom6_bathy grid, topo, and vgrid
Advantages:
There are a ton of advantages, but some highlights:
Gain access to useful functions in mom6_bathy:
Regional_mom6/CROCODILE Advantages:
7. Merge the grid generation advances CROCODILE & regional_mom6 make together
8. mom6_bathy gains additional functions in generating hgrids and topos
9. More easily understand what a grid, topo, and vgrid are inside of regional_mom6-> they're objects instead of netcdf files
10. This will go a huge way to making these files more self-describing!
Disadvantages/Considerations:
Companion PR: https://github.com/NCAR/mom6_bathy/pull/34
For reviewers/maintainers:
How to test this PR! You need to install mom6_bathy! Which can be done by cloning it than
pip install -e .in the cloned folderInstawins: Since a lot of these advantages will take some time & demo-writing, I dropped a demo for the TopoEditor, ESMF, & CICE files in this PR that should work, but will hold off on other demos for further PRs.