Skip to content

Commit

Permalink
final fix
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant committed Nov 13, 2024
1 parent 8ab4a61 commit 20172a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions intake_xarray/tests/data/catalog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ sources:
description: "https://github.com/mapbox/rasterio/blob/master/tests/data/<red|green>.tif"
driver: rasterio
args:
urlpath: '{{ CATALOG_DIR }}little_{band}.tif'
concat_dim: band
urlpath: '{{ CATALOG_DIR }}little_{color}.tif'
pattern_tiff_source_path_pattern_as_str:
description: "https://github.com/mapbox/rasterio/blob/master/tests/data/<red|green>.tif"
driver: rasterio
Expand Down
10 changes: 5 additions & 5 deletions intake_xarray/tests/test_intake_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ def test_read_pattern_field_as_band():
cat = intake.open_catalog(os.path.join(here, 'data', 'catalog.yaml'))
colors = cat.pattern_tiff_source_path_pattern_field_as_band

da = colors.read()
assert len(da.band) == 6
assert set(da.band.data) == set(['red', 'green'])
assert da[da.band == 'red'].shape == (3, 64, 64)
da = colors.read().band_data
assert da.shape == (2, 3, 64, 64)
assert set(da.color.data) == set(['red', 'green'])
assert da[da.color == 'red'].squeeze().shape == (3, 64, 64)

rgb = {'red': [204, 17, 17], 'green': [17, 204, 17]}
for color, values in rgb.items():
for i, v in enumerate(values):
assert (da[da.band == color][i].values == v).all()
assert (da[da.color == color][0][i].values == v).all()


def test_read_pattern_path_as_pattern_as_str_with_list_of_urlpaths():
Expand Down

0 comments on commit 20172a7

Please sign in to comment.