Skip to content

Commit

Permalink
change test for subset_shape, locstream case
Browse files Browse the repository at this point in the history
  • Loading branch information
vindelico committed Jul 25, 2023
1 parent 607b160 commit cec8c1b
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions tests/core/test_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,6 @@
except ImportError:
xesmf = None

try:
import pygeos
except ImportError:
pygeos = None


@pytest.fixture(params=[True, False])
def toggle_pygeos(request):
if request.param:
if pygeos is None:
pytest.skip("pygeos not installed")
else:
yield request.param
else:
# Do not use pygeos
mod = subset.pygeos
# Monkeypatch core.subset to imitate the absence of pygeos.
subset.pygeos = None
yield request.param
subset.pygeos = mod


class TestSubsetTime:
nc_poslons = get_file("cmip3/tas.sresb1.giss_model_e_r.run1.atm.da.nc")
Expand Down Expand Up @@ -849,7 +828,7 @@ def test_small_poly_buffer(self, tmp_netcdf_filename):
with xr.open_dataset(filename_or_obj=tmp_netcdf_filename) as f:
assert {"tas", "crs"}.issubset(set(f.data_vars))

def test_mask_multiregions(self, toggle_pygeos):
def test_mask_multiregions(self):
ds = xr.open_dataset(self.nc_file)
regions = gpd.read_file(self.multi_regions_geojson)
regions.set_index("id")
Expand Down Expand Up @@ -881,7 +860,7 @@ def test_subset_multiregions(self):
assert ds_sub.notnull().sum() == 58 + 250 + 22
assert ds_sub.tas.shape == (12, 14, 128)

def test_vectorize_touches_polygons(self, toggle_pygeos):
def test_vectorize_touches_polygons(self):
"""Check that points touching the polygon are included in subset."""
# Create simple polygon
poly = Polygon([[0, 0], [1, 0], [1, 1]])
Expand Down

0 comments on commit cec8c1b

Please sign in to comment.