Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiff converter returns DataArray instead of Dataset. #248

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading