Skip to content

Commit

Permalink
allow creating a Raster from a list of rasterio.band objects
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenpawley committed May 20, 2024
1 parent 499f2f0 commit 562d3c7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pyspatialml/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,17 @@ def __init__(
src_layers.append(RasterLayer(band))
self._layers = src_layers
return

# from a list of rasterio.band objects
elif all(isinstance(x, rasterio.Band) for x in src):
src_layers = []
for band in src:
src_layers.append(RasterLayer(band))
self._layers = src_layers
return
else:
raise ValueError("Cannot create a Raster object from a mixture of inputs")

# normal
# try:
# src_layers = []
# for band in src:
Expand Down

0 comments on commit 562d3c7

Please sign in to comment.