Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenworsley committed May 2, 2024
1 parent dd2a8da commit c9498ea
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions esmf_regrid/tests/unit/schemes/test__cube_to_GridInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pytest
import scipy.sparse

from esmf_regrid import Constants
from esmf_regrid.esmf_regridder import Regridder
from esmf_regrid.schemes import _contiguous_masked, _cube_to_GridInfo

Expand Down Expand Up @@ -233,7 +234,7 @@ def test_center(curvilinear):
# The following test ensures there are no overlapping cells.
# This catches geometric/topological abnormalities that would arise from,
# for example: switching lat/lon values, using euclidean coords vs spherical.
rg = Regridder(gridinfo, gridinfo, method="bilinear")
rg = Regridder(gridinfo, gridinfo, method=Constants.Method.BILINEAR)
expected_weights = scipy.sparse.identity(n_lats * n_lons)
assert np.array_equal(expected_weights.todense(), rg.weight_matrix.todense())
assert gridinfo.crs == GeogCS(EARTH_RADIUS).as_cartopy_crs()
Expand All @@ -244,7 +245,9 @@ def test_center(curvilinear):
# to be geometrically equivalent to the non-circular case.
circular_gridinfo = _cube_to_GridInfo(cube, center=True)
circular_gridinfo.circular = True
rg_circular = Regridder(circular_gridinfo, gridinfo, method="bilinear")
rg_circular = Regridder(
circular_gridinfo, gridinfo, method=Constants.Method.BILINEAR
)
assert np.allclose(expected_weights.todense(), rg_circular.weight_matrix.todense())


Expand Down

0 comments on commit c9498ea

Please sign in to comment.