Skip to content

Commit 17e45ae

Browse files
1.0.0-beta.2 (#38)
* bump stac-pydantic * update index, ingest script * update test data * update pipfile * update pipfile * oops * update pipfile * eo:gsd -> gsd
1 parent 3dbc328 commit 17e45ae

7 files changed

Lines changed: 111 additions & 103 deletions

File tree

‎Pipfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ shapely = "*"
1313
sqlalchemy = "*"
1414
geoalchemy2 = "<0.8.0"
1515
sqlakeyset = "*"
16-
stac-pydantic = ">=1.1.3"
16+
stac-pydantic = ">=1.3.5"
1717
pydantic = {extras=["dotenv"], version="*"}
1818
cogeo-mosaic = "==3.0a10"
1919
titiler = "==0.1a2"

‎Pipfile.lock‎

Lines changed: 94 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/ingest_joplin.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def ingest_joplin_data():
1919
r = requests.get(f"https://{bucket}.s3.amazonaws.com/joplin/index.geojson")
2020
index = r.json()
2121
for feat in index["features"]:
22+
del feat["stac_extensions"]
2223
r = requests.post(
2324
urljoin(app_host, f"/collections/{collection['id']}/items"), json=feat
2425
)

‎stac_api/models/database.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def get_database_model(cls, schema: schemas.Item) -> dict:
104104
# Exclude indexed fields from the properties jsonb field
105105
properties = schema.properties.dict(exclude=set(config.settings.indexed_fields))
106106
now = datetime.utcnow().strftime(DATETIME_RFC339)
107-
if "created" not in properties:
107+
if not properties["created"]:
108108
properties["created"] = now
109109
properties["updated"] = now
110110

‎tests/data/test_collection.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"id":"test-collection","description":"Landat 8 imagery radiometrically calibrated and orthorectified using gound points and Digital Elevation Model (DEM) data to correct relief displacement.","stac_version":"0.9.0","license":"PDDL-1.0","extent":{"spatial":{"bbox":[[-180.0,-90.0,180.0,90.0]]},"temporal":{"interval":[["2013-06-01",null]]}},"links":[{"href":"http://localhost:8081/collections/landsat-8-l1","rel":"self","type":"application/json"},{"href":"http://localhost:8081/","rel":"parent","type":"application/json"},{"href":"http://localhost:8081/collections/landsat-8-l1/items","rel":"item","type":"application/geo+json"},{"href":"http://localhost:8081/","rel":"root","type":"application/json"}],"title":"Landsat 8 L1","keywords":["landsat","earth observation","usgs"],"providers":[{"name":"USGS","roles":["producer"],"url":"https://landsat.usgs.gov/"},{"name":"Planet Labs","roles":["processor"],"url":"https://github.com/landsat-pds/landsat_ingestor"},{"name":"AWS","roles":["host"],"url":"https://landsatonaws.com/"},{"name":"Development Seed","roles":["processor"],"url":"https://github.com/sat-utils/sat-api"},{"name":"Earth Search by Element84","description":"API of Earth on AWS datasets","roles":["host"],"url":"https://element84.com"}]}
1+
{"id":"test-collection","description":"Landat 8 imagery radiometrically calibrated and orthorectified using gound points and Digital Elevation Model (DEM) data to correct relief displacement.","stac_version":"1.0.0-beta.2","license":"PDDL-1.0","extent":{"spatial":{"bbox":[[-180.0,-90.0,180.0,90.0]]},"temporal":{"interval":[["2013-06-01",null]]}},"links":[{"href":"http://localhost:8081/collections/landsat-8-l1","rel":"self","type":"application/json"},{"href":"http://localhost:8081/","rel":"parent","type":"application/json"},{"href":"http://localhost:8081/collections/landsat-8-l1/items","rel":"item","type":"application/geo+json"},{"href":"http://localhost:8081/","rel":"root","type":"application/json"}],"title":"Landsat 8 L1","keywords":["landsat","earth observation","usgs"],"providers":[{"name":"USGS","roles":["producer"],"url":"https://landsat.usgs.gov/"},{"name":"Planet Labs","roles":["processor"],"url":"https://github.com/landsat-pds/landsat_ingestor"},{"name":"AWS","roles":["host"],"url":"https://landsatonaws.com/"},{"name":"Development Seed","roles":["processor"],"url":"https://github.com/sat-utils/sat-api"},{"name":"Earth Search by Element84","description":"API of Earth on AWS datasets","roles":["host"],"url":"https://element84.com"}]}

‎tests/data/test_item.json‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"properties": {
3232
"datetime": "2020-02-12T12:30:22Z",
3333
"landsat:scene_id": "LC82081612020043LGN00",
34-
"eo:row": "161",
35-
"eo:gsd": 15,
34+
"landsat:row": "161",
35+
"gsd": 15,
3636
"eo:bands": [
3737
{
3838
"gsd": 30,
@@ -113,17 +113,17 @@
113113
}
114114
],
115115
"landsat:revision": "00",
116-
"eo:sun_azimuth": -148.83296771,
117-
"eo:instrument": "OLI_TIRS",
116+
"view:sun_azimuth": -148.83296771,
117+
"instrument": "OLI_TIRS",
118118
"landsat:product_id": "LC08_L1GT_208161_20200212_20200212_01_RT",
119119
"eo:cloud_cover": -1,
120120
"landsat:tier": "RT",
121121
"landsat:processing_level": "L1GT",
122-
"eo:column": "208",
123-
"eo:platform": "landsat-8",
122+
"landsat:column": "208",
123+
"platform": "landsat-8",
124124
"proj:epsg": 32756,
125-
"eo:sun_elevation": -37.30791534,
126-
"eo:off_nadir": 0,
125+
"view:sun_elevation": -37.30791534,
126+
"view:off_nadir": 0,
127127
"height": 2500,
128128
"width": 2500
129129
},

‎tests/resources/test_item.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ def test_update_item_already_exists(app_client, load_test_data):
6464
)
6565
assert resp.status_code == 200
6666

67-
test_item["properties"]["eo:gsd"] = 16
67+
assert test_item["properties"]["gsd"] != 16
68+
test_item["properties"]["gsd"] = 16
6869
resp = app_client.put(
6970
f"/collections/{test_item['collection']}/items", json=test_item
7071
)
7172
updated_item = resp.json()
72-
assert updated_item["properties"]["eo:gsd"] == 16
73+
assert updated_item["properties"]["gsd"] == 16
7374

7475

7576
def test_update_new_item(app_client, load_test_data):
@@ -615,10 +616,10 @@ def test_field_extension_get(app_client, load_test_data):
615616
)
616617
assert resp.status_code == 200
617618

618-
params = {"fields": "+properties.proj:epsg,+properties.eo:gsd"}
619+
params = {"fields": "+properties.proj:epsg,+properties.gsd"}
619620
resp = app_client.get("/search", params=params)
620621
feat_properties = resp.json()["features"][0]["properties"]
621-
assert not set(feat_properties) - {"proj:epsg", "eo:gsd", "datetime"}
622+
assert not set(feat_properties) - {"proj:epsg", "gsd", "datetime"}
622623

623624

624625
def test_field_extension_post(app_client, load_test_data):

0 commit comments

Comments
 (0)