-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7281a5f
commit 5909665
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
import json | ||
import pathlib | ||
|
||
import paint.util.paint_mappings as mappings | ||
|
||
|
||
def make_catalog(arguments: argparse.Namespace) -> None: | ||
""" | ||
Generate the catalog STAC. | ||
Parameters | ||
---------- | ||
arguments: argparse.Namespace | ||
The arguments containing the output path. | ||
""" | ||
catalog = { | ||
"stac_version": mappings.STAC_VERSION, | ||
"stac_extensions": [], | ||
"id": mappings.CATALOG_ID, | ||
"type": mappings.CATALOG, | ||
"title": f"Operational data of concentrating solar power plant {mappings.POWER_PLANT_GPPD_ID}", | ||
"description": "Calibration images, deflectometry measurements, kinematics and weather data", | ||
"links": [ | ||
mappings.LICENSE_LINK, | ||
{ | ||
"rel": "self", | ||
"href": mappings.CATALOGUE_URL, | ||
"type": mappings.MIME_GEOJSON, | ||
"title": "Reference to this STAC collection file", | ||
}, | ||
{ | ||
"rel": "root", | ||
"href": mappings.CATALOGUE_URL, | ||
"type": mappings.MIME_GEOJSON, | ||
"title": "Reference to this STAC collection file", | ||
}, | ||
{ | ||
"rel": "child", | ||
"href": mappings.CALIBRATION_COLLECTION_URL, | ||
"type": mappings.MIME_GEOJSON, | ||
"title": "Reference to the STAC collection containing the calibration data", | ||
}, | ||
], | ||
} | ||
|
||
with open(arguments.output / mappings.CATALOG_FILE, "w") as handle: | ||
json.dump(catalog, handle) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-o", "--output", type=pathlib.Path, default="stac") | ||
args = parser.parse_args() | ||
|
||
make_catalog(args) |