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

Add alpha dimension #671

Closed
wants to merge 4 commits into from
Closed
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
Binary file added geoviews/tests/assets/test_alpha.tif
Binary file not shown.
13 changes: 13 additions & 0 deletions geoviews/tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

import cartopy.crs as ccrs
import pytest

Expand All @@ -9,6 +11,7 @@
except ImportError:
rxr = None

ASSETS_DIR = Path(__file__).parent / "assets"

@pytest.mark.parametrize(
"raw_crs",
Expand Down Expand Up @@ -45,3 +48,13 @@
assert isinstance(output, gv.RGB)
assert sorted(map(str, output.kdims)) == ["x", "y"]
assert isinstance(output.crs, ccrs.CRS)


@pytest.mark.skipif(rxr is None, reason="Needs rioxarray to be installed")
def test_from_xarray_with_alpha():
file = str(ASSETS_DIR / "test_alpha.tif")
output = from_xarray(rxr.open_rasterio(file))

Check failure on line 56 in geoviews/tests/test_util.py

View workflow job for this annotation

GitHub Actions / Unit tests on Python 3.9, ubuntu-latest

test_from_xarray_with_alpha UserWarning: Could not decode projection from crs string EPSG:4326, defaulting to non-geographic element.

Check failure on line 56 in geoviews/tests/test_util.py

View workflow job for this annotation

GitHub Actions / Unit tests on Python 3.11, ubuntu-latest

test_from_xarray_with_alpha UserWarning: Could not decode projection from crs string EPSG:4326, defaulting to non-geographic element.

Check failure on line 56 in geoviews/tests/test_util.py

View workflow job for this annotation

GitHub Actions / Unit tests on Python 3.9, macos-latest

test_from_xarray_with_alpha UserWarning: Could not decode projection from crs string EPSG:4326, defaulting to non-geographic element.

Check failure on line 56 in geoviews/tests/test_util.py

View workflow job for this annotation

GitHub Actions / Unit tests on Python 3.11, macos-latest

test_from_xarray_with_alpha UserWarning: Could not decode projection from crs string EPSG:4326, defaulting to non-geographic element.

assert isinstance(output, gv.RGB)
assert sorted(map(str, output.kdims)) == ["x", "y"]
assert set(map(str, output.vdims)) == set(["R", "G", "B", "A"])
Loading