Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bossie committed Oct 10, 2024
1 parent 2c2b013 commit a08da1b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions openeogeotrellis/integrations/tiffset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

def embed_gdal_metadata(gdal_metadata_xml: str, geotiff_path: Union[Path, str]):
# TODO: use gdal instead to avoid warnings or are they harmless?
with tempfile.NamedTemporaryFile(prefix="GDALMetadata", suffix=".xml.tmp", mode="wt", encoding="ascii") as tmp:
with tempfile.NamedTemporaryFile(prefix="GDALMetadata_", suffix=".xml.tmp", mode="wt", encoding="ascii") as tmp:
# use temporary file to work around segfault in container
tmp.write(gdal_metadata_xml)
tmp.write(f"{gdal_metadata_xml}\n")
tmp.flush()

subprocess.check_call(["tiffset", "-sf", "42112", tmp.name, str(geotiff_path)])
15 changes: 8 additions & 7 deletions tests/datacube_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@

from openeogeotrellis.service_registry import InMemoryServiceRegistry

matrix_of_one = np.zeros((1, 4, 4))
TILE_SIZE = 16

matrix_of_one = np.zeros((1, TILE_SIZE, TILE_SIZE))
matrix_of_one.fill(1)

matrix_of_two = np.zeros((1, 4, 4))
matrix_of_two = np.zeros((1, TILE_SIZE, TILE_SIZE))
matrix_of_two.fill(2)

matrix_of_nodata = np.zeros((1, 4, 4))
matrix_of_nodata = np.zeros((1, TILE_SIZE, TILE_SIZE))
matrix_of_nodata.fill(-1)

extent = {'xmin': 0.0, 'ymin': 0.0, 'xmax': 4.0, 'ymax': 4.0}
extent_webmerc = {'xmin': 0.0, 'ymin': 0.0, 'xmax': 445277.96317309426, 'ymax': 445640.1096560266}
layout = {'layoutCols': 1, 'layoutRows': 1, 'tileCols': 4, 'tileRows': 4}

extent = {"xmin": 0.0, "ymin": 0.0, "xmax": 4.0, "ymax": 4.0}
extent_webmerc = {"xmin": 0.0, "ymin": 0.0, "xmax": 445277.96317309426, "ymax": 445640.1096560266}
layout = {"layoutCols": 1, "layoutRows": 1, "tileCols": TILE_SIZE, "tileRows": TILE_SIZE}


openeo_metadata = {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_load_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def test_load_disk_collection_pyramid(
cube = cube.rename_labels("bands", ["band1", "bands"])

assert len(cube.metadata.spatial_dimensions) == 2
assert len(cube.pyramid.levels) == 2
assert len(cube.pyramid.levels) == 4


def test_load_disk_collection_batch(imagecollection_with_two_bands_and_three_dates,backend_implementation,tmp_path):
Expand Down

0 comments on commit a08da1b

Please sign in to comment.