s2_bands = eoconn.load_collection(
“SENTINEL2_L2A”,
temporal_extent=[startdate, enddate],
spatial_extent=dict(zip([“west”, “south”, “east”, “north”], bbox)),
bands=[“B04”, “B08”,“SCL”]
)
s2_bands = s2_bands.process(“mask_scl_dilation”, data=s2_bands, scl_band_name=“SCL”)
ValueError Traceback (most recent call last)
Cell In[8], line 1
----> 1 s2_bands = eoconn.load_collection(
2 “SENTINEL2_L2A”,
3 temporal_extent=[startdate, enddate],
4 spatial_extent=dict(zip([“west”, “south”, “east”, “north”], bbox)),
5 bands=[“B04”, “B08”,“SCL”]
6 )
File C:\ProgramData\anaconda3\envs\OpenEO\lib\site-packages\openeo\rest\connection.py:1207, in Connection.load_collection(self, collection_id, spatial_extent, temporal_extent, bands, properties, max_cloud_cover, fetch_metadata)
1170 @openeo_process
1171 def load_collection(
1172 self,
(…)
1181 fetch_metadata: bool = True,
1182 ) → DataCube:
1183 “”"
1184 Load a DataCube by collection id.
1185
(…)
1205 Add :py:func:~openeo.rest.graph_building.collection_property
support to properties
argument.
1206 “”"
→ 1207 return DataCube.load_collection(
1208 collection_id=collection_id,
1209 connection=self,
1210 spatial_extent=spatial_extent,
1211 temporal_extent=temporal_extent,
1212 bands=bands,
1213 properties=properties,
1214 max_cloud_cover=max_cloud_cover,
1215 fetch_metadata=fetch_metadata,
1216 )
File C:\ProgramData\anaconda3\envs\OpenEO\lib\site-packages\openeo\rest\datacube.py:201, in DataCube.load_collection(cls, collection_id, connection, spatial_extent, temporal_extent, bands, fetch_metadata, properties, max_cloud_cover)
199 if metadata:
200 bands = [b if isinstance(b, str) else metadata.band_dimension.band_name(b) for b in bands]
→ 201 metadata = metadata.filter_bands(bands)
202 arguments[‘bands’] = bands
204 if isinstance(properties, list):
205 # TODO: warn about items that are not CollectionProperty objects instead of silently dropping them.
File C:\ProgramData\anaconda3\envs\OpenEO\lib\site-packages\openeo\metadata.py:307, in CubeMetadata.filter_bands(self, band_names)
300 “”"
301 Create new CubeMetadata
with filtered band dimension
302 :param band_names: list of band names/indices to keep
303 :return:
304 “”"
305 assert self.band_dimension
306 return self._clone_and_update(
→ 307 dimensions=[d.filter_bands(band_names) if isinstance(d, BandDimension) else d for d in self._dimensions]
308 )
File C:\ProgramData\anaconda3\envs\OpenEO\lib\site-packages\openeo\metadata.py:307, in (.0)
300 “”"
301 Create new CubeMetadata
with filtered band dimension
302 :param band_names: list of band names/indices to keep
303 :return:
304 “”"
305 assert self.band_dimension
306 return self._clone_and_update(
→ 307 dimensions=[d.filter_bands(band_names) if isinstance(d, BandDimension) else d for d in self._dimensions]
308 )
File C:\ProgramData\anaconda3\envs\OpenEO\lib\site-packages\openeo\metadata.py:172, in BandDimension.filter_bands(self, bands)
165 def filter_bands(self, bands: List[Union[int, str]]) → BandDimension:
166 “”"
167 Construct new BandDimension with subset of bands,
168 based on given band indices or (common) names
169 “”"
170 return BandDimension(
171 name=self.name,
→ 172 bands=[self.bands[self.band_index(b)] for b in bands]
173 )
File C:\ProgramData\anaconda3\envs\OpenEO\lib\site-packages\openeo\metadata.py:172, in (.0)
165 def filter_bands(self, bands: List[Union[int, str]]) → BandDimension:
166 “”"
167 Construct new BandDimension with subset of bands,
168 based on given band indices or (common) names
169 “”"
170 return BandDimension(
171 name=self.name,
→ 172 bands=[self.bands[self.band_index(b)] for b in bands]
173 )
File C:\ProgramData\anaconda3\envs\OpenEO\lib\site-packages\openeo\metadata.py:147, in BandDimension.band_index(self, band)
145 if any(aliases):
146 return aliases.index(True)
→ 147 raise ValueError(“Invalid band name/index {b!r}. Valid names: {n!r}”.format(b=band, n=band_names))
ValueError: Invalid band name/index ‘SCL’. Valid names: [‘B01’, ‘B02’, ‘B03’, ‘B04’, ‘B05’, ‘B06’, ‘B07’, ‘B08’, ‘B8A’, ‘B09’]