Skip to content

remove thumbnail asset hrefing preview.jpg as this asset is not alway… #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- pystac >= 1.9.0 is now required
- Names in eo:bands structure are now S2 band names, not common name ([#139](https://github.com/stactools-packages/sentinel2/pull/139))
- PVI asset role changed from "thumbnail" or "visual" to "overview" ([#143](https://github.com/stactools-packages/sentinel2/pull/143))
- Removed asset "thumbnail" pointing to preview.jpg asset, as this file frequently
does not exit. ([#144](https://github.com/stactools-packages/sentinel2/pull/144))

### Removed

Expand Down
2 changes: 0 additions & 2 deletions src/stactools/sentinel2/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
}

L2A_IMAGE_PATHS: Final[list[str]] = [
"preview.jpg",
"R10m/B04.jp2",
"R10m/B03.jp2",
"R10m/B02.jp2",
Expand Down Expand Up @@ -215,7 +214,6 @@
]

L1C_IMAGE_PATHS: Final[list[str]] = [
"preview.jpg",
"B01.jp2",
"B02.jp2",
"B03.jp2",
Expand Down
12 changes: 0 additions & 12 deletions src/stactools/sentinel2/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
SCL_PATTERN: Final[Pattern[str]] = re.compile(r"[_/]SCL[_.]")
CLD_PATTERN: Final[Pattern[str]] = re.compile(r"[_/]CLD[_.]")
SNW_PATTERN: Final[Pattern[str]] = re.compile(r"[_/]SNW[_.]")
THUMBNAIL_PATTERN: Final[Pattern[str]] = re.compile(r"[_/]preview[_.]")

BAND_PATTERN: Final[Pattern[str]] = re.compile(r"[_/](B\w{2})")
IS_TCI_PATTERN: Final[Pattern[str]] = re.compile(r"[_/]TCI")
Expand Down Expand Up @@ -271,7 +270,6 @@ def image_asset_from_href(
raise Exception(f"Must supply a media type for asset : {asset_href}")

# Handle preview image

if "_PVI" in asset_href:
asset = pystac.Asset(
href=asset_href,
Expand All @@ -283,16 +281,6 @@ def image_asset_from_href(
asset_eo.bands = RGB_BANDS
return "preview", asset

elif THUMBNAIL_PATTERN.search(asset_href):
# thumbnail image
asset = pystac.Asset(
href=asset_href,
media_type=pystac.MediaType.JPEG,
title="Thumbnail image",
roles=["thumbnail"],
)
return "thumbnail", asset

# Extract gsd and proj info
resolution = extract_gsd(asset_href)
if resolution is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,6 @@
}
],
"assets": {
"thumbnail": {
"href": "./preview.jpg",
"type": "image/jpeg",
"title": "Thumbnail image",
"roles": [
"thumbnail"
]
},
"coastal": {
"href": "./B01.jp2",
"type": "image/jp2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@
}
],
"assets": {
"thumbnail": {
"href": "./preview.jpg",
"type": "image/jpeg",
"title": "Thumbnail image",
"roles": [
"thumbnail"
]
},
"red": {
"href": "./R10m/B04.jp2",
"type": "image/jp2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@
}
],
"assets": {
"thumbnail": {
"href": "./preview.jpg",
"type": "image/jpeg",
"title": "Thumbnail image",
"roles": [
"thumbnail"
]
},
"red": {
"href": "./R10m/B04.jp2",
"type": "image/jp2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@
}
],
"assets": {
"thumbnail": {
"href": "./preview.jpg",
"type": "image/jpeg",
"title": "Thumbnail image",
"roles": [
"thumbnail"
]
},
"red": {
"href": "./R10m/B04.jp2",
"type": "image/jp2",
Expand Down