Skip to content
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

MOM6 Angle Calculation #34

Merged
merged 43 commits into from
Dec 19, 2024
Merged

MOM6 Angle Calculation #34

merged 43 commits into from
Dec 19, 2024

Conversation

manishvenu
Copy link

@manishvenu manishvenu commented Nov 12, 2024

Fixes #31

Implement the MOM6 Angle Calculation in Regional MOM6. Add functions, classes to RM6 and adjust the regridding functions to accommodate these new angles.

Explanation/Visualization of the changes.

Major Notes & Changes:

Please see the document angle_calc.md for a more complete explanation

  1. New file (rotation.py) to implement MOM6 angle calculation & Fred, Keiths methods:
    1. MOM6 modulo_around_point: Implement MOM6 modulo_around_point.
    2. Angle Calculation from MOM6 mom6_angle_calculation_method: Implement MOM6 intialize_grid_rotation_angle function logic. Only the new version from MOM6 is included
    3. initialize_grid_rotation_angle: This calculates t-point angle, which is what MOM6 does using the mom6_angle_calculation_method
    4. initialize_grid_rotation_angles_using_pseudo_hgrid: Using Fred's pseudo hgrid that has an extra boundary row & col, calculate angle at every point in the original hgrid
    5. create_pseudo_hgrid: Fred calculation creating an extra boundary row & col on hgrid
    6. RotationMethod Enum Class: This class is to determine by which method we rotate the boundary conditions.
  2. Adjustments to regridding.py:
    1. get_hgrid_arakawa_c_points: Work from Fred splitting hgrid into the t, u, v, & q points converted to a RM6 function
    2. coords changes: A change to the coords function to get the boundary t-points for Keith's method.
  3. Adjustments to regrid_tides & regrid_velocity_tracers:
    1. What: accommodate the different rotation methods using the Enum Class (Keith, Fred, Old)
    2. Code: uses if statements
    3. Visualization: The Visualization is a great explanation of this
  4. Adjustments to testing:
    1. test_rotation.py: New test file for the rotation
    2. SHORT TERM CHANGE Docker image adjustment: Updated the docker image we use with RM6 github testing with a curvilinear grid for use in test_rotation.py, that is a crocodile image until someone with permissions updates the RM6 docker image, maybe we should have a CROCODILE one to? But probably not
    3. conftest.py: Adds a fixture to skip a test if the files on the docker image don't exist on the computer (this is good for local testing)
    4. Minor test cleaning: A bunch of small changes to a few tests to not create extra folders.
  5. Doc Changes:
    1. Angle Calc: angle_calc.md explaining this angle issue, and
    2. Docker: docker_image_dev.md for changing the docker image in the future.
  6. Visualizations (Notebook to look at the differences in the methods: /glade/u/home/manishrv/documents/nwa12_0.1/tides_dev/test_rotational_methods.ipynb)

@manishvenu manishvenu self-assigned this Nov 12, 2024
@manishvenu manishvenu marked this pull request as ready for review December 12, 2024 20:29
regional_mom6/rotation.py Outdated Show resolved Hide resolved
regional_mom6/rotation.py Outdated Show resolved Hide resolved
regional_mom6/rotation.py Show resolved Hide resolved
regional_mom6/rotation.py Show resolved Hide resolved
regional_mom6/rotation.py Outdated Show resolved Hide resolved
regional_mom6/regional_mom6.py Outdated Show resolved Hide resolved
@alperaltuntas alperaltuntas self-requested a review December 19, 2024 22:35
@manishvenu
Copy link
Author

Checks passed, so I'm merging. If there's any last comments on this, they can be addressed in #33

@manishvenu manishvenu merged commit f7df20c into tides_regridding_branch Dec 19, 2024
4 checks passed
manishvenu added a commit that referenced this pull request Jan 17, 2025
… tracers, add proper body tide parameters, add MOM6's angle calculation. (#33)

* Add GFDL Rotation Code and minor tides debugging in setup_run_directory

The GFDL rotation code was commented out🙈

* Black

* Actual Angle Change

* Minor Clean

* Add First Regridding Option

* More tidal changes

* Change default tides to use all constituents in TPXO allowed in MOM6

* Fix Tests

* Start of Angle Calc

* Blacl

* Rand

