Skip to content

Commit 6552327

Browse files
Get eo bands from assets only
1 parent 4116383 commit 6552327

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pystac/extensions/eo.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def get_bands(self, asset=None):
5555
"""Gets an Item or an Asset bands.
5656
5757
If an Asset is supplied and the bands property exists on the Asset,
58-
returns the Asset's value. Otherwise returns the Item's value
58+
returns the Asset's value. Otherwise returns the Item's value or
59+
all the asset's eo bands
5960
6061
Returns:
6162
List[Band]
@@ -65,6 +66,13 @@ def get_bands(self, asset=None):
6566
else:
6667
bands = self.item.properties.get('eo:bands')
6768

69+
# get assets with eo:bands even if not in item
70+
if bands is None:
71+
bands = []
72+
for (value) in self.item.get_assets().items():
73+
if 'eo:bands' in value.properties:
74+
bands.extend(value.properties.get('eo:bands'))
75+
6876
if bands is not None:
6977
bands = [Band(b) for b in bands]
7078

0 commit comments

Comments
 (0)