Skip to content

Commit

Permalink
Revert "BUG: Fix subdatasets for specific Zarr driver scenario (#522)" (
Browse files Browse the repository at this point in the history
#523)

This reverts commit 595b69c.
  • Loading branch information
snowman2 authored May 12, 2022
1 parent d2c0d16 commit 39c9189
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 47 deletions.
2 changes: 1 addition & 1 deletion docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ History

Latest
------
- BUG: Fix subdatasets for specific Zarr driver scenario (issue #521)


0.11.1
------
Expand Down
14 changes: 1 addition & 13 deletions rioxarray/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,20 +850,8 @@ def open_rasterio(
):
warnings.warn(str(rio_warning.message), type(rio_warning.message)) # type: ignore

# skip subdatasets for Zarr driver basic scenario
# https://github.com/corteva/rioxarray/issues/521
skip_subdatasets = (
riods.driver.lower() == "zarr"
and riods.crs is not None
and len(riods.subdatasets) == 2
and all(
subdataset.lower().endswith((":/x", ":/y"))
for subdataset in riods.subdatasets
)
)

# open the subdatasets if they exist
if riods.subdatasets and not skip_subdatasets:
if riods.subdatasets:
return _load_subdatasets(
riods=riods,
group=group,
Expand Down
33 changes: 0 additions & 33 deletions test/integration/test_integration__io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1303,36 +1303,3 @@ def test_writing_gcps(tmp_path):
with rioxarray.open_rasterio(tiffname2) as darr:
assert "gcps" in darr.coords["spatial_ref"].attrs
_check_rio_gcps(darr, *gdal_gcps)


def test_zarr_driver_simple_dataset(tmp_path):
# https://github.com/corteva/rioxarray/issues/521
w_settings = {
"driver": "Zarr",
"dtype": "float32",
"nodata": -9999,
"width": 3039,
"height": 4501,
"count": 1,
"crs": 3857,
"transform": Affine(25.0, 0.0, 16556975.0, 0.0, -25.0, -4179000.0),
"blockxsize": 5760,
"blockysize": 5760,
"tiled": True,
}

zarr_settings = dict(
COMPRESS="BLOSC",
BLOCKSIZE="5760,5760",
BLOSC_CNAME="lz4",
BLOSC_CLEVEL=5,
BLOSC_SHUFFLE="BYTE",
BLOSC_NUM_THREADS="ALL_CPUS",
ARRAY_NAME="data",
)

output = tmp_path / "test.zarr"
with rasterio.open(output, "w", **w_settings, **zarr_settings) as dst:
dst.write(np.ones((4501, 3039), np.float32), 1)

assert isinstance(rioxarray.open_rasterio(output), xr.DataArray)

0 comments on commit 39c9189

Please sign in to comment.