Skip to content

Commit

Permalink
add links to docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
navidcy committed Mar 1, 2025
1 parent 7847119 commit bdd583d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/angle_calculation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@ Here we explain the implementation of MOM6 angle calculation in regional-mom6, w
Steps 1-5 replicate the angle calculation as done by MOM6. Step 6 is an additional step required to apply this algorithm to the boundary points.

1. Figure out the longitudinal extent of our domain, or periodic range of longitudes. For global cases it is len_lon = 360, for our regional cases it is given by the hgrid.
2. At each ``t``-point on the `hgrid`, we find the four adjacent ``q``-points. We adjust each of these longitudes to be in the range of len_lon around the point itself. (module_around_point)
2. At each ``t``-point on the `hgrid`, we find the four adjacent ``q``-points. We adjust each of these longitudes to be in the range of len_lon around the point itself. ({meth}`rotation.modulo_around_point <regional_mom6.rotation.modulo_around_point>`)
3. We then find the lon_scale, which is the "trigonometric scaling factor converting changes in longitude to equivalent distances in latitudes". Whatever that actually means is we add the latitude of all four of these points from part 3 and basically average it and convert to radians. We then take the cosine of it. As I understand it, it's a conversion of longitude to equivalent latitude distance.
4. Then we calculate the angle. This is a simple arctan2 so y/x.
1. The "y" component is the addition of the difference between the diagonals in longitude (adjusted by modulo_around_point in step 3) multiplied by the lon_scale, which is our conversion to latitude.
2. The "x" component is the same addition of differences in latitude.
3. Thus, given the same units, we can call arctan to get the angle in degrees

5. **Additional step to apply to boundaries**
Since the boundaries for a regional MOM6 domain are on the `q` points and not on the `t` points, to calculate the angle at the boundary points we need to expand the grid. This is implemented in the `create_expanded_hgrid` method.
Since the boundaries for a regional MOM6 domain are on the `q` points and not on the `t` points, to calculate the angle at the boundary points we need to expand the grid. This is implemented in the {meth}`rotation.create_expanded_hgrid <regional_mom6.rotation.create_expanded_hgrid>` method.

## Convert this method to boundary angles - 2 Options

1. **EXPAND_GRID**: Compute grid angle replicating MOM6 calculations. Calculate another boundary row/column points around the hgrid using simple difference techniques. Use the new points to calculate the angle at the boundaries. This works because we can now access the four points needed to calculate the angle, where previously at boundaries we would be missing at least two.
2. **GIVEN_ANGLE**: Don't calculate the angle and use the user-provided field in the hgrid called `angle_dx`.
2. **GIVEN_ANGLE**: Do not calculate the grid angle but rather use the user-provided field in the horizontal grid called `angle_dx`.


## Force using the provided `angle_dx`
### Force using the provided `angle_dx`

To enforce using the provided angles instead of the default algorithm, when calling the regridding methods `regrid_velocity_tracers` and `regrid_tides`, set the optional keyword argument `rotational method = given_angle`
To enforce using the provided angles instead of the default algorithm, when calling the regridding methods {meth}`segment.regrid_velocity_tracers <regional_mom6.regional_mom6.segment.regrid_velocity_tracers>` and {meth}`segment.regrid_tides <regional_mom6.regional_mom6.segment.regrid_tides>`, set the optional keyword argument `rotational method = GIVEN_ANGLE`

0 comments on commit bdd583d

Please sign in to comment.