Skip to content

Commit

Permalink
fix zarr pyramid tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Nov 6, 2024
1 parent 021f609 commit b69591c
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/titiler/xarray/tests/fixtures/generate_fixtures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -120,7 +120,7 @@
" x_res = abs(-170 - 170) / width\n",
" y_res = abs(-80 - 80) / height\n",
"\n",
" arr = numpy.zeros((height, width), dtype=\"uint8\") + decimation\n",
" arr = numpy.zeros((height, width), dtype=\"uint8\") + 1 + decimation\n",
"\n",
" data = xarray.DataArray(\n",
" arr,\n",
Expand All @@ -135,7 +135,7 @@
"\n",
"for ix, dec in enumerate([0, 2, 4]):\n",
" ds = create_dataset(dec)\n",
" ds.to_zarr(store=f\"pyramid.zarr\", mode=\"w\", group=ix)"
" ds.to_zarr(store=\"pyramid.zarr\", mode=\"w\", group=ix)"
]
},
{
Expand Down
12 changes: 6 additions & 6 deletions src/titiler/xarray/tests/fixtures/pyramid.zarr/.zmetadata
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"x"
],
"fill_value": 0,
"valid_max": 0,
"valid_min": 0
"valid_max": 1,
"valid_min": 1
},
"0/x/.zarray": {
"chunks": [
Expand Down Expand Up @@ -120,8 +120,8 @@
"x"
],
"fill_value": 0,
"valid_max": 2,
"valid_min": 2
"valid_max": 3,
"valid_min": 3
},
"1/x/.zarray": {
"chunks": [
Expand Down Expand Up @@ -205,8 +205,8 @@
"x"
],
"fill_value": 0,
"valid_max": 4,
"valid_min": 4
"valid_max": 5,
"valid_min": 5
},
"2/x/.zarray": {
"chunks": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"x"
],
"fill_value": 0,
"valid_max": 0,
"valid_min": 0
"valid_max": 1,
"valid_min": 1
}
Binary file modified src/titiler/xarray/tests/fixtures/pyramid.zarr/0/dataset/0.0
Binary file not shown.
Binary file modified src/titiler/xarray/tests/fixtures/pyramid.zarr/0/dataset/0.1
Binary file not shown.
Binary file modified src/titiler/xarray/tests/fixtures/pyramid.zarr/0/dataset/1.0
Binary file not shown.
Binary file modified src/titiler/xarray/tests/fixtures/pyramid.zarr/0/dataset/1.1
Binary file not shown.
Binary file modified src/titiler/xarray/tests/fixtures/pyramid.zarr/0/dataset/2.0
Binary file not shown.
Binary file modified src/titiler/xarray/tests/fixtures/pyramid.zarr/0/dataset/2.1
Binary file not shown.
Binary file modified src/titiler/xarray/tests/fixtures/pyramid.zarr/0/dataset/3.0
Binary file not shown.
Binary file modified src/titiler/xarray/tests/fixtures/pyramid.zarr/0/dataset/3.1
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"x"
],
"fill_value": 0,
"valid_max": 2,
"valid_min": 2
"valid_max": 3,
"valid_min": 3
}
Binary file modified src/titiler/xarray/tests/fixtures/pyramid.zarr/1/dataset/0.0
Binary file not shown.
Binary file modified src/titiler/xarray/tests/fixtures/pyramid.zarr/1/dataset/1.0
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"x"
],
"fill_value": 0,
"valid_max": 4,
"valid_min": 4
"valid_max": 5,
"valid_min": 5
}
Binary file modified src/titiler/xarray/tests/fixtures/pyramid.zarr/2/dataset/0.0
Binary file not shown.
4 changes: 2 additions & 2 deletions src/titiler/xarray/tests/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,10 @@ def test_zarr_group(group, app):
with MemoryFile(resp.content) as mem:
with mem.open() as dst:
arr = dst.read(1)
assert arr.max() == group * 2
assert arr.max() == group * 2 + 1

resp = app.get(
"/md/point/0,0",
params={"url": zarr_pyramid, "variable": "dataset", "group": group},
)
assert resp.json()["values"] == [group * 2]
assert resp.json()["values"] == [group * 2 + 1]
2 changes: 1 addition & 1 deletion src/titiler/xarray/tests/test_io_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ def test_zarr_group(group):
with Reader(src_path, variable="dataset", group=group) as src:
assert src.info()
assert src.tile(0, 0, 0)
assert src.point(0, 0).data[0] == group * 2
assert src.point(0, 0).data[0] == group * 2 + 1

0 comments on commit b69591c

Please sign in to comment.