Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 10, 2023
1 parent 6fe3300 commit 55e5ad3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
4 changes: 3 additions & 1 deletion esmf_regrid/experimental/unstructured_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,5 +442,7 @@ def regrid_unstructured_to_unstructured(
src_mask=src_mask,
tgt_mask=tgt_mask,
)
result = _regrid_rectilinear_to_unstructured__perform(src_mesh_cube, regrid_info, mdtol)
result = _regrid_rectilinear_to_unstructured__perform(
src_mesh_cube, regrid_info, mdtol
)
return result
13 changes: 8 additions & 5 deletions esmf_regrid/schemes.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,6 @@ def _regrid_unstructured_to_unstructured__prepare(
tgt_mask=None,
tgt_location=None,
):

if isinstance(tgt_cube_or_mesh, Mesh):
mesh = tgt_cube_or_mesh
location = tgt_location
Expand All @@ -785,10 +784,15 @@ def _regrid_unstructured_to_unstructured__prepare(
mesh_dim = src_mesh_cube.mesh_dim()

src_meshinfo = _make_meshinfo(src_mesh_cube, method, src_mask, "source")
tgt_meshinfo = _make_meshinfo(tgt_cube_or_mesh, method, tgt_mask, "target", location=tgt_location)
tgt_meshinfo = _make_meshinfo(
tgt_cube_or_mesh, method, tgt_mask, "target", location=tgt_location
)

regridder = Regridder(
src_meshinfo, tgt_meshinfo, method=method, precomputed_weights=precomputed_weights
src_meshinfo,
tgt_meshinfo,
method=method,
precomputed_weights=precomputed_weights,
)

regrid_info = RegridInfo(
Expand All @@ -801,7 +805,6 @@ def _regrid_unstructured_to_unstructured__prepare(


def _regrid_unstructured_to_unstructured__perform(src_cube, regrid_info, mdtol):

(mesh_dim,) = regrid_info.dims
mesh, location = regrid_info.target
regridder = regrid_info.regridder
Expand All @@ -813,7 +816,7 @@ def _regrid_unstructured_to_unstructured__perform(src_cube, regrid_info, mdtol):
num_out_dims=1,
mdtol=mdtol,
)
if location =="face":
if location == "face":
face_node = mesh.face_node_connectivity
chunk_shape = (face_node.shape[face_node.location_axis],)
elif location == "node":
Expand Down
8 changes: 7 additions & 1 deletion esmf_regrid/tests/unit/schemes/test_ESMFAreaWeighted.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@

@pytest.mark.parametrize(
"src_type,tgt_type",
[("grid", "grid"), ("grid", "mesh"), ("grid", "just_mesh"), ("mesh", "grid"), ("mesh", "mesh")],
[
("grid", "grid"),
("grid", "mesh"),
("grid", "just_mesh"),
("mesh", "grid"),
("mesh", "mesh"),
],
)
def test_cube_regrid(src_type, tgt_type):
"""
Expand Down
8 changes: 7 additions & 1 deletion esmf_regrid/tests/unit/schemes/test_ESMFBilinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@

@pytest.mark.parametrize(
"src_type,tgt_type",
[("grid", "grid"), ("grid", "mesh"), ("grid", "just_mesh"), ("mesh", "grid"), ("mesh", "mesh")],
[
("grid", "grid"),
("grid", "mesh"),
("grid", "just_mesh"),
("mesh", "grid"),
("mesh", "mesh"),
],
)
def test_cube_regrid(src_type, tgt_type):
"""
Expand Down
8 changes: 7 additions & 1 deletion esmf_regrid/tests/unit/schemes/test_ESMFNearest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@

@pytest.mark.parametrize(
"src_type,tgt_type",
[("grid", "grid"), ("grid", "mesh"), ("grid", "just_mesh"), ("mesh", "grid"), ("mesh", "mesh")],
[
("grid", "grid"),
("grid", "mesh"),
("grid", "just_mesh"),
("mesh", "grid"),
("mesh", "mesh"),
],
)
def test_cube_regrid(src_type, tgt_type):
"""
Expand Down

0 comments on commit 55e5ad3

Please sign in to comment.