Skip to content

Rework OBC Mask #214

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

manishvenu
Copy link
Collaborator

@manishvenu manishvenu commented May 20, 2025

Details:
I've been taking a look at the OBC mask for our BGC stuff, and think I've come to an improvement/happy solution-> But it definetely needs to be tested on other people's computers!

Right now, our two big OBC generating functions, regrid_velocity_tracers & regrid_tides, pass their datasets through a mask_dataset function in regridding.py. If bathymetry is provided (and it is not by default), the dataset is masked, if bathy isn't provided, all NaNs are filled with zeros to avoid the failures we were getting in CROCODILE-CESM#25.

However, the problem(s) are:

  1. The mask with bathymetry isn't great, for some reason we needed three additional real values at the coast on land & a real value at the corner - weird land excpetions.
  2. The more important problem (since the previous problem can just be filled) is that it wasn't clear exactly at what point is the land-ocean cutoff. This is because boundaries are on q-u-v points versus tracer points, which is where depth is given.

The fix is that:

  1. It seems like xarray/numpy NaNs just aren't working well in the OBCs, so instead if we fill with a fill value we get a much cleaner mask without those weird land_exceptions.
  2. Through some testing, the land-ocean cutoff is the single q-point beyond the MOM6 mask (MOM6 mask can be found in ocean static as "wet"), which makes a certain amount of sense. I can explain this if need be!

Changes:

  1. Update mask_dataset and get_boundary_mask in regridding.py according to the description above.
  2. Add a utils function for getting the edge of a dataset to make it cleaner.

@helenmacdonald
Copy link
Collaborator

Thanks @manishvenu!
Good to hear you have a solution! I would like to check it on a couple of domains here but have a busy couple of days so will review mid next week.

@manishvenu manishvenu marked this pull request as ready for review May 21, 2025 15:57
@navidcy
Copy link
Contributor

navidcy commented May 22, 2025

thanks @helenmacdonald!

@manishvenu
Copy link
Collaborator Author

manishvenu commented May 30, 2025

Looks like it's not working for tides for me? But to add it for velocity_tracers, or tides, just add the bathymetry path to the respective functions. setup_ocean_state_boundaries or setup_tides. If it does work for tides for any of y'all let me know!

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.

3 participants