Skip to content

Commit

Permalink
adding and updating docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
HGWright committed Nov 2, 2023
1 parent ece7799 commit e9de3a2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
9 changes: 3 additions & 6 deletions esmf_regrid/experimental/unstructured_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,10 @@ def regrid_unstructured_to_unstructured(
Parameters
----------
src_cube : :class:`iris.cube.Cube`
A rectilinear instance of :class:`~iris.cube.Cube` that supplies the data,
src_mesh_cube : :class:`iris.cube.Cube`
A unstructured instance of :class:`~iris.cube.Cube` that supplies the data,
metadata and coordinates.
mesh_cube : :class:`iris.cube.Cube`
tgt_mesh_cube : :class:`iris.cube.Cube`
An unstructured instance of :class:`~iris.cube.Cube` that supplies the desired
horizontal mesh definition.
mdtol : float, default=0
Expand All @@ -410,9 +410,6 @@ def regrid_unstructured_to_unstructured(
:attr:`~esmpy.api.constants.RegridMethod.CONSERVE` or
:attr:`~esmpy.api.constants.RegridMethod.BILINEAR` or
:attr:`~esmpy.api.constants.RegridMethod.NEAREST` used to calculate weights.
src_resolution : int, optional
If present, represents the amount of latitude slices per cell
given to ESMF for calculation.
use_src_mask : :obj:`~numpy.typing.ArrayLike` or bool, default=False
Either an array representing the cells in the source to ignore, or else
a boolean value. If True, this array is taken from the mask on the data
Expand Down
26 changes: 26 additions & 0 deletions esmf_regrid/schemes.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,13 @@ def _regrid_rectilinear_to_rectilinear__prepare(
src_mask=None,
tgt_mask=None,
):
"""
First (setup) part of 'regrid_rectilinear_to_rectilinear'.
Check inputs and calculate the sparse regrid matrix and related info.
The 'regrid info' returned can be re-used over many 2d slices.
"""
tgt_x = _get_coord(tgt_grid_cube, "x")
tgt_y = _get_coord(tgt_grid_cube, "y")
src_x = _get_coord(src_grid_cube, "x")
Expand Down Expand Up @@ -544,6 +551,12 @@ def _regrid_rectilinear_to_rectilinear__prepare(


def _regrid_rectilinear_to_rectilinear__perform(src_cube, regrid_info, mdtol):
"""
Second (regrid) part of 'regrid_rectilinear_to_rectilinear'.
Perform the prepared regrid calculation on a single cube.
"""
grid_x_dim, grid_y_dim = regrid_info.dims
grid_x, grid_y = regrid_info.target
regridder = regrid_info.regridder
Expand Down Expand Up @@ -778,6 +791,13 @@ def _regrid_unstructured_to_unstructured__prepare(
src_location=None,
tgt_location=None,
):
"""
First (setup) part of 'regrid_unstructured_to_unstructured'.
Check inputs and calculate the sparse regrid matrix and related info.
The 'regrid info' returned can be re-used over many 2d slices.
"""
if isinstance(tgt_cube_or_mesh, Mesh):
mesh = tgt_cube_or_mesh
location = tgt_location
Expand Down Expand Up @@ -811,6 +831,12 @@ def _regrid_unstructured_to_unstructured__prepare(


def _regrid_unstructured_to_unstructured__perform(src_cube, regrid_info, mdtol):
"""
Second (regrid) part of 'regrid_unstructured_to_unstructured'.
Perform the prepared regrid calculation on a single cube.
"""
(mesh_dim,) = regrid_info.dims
mesh, location = regrid_info.target
regridder = regrid_info.regridder
Expand Down

0 comments on commit e9de3a2

Please sign in to comment.