diff --git a/tests/test_layers.py b/tests/test_layers.py index 71266fe..a46a338 100644 --- a/tests/test_layers.py +++ b/tests/test_layers.py @@ -1,3 +1,4 @@ +import ee import pytest from city_metrix.layers import ( @@ -22,6 +23,7 @@ UrbanLandUse, WorldPop ) +from city_metrix.layers.layer import get_image_collection from tests.fixtures.bbox_constants import BBOX_BRAZIL_LAURO_DE_FREITAS_1 @@ -47,6 +49,24 @@ def test_esa_world_cover(): assert count +def test_read_image_collection(): + ic = ee.ImageCollection("ESA/WorldCover/v100") + data = get_image_collection(ic, BBOX_BRAZIL_LAURO_DE_FREITAS_1, 10, "test") + + expected_crs = 32724 + expected_x_dimension = 187 + expected_y_dimension = 199 + + assert data.rio.crs == expected_crs + assert data.dims == {"x": expected_x_dimension, "y": expected_y_dimension} + + +def test_read_image_collection_scale(): + ic = ee.ImageCollection("ESA/WorldCover/v100") + data = get_image_collection(ic, BBOX_BRAZIL_LAURO_DE_FREITAS_1, 100, "test") + assert data.dims == {"x": 19, "y": 20} + + def test_high_land_surface_temperature(): data = HighLandSurfaceTemperature().get_data(BBOX_BRAZIL_LAURO_DE_FREITAS_1) assert data.any() diff --git a/tests/test_methods.py b/tests/test_methods.py index 63c0885..4651883 100644 --- a/tests/test_methods.py +++ b/tests/test_methods.py @@ -1,7 +1,5 @@ -import ee import numpy as np -from city_metrix.layers.layer import get_image_collection from .conftest import ( LARGE_ZONES, ZONES, @@ -58,21 +56,3 @@ def test_group_by_large_layer(): MockLargeLayer().groupby(LARGE_ZONES, layer=MockLargeGroupByLayer()).count() ) assert all([count == {1: 50.0, 2: 50.0} for count in counts]) - - -def test_read_image_collection(): - ic = ee.ImageCollection("ESA/WorldCover/v100") - data = get_image_collection(ic, BBOX_BRAZIL_LAURO_DE_FREITAS_1, 10, "test") - - expected_crs = 32724 - expected_x_dimension = 187 - expected_y_dimension = 199 - - assert data.rio.crs == expected_crs - assert data.dims == {"x": expected_x_dimension, "y": expected_y_dimension} - - -def test_read_image_collection_scale(): - ic = ee.ImageCollection("ESA/WorldCover/v100") - data = get_image_collection(ic, BBOX_BRAZIL_LAURO_DE_FREITAS_1, 100, "test") - assert data.dims == {"x": 19, "y": 20}