Skip to content

Commit

Permalink
added sentinel 2 band mapping in order to handle the updated STAC 1.0…
Browse files Browse the repository at this point in the history
….0 response
  • Loading branch information
dvd3v committed Nov 29, 2022
1 parent 1d99039 commit 16576f3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ ENV/
# Rope project settings
.ropeproject

# Pycharm project settings
.idea

# mkdocs documentation
/site

Expand Down
17 changes: 16 additions & 1 deletion rio_tiler_pds/sentinel/aws/sentinel2.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,21 @@ def _get_band_url(self, band: str) -> str:
# "WVP",
)

sentinel_l2a_band_map = {
"coastal": "B01",
"blue": "B02",
"green": "B03",
"red": "B04",
"rededge1": "B05",
"rededge2": "B06",
"rededge3": "B07",
"nir": "B08",
"nir09": "B09",
"swir16": "B11",
"swir22": "B12",
"nir08": "B8A",
}


@attr.s
class S2L2AReader(S2L1CReader):
Expand Down Expand Up @@ -248,7 +263,7 @@ def __attrs_post_init__(self):
self.crs = WGS84_CRS

self.bands = tuple(
[band for band in self.stac_item["assets"] if re.match("B[0-9A]{2}", band)]
[sentinel_l2a_band_map.get(band) for band in self.stac_item["assets"] if sentinel_l2a_band_map.get(band)]
)

def _get_band_url(self, band: str) -> str:
Expand Down

0 comments on commit 16576f3

Please sign in to comment.