Skip to content

Commit

Permalink
Merge pull request #248 from bird-house/fix-247
Browse files Browse the repository at this point in the history
Tiff converter returns DataArray instead of Dataset.
  • Loading branch information
Zeitsperre authored May 7, 2024
2 parents 6e27273 + 4a2e644 commit 531f97c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Change History
**************

v0.8.7 (unreleased)
===================

* Fix regression, where loading TIFF files would return a Dataset instead of a DataArray, the behavior prior to 0.8.5.


v0.8.6 (2024-03-18)
===================

Expand Down
2 changes: 1 addition & 1 deletion birdy/client/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def convert(self): # noqa: D102
import xarray # isort: skip
import rioxarray # noqa

return xarray.open_dataset(self.file, engine="rasterio")
return xarray.open_dataarray(self.file, engine="rasterio")


# TODO: Add test for this.
Expand Down
5 changes: 3 additions & 2 deletions tests/test_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import tempfile

import pytest
import xarray as xr
from common import resource_file

from birdy.client import converters
Expand Down Expand Up @@ -101,5 +102,5 @@ def test_raster_tif():
pytest.importorskip("rioxarray")
fn = resource_file("Olympus.tif")

ds = converters.convert(fn, path="/tmp")
assert "band_data" in ds.variables
da = converters.convert(fn, path="/tmp")
assert isinstance(da, xr.DataArray)

0 comments on commit 531f97c

Please sign in to comment.