* Clean up testing  (#37)

* Remove extra directories created

* Black

* Clean up created dirs

* Rand

* Keith Method Step 1, add t-point boundaries to coords()

* Start implementing alternative angles approaches...

* Set up rotational method framework

* Add h, t, and change default mom6_angle_calc to regional

* black

* Fred Angle Calc

* Black

* Black 2

* Keith Method

* Tidal Rotational Methods Completed

* Finish rotational methods for velocity_tracers

* Combine the grid_rotation_calc for fred_pseudo and mom6 general (keiths)

* Move rotation/angle functions to a different file

* Doesn't make sense to use rot method in expt because the regrid methods are in segment right now. Something to discuss and then add

* Clean up the keith method to use the regridding func add_secondary_dimension

* Add angle_calc to docs

* Main Page Link for now...

* Start testing setup

* Change func name for consistency

* Minor Commenting

* Minor Commenting

* Black

* Redo Auto Docs

* Start of testing

* Test until curved grid generation comes in

* Bug

* Test_Rotation Changes

* Adjust Docker Path

* Testing Framework Trial 1

* Docker Docs

* Test Cleaning

* Change name of docker docs

* Adjust docker image to crocodile one

* Step 1: Setup Framework Tidal Regridding Nans/LandMask BugFix

* Finish setting up masking framework

* Clean up process of masking

* Regridding Testing except for the mask functions

* First round testing w/o mask tests

* First Round Testing Completed

* Minor Clean

* MOM6 Angle Calculation (#34)

* Start of Angle Calc

* Blacl

* Rand

* Rand

* Keith Method Step 1, add t-point boundaries to coords()

* Start implementing alternative angles approaches...

* Set up rotational method framework

* Add h, t, and change default mom6_angle_calc to regional

* black

* Fred Angle Calc

* Black

* Black 2

* Keith Method

* Tidal Rotational Methods Completed

* Finish rotational methods for velocity_tracers

* Combine the grid_rotation_calc for fred_pseudo and mom6 general (keiths)

* Move rotation/angle functions to a different file

* Doesn't make sense to use rot method in expt because the regrid methods are in segment right now. Something to discuss and then add

* Clean up the keith method to use the regridding func add_secondary_dimension

* Add angle_calc to docs

* Main Page Link for now...

* Start testing setup

* Change func name for consistency

* Minor Commenting

* Minor Commenting

* Black

* Redo Auto Docs

* Start of testing

* Test until curved grid generation comes in

* Bug

* Test_Rotation Changes

* Adjust Docker Path

* Testing Framework Trial 1

* Docker Docs

* Test Cleaning

* Change name of docker docs

* Adjust docker image to crocodile one

* Step 1: Setup Framework Tidal Regridding Nans/LandMask BugFix

* Finish setting up masking framework

* Revert "Finish setting up masking framework"

This reverts commit 9287030.

* Revert "Step 1: Setup Framework Tidal Regridding Nans/LandMask BugFix"

This reverts commit a2b961a.

* respond to alper comments

* Docs changes

* Seg Fault Issue Pt1

* Disable threading

* Just single threading

* Clean up testing

* Remove Single Threading

* Add back single threading

* Spelling Mistake

* Zero Out Attempt

* Black + Add Mask to Regrid_vt

* Zero Out Corner + 3 Cell

* Update Land Mask Tests

* Fix Bathy NTiles Issue

* Minor Cleaning + Variable Renaming

* minor changes ahead of visualCaseGen integration in CrocoDash:

- correct the first arg of a classmethod (from self to cls).
- introduce optional write_to_file arg in setup_bathymetry.
- introduce optional bathymetry obj arg in tidy_bathymetry.

* Mirro GFDL NWA12-Cobalt a bit more and add diag table date adjustment

* Black

* Add aiohttp and copernicusmarine dependencies

* add hgrid_path and vgrid_path args to __init__ to allow non-standard filenames. Similarly, add thickesses arg to _make_vgrid.

* black reformatting

* Update Initial Condition + Alternate Rotation Function

* Rename get_glorys_rect to get_glorys

* Move RM6 to logging over print statements, but still report regional_mom6 to stdout

* Formatting

* Fix logging bug

* Revert RM6 Logging

* Formatting

* Alper Review Comments Pt1

* Relative Imports

* Revert "Relative Imports"

This reverts commit 15d8d36.

* Check if the ESMF warning is the issue in the tests failure

* Add Rotational Methods function

* Small Adj to Docs'

---------

Co-authored-by: alperaltuntas <alperaltuntas@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants