Skip to content

Commit

Permalink
Separate out new test
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrjones committed Mar 12, 2024
1 parent 0dee174 commit a87eaa8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/test_pyramids.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,23 @@ def test_reprojected_pyramid(temperature, benchmark):
pytest.importorskip('rioxarray')
levels = 2
temperature = temperature.rio.write_crs('EPSG:4326')
pyramid = benchmark(lambda: pyramid_reproject(temperature, levels=2))
pyramid = benchmark(lambda: pyramid_reproject(temperature, levels=levels))
assert pyramid.ds.attrs['multiscales']
assert len(pyramid.ds.attrs['multiscales'][0]['datasets']) == levels
assert pyramid.ds.attrs['multiscales'][0]['datasets'][0]['crs'] == 'EPSG:3857'
assert np.isnan(pyramid['0'].air.isel(time=0, x=0, y=0).values)
pyramid.to_zarr(MemoryStore())


def test_reprojected_pyramid_fill(temperature, benchmark):
"""
Test for https://github.com/carbonplan/ndpyramid/issues/93.
"""
pytest.importorskip('rioxarray')
temperature = temperature.rio.write_crs('EPSG:4326')
pyramid = benchmark(lambda: pyramid_reproject(temperature, levels=2))
assert np.isnan(pyramid['0'].air.isel(time=0, x=0, y=0).values)


@pytest.mark.parametrize('regridder_apply_kws', [None, {'keep_attrs': False}])
def test_regridded_pyramid(temperature, regridder_apply_kws, benchmark):
pytest.importorskip('xesmf')
Expand Down

0 comments on commit a87eaa8

Please sign in to comment.