Skip to content

Commit

Permalink
more formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
navidcy committed Jan 24, 2025
1 parent 05ea795 commit 720d5e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions regional_mom6/rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def initialize_grid_rotation_angle(hgrid: xr.Dataset) -> xr.DataArray:

def modulo_around_point(x, xc, Lx):
"""
Calculate the modulo around a point. Return the modulo value of x in an interval [xc-(Lx/2), xc+(Lx/2)]. If Lx<=0, then it returns x without applying modulo arithmetic.
Calculate the modulo around a point. Return the modulo value of ``x`` in the interval ``[xc-(Lx/2), xc+(Lx/2)]``.
If ``Lx ≤ 0``, then it returns ``x`` without applying modulo arithmetic.
Parameters
----------
Expand All @@ -109,12 +110,12 @@ def modulo_around_point(x, xc, Lx):
Returns
-------
float
x shifted by an integer multiple of Lx to be close to xc,
x shifted by an integer multiple of Lx to be close to xc
"""
if Lx <= 0:
return x
else:
return ((x - (xc - 0.5 * Lx)) % Lx) - Lx / 2 + xc
return ((x - (xc - Lx / 2)) % Lx) - Lx / 2 + xc


def mom6_angle_calculation_method(
Expand Down
10 changes: 6 additions & 4 deletions regional_mom6/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,11 @@ def setup_logger(
def rotate_complex(u, v, radian_angle):
"""
Rotate velocities to grid orientation using complex number math (Same as rotate)
Args:
Arguments:
u (xarray.DataArray): The u-component of the velocity.
v (xarray.DataArray): The v-component of the velocity.
radian_angle (xarray.DataArray): The angle of the grid in RADIANS
radian_angle (xarray.DataArray): The angle of the grid in radians.
Returns:
Tuple[xarray.DataArray, xarray.DataArray]: The rotated u and v components of the velocity.
Expand All @@ -346,10 +347,11 @@ def rotate_complex(u, v, radian_angle):
def rotate(u, v, radian_angle):
"""
Rotate the velocities to the grid orientation.
Args:
Arguments:
u (xarray.DataArray): The u-component of the velocity.
v (xarray.DataArray): The v-component of the velocity.
radian_angle (xarray.DataArray): The angle of the grid in RADIANS
radian_angle (xarray.DataArray): The angle of the grid in radians.
Returns:
Tuple[xarray.DataArray, xarray.DataArray]: The rotated u and v components of the velocity.
Expand Down

0 comments on commit 720d5e6

Please sign in to comment.