Skip to content

Commit cffa486

Browse files
committed
Update render extension for v2.0.0 conformance
1 parent 5a2fcce commit cffa486

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

pystac/extensions/render.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
SCHEMA_URI_PATTERN: str = (
1515
"https://stac-extensions.github.io/render/v{version}/schema.json"
1616
)
17-
DEFAULT_VERSION: str = "1.0.0"
17+
DEFAULT_VERSION: str = "2.0.0"
1818

1919
SUPPORTED_VERSIONS = [DEFAULT_VERSION]
2020

tests/data-files/render/collection.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"stac_version": "1.1.0",
33
"stac_extensions": [
4-
"https://stac-extensions.github.io/render/v1.0.0/schema.json"
4+
"https://stac-extensions.github.io/render/v2.0.0/schema.json"
55
],
66
"type": "Collection",
77
"id": "senitnel2-l2a",
@@ -16,6 +16,7 @@
1616
"interval": [["2015-06-23T00:00:00Z", null]]
1717
}
1818
},
19+
"item_assets": {},
1920
"renders": {
2021
"ndvi": {
2122
"title": "Normalized Difference Vegetation Index",

tests/data-files/render/item.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"type": "Feature",
33
"stac_version": "1.1.0",
44
"stac_extensions": [
5-
"https://stac-extensions.github.io/render/v1.0.0/schema.json"
5+
"https://stac-extensions.github.io/render/v2.0.0/schema.json"
66
],
77
"id": "S2B_33SVB_20210221_0_L2A",
88
"bbox": [

tests/extensions/test_render.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ def test_get_render_values(thumbnail_render: Render) -> None:
119119
assert thumbnail_render.rescale == [[0, 150]]
120120
assert thumbnail_render.colormap_name == "rainbow"
121121
assert thumbnail_render.resampling == "bilinear"
122-
# assert thumbnail_render.bidx == [1]
123-
# assert thumbnail_render.width == 1024
124-
# assert thumbnail_render.height == 1024
125-
# assert thumbnail_render.bands == ["B4", "B3", "B2"]
122+
assert thumbnail_render.properties.get("bidx") == [1]
123+
assert thumbnail_render.properties.get("width") == 1024
124+
assert thumbnail_render.properties.get("height") == 1024
125+
assert thumbnail_render.properties.get("bands") == ["B4", "B3", "B2"]
126126

127127

128128
def test_apply_renders_to_item(item: pystac.Item, render: Render) -> None:
@@ -222,3 +222,13 @@ def test_render_repr() -> None:
222222
"color_formula=gamma rg 1.3, sigmoidal rgb 22 0.1, saturation 1.5 "
223223
"resampling=bilinear expression=(B08-B04)/(B08+B04) minmax_zoom=[2, 18]>"
224224
)
225+
226+
227+
@pytest.mark.vcr
228+
def test_item_validate(ext_item: pystac.Item) -> None:
229+
assert ext_item.validate()
230+
231+
232+
@pytest.mark.vcr
233+
def test_collection_validate(ext_collection: pystac.Collection) -> None:
234+
assert ext_collection.validate()

0 commit comments

Comments
 (0)