From e803b9415d39675a79a9838656e250cb0a5836aa Mon Sep 17 00:00:00 2001 From: Scott Henderson Date: Mon, 16 Dec 2024 11:16:06 +0100 Subject: [PATCH] disable sliderule tests by default --- pixi.lock | 4 +- pyproject.toml | 2 +- tests/test_download.py | 1 - tests/test_sliderule.py | 110 +++++++++++++++++++--------------------- tests/test_xarray.py | 8 +-- 5 files changed, 60 insertions(+), 65 deletions(-) diff --git a/pixi.lock b/pixi.lock index 8195331..03750b2 100644 --- a/pixi.lock +++ b/pixi.lock @@ -3006,8 +3006,8 @@ packages: timestamp: 1729059365471 - pypi: . name: coincident - version: 0.1.2.dev3+gf8b0973.d20241215 - sha256: d9590102130da7daffbdb21ee0c6126530ff1e9ece0f9ffbcea05d8ac9e35f99 + version: 0.1.2.dev5+ge37ad45.d20241216 + sha256: 39bb83bbf2cdace28a2848d6fde6b32f09079bf4df34acea2a026c07b31856a7 requires_dist: - cloudpathlib[s3]>=0.20.0,<0.21 - geopandas>=1.0.1,<2 diff --git a/pyproject.toml b/pyproject.toml index 0c7a0f3..2376d4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -252,7 +252,7 @@ precommit = "pre-commit run --all" # NOTE: consider --output-format=github for github actions lint = "pylint src" test = "pytest -o markers=network -m 'not network' --cov --cov-report=xml --cov-report=term" -networktest = "pytest --cov --cov-report=xml --cov-report=term" +networktest = "pytest --cov --cov-report=xml --cov-report=term --durations=0" [tool.pixi.feature.docs.pypi-dependencies] coincident = { path = ".", editable = true } diff --git a/tests/test_download.py b/tests/test_download.py index c26a17d..46f0d83 100644 --- a/tests/test_download.py +++ b/tests/test_download.py @@ -26,7 +26,6 @@ def test_download_maxar_browse(): gf = coincident.search.search(dataset="maxar", ids=["102001008EC5AC00"]) item = coincident.search.stac.to_pystac_items(gf)[0] asyncio.run(coincident.io.download.download_item(item, config="maxar")) - assert Path("/tmp/102001008EC5AC00.browse.tif").exists() assert Path("/tmp/102001008EC5AC00.json").exists() diff --git a/tests/test_sliderule.py b/tests/test_sliderule.py index bdefd81..01b100b 100644 --- a/tests/test_sliderule.py +++ b/tests/test_sliderule.py @@ -25,65 +25,61 @@ def test_gdf_to_sliderule_polygon(): @network -def test_subset_gedi02a(tinyaoi): - gf_gedi = coincident.search.search( - dataset="gedi", intersects=tinyaoi, datetime="2022" - ) - data = coincident.io.sliderule.subset_gedi02a( - gf_gedi, aoi=tinyaoi, include_worldcover=True - ) - assert isinstance(data, gpd.GeoDataFrame) - assert "elevation_lm" in data.columns - assert "elevation_hr" in data.columns - assert data.iloc[0].name.toordinal() == 738192 - assert data.iloc[0]["worldcover.value"] == "Tree cover" - assert data.shape == (262, 11) - +@pytest.mark.skip(reason="https://github.com/uw-cryo/coincident/issues/35") +class TestSlideRule: + def test_subset_gedi02a(self, tinyaoi): + gf_gedi = coincident.search.search( + dataset="gedi", intersects=tinyaoi, datetime="2022" + ) + data = coincident.io.sliderule.subset_gedi02a( + gf_gedi, aoi=tinyaoi, include_worldcover=True + ) + assert isinstance(data, gpd.GeoDataFrame) + assert "elevation_lm" in data.columns + assert "elevation_hr" in data.columns + assert data.iloc[0].name.toordinal() == 738192 + assert data.iloc[0]["worldcover.value"] == "Tree cover" + assert data.shape == (262, 11) -@network -def test_subset_atl06(tinyaoi): - gf_is2 = coincident.search.search( - dataset="icesat-2", intersects=tinyaoi, datetime="2022" - ) - data = coincident.io.sliderule.subset_atl06(gf_is2, aoi=tinyaoi) - assert isinstance(data, gpd.GeoDataFrame) - assert "h_li" in data.columns - assert 1034 in data.rgt.unique() - assert data.iloc[0].name.toordinal() == 738304 - assert data.shape == (413, 21) + def test_subset_atl06(self, tinyaoi): + gf_is2 = coincident.search.search( + dataset="icesat-2", intersects=tinyaoi, datetime="2022" + ) + data = coincident.io.sliderule.subset_atl06(gf_is2, aoi=tinyaoi) + assert isinstance(data, gpd.GeoDataFrame) + assert "h_li" in data.columns + assert 1034 in data.rgt.unique() + assert data.iloc[0].name.toordinal() == 738304 + assert data.shape == (413, 21) + def test_process_atl06sr(self, tinyaoi): + gf_is2 = coincident.search.search( + dataset="icesat-2", intersects=tinyaoi, datetime="2022" + ) + data = coincident.io.sliderule.process_atl06sr( + gf_is2, aoi=tinyaoi, include_3dep=True + ) + assert isinstance(data, gpd.GeoDataFrame) + assert "n_fit_photons" in data.columns + assert "3dep.value" in data.columns + assert data.shape == (367, 20) + assert data.iloc[0].name.toordinal() == 738304 + assert int(data.iloc[0].h_mean) == 3178 -@network -def test_process_atl06sr(tinyaoi): - gf_is2 = coincident.search.search( - dataset="icesat-2", intersects=tinyaoi, datetime="2022" + @pytest.mark.filterwarnings( + "ignore:Geometry is in a geographic CRS:UserWarning:geopandas" ) - data = coincident.io.sliderule.process_atl06sr( - gf_is2, aoi=tinyaoi, include_3dep=True - ) - assert isinstance(data, gpd.GeoDataFrame) - assert "n_fit_photons" in data.columns - assert "3dep.value" in data.columns - assert data.shape == (367, 20) - assert data.iloc[0].name.toordinal() == 738304 - assert int(data.iloc[0].h_mean) == 3178 - - -@network -@pytest.mark.filterwarnings( - "ignore:Geometry is in a geographic CRS:UserWarning:geopandas" -) -def test_sample_3dep(): - gf = gpd.GeoDataFrame( - geometry=gpd.points_from_xy( - [-106.46953038438801, -106.47209604357627], - [38.781089777057986, 38.78292421778072], - crs="EPSG:4326", + def test_sample_3dep(self): + gf = gpd.GeoDataFrame( + geometry=gpd.points_from_xy( + [-106.46953038438801, -106.47209604357627], + [38.781089777057986, 38.78292421778072], + crs="EPSG:4326", + ) ) - ) - samples = coincident.io.sliderule.sample_3dep(gf) - assert {"file", "geometry", "time", "value"} == set(samples.columns) - assert samples.time.dtype == "