Skip to content

Commit

Permalink
create juelich weather stac item
Browse files Browse the repository at this point in the history
  • Loading branch information
kalebphipps committed Aug 16, 2024
1 parent 952fbd4 commit 8f2213c
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions paint/data/juelich_weather_stac_item.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
from typing import Any, Dict

import pandas as pd

import paint.util.paint_mappings as mappings


def make_juelich_weather_item(
data: pd.Series,
) -> Dict[str, Any]:
"""
Generate a STAC item for the Juelich weather data.
Parameters
----------
data : pd.Series
The metadata for the juelich weather data file.
Returns
-------
dict[str, Any]
The STAC item data as dictionary.
"""
return {
"stac_version": mappings.STAC_VERSION,
"stac_extensions": [],
"id": "juelich-weather",
"type": "Feature",
"title": "Weather data from Juelich",
"description": "Weather data from the Juelich weather station",
"collection": mappings.WEATHER_COLLECTION_ID,
"geometry": {
"type": "Point",
"coordinates": [
mappings.POWER_PLANT_LAT,
mappings.POWER_PLANT_LON,
0, # TODO: Correct Elevation
],
},
"bbox": [
mappings.POWER_PLANT_LAT,
mappings.POWER_PLANT_LON,
0, # TODO: Correct Elevation
mappings.POWER_PLANT_LAT,
mappings.POWER_PLANT_LON,
0, # TODO: Correct Elevation
],
"properties": {
"datetime": "null",
},
"start_datetime": data[mappings.JUELICH_START],
"end_datetime": data[mappings.JUELICH_END],
"links": [
{
"rel": "self",
"href": f"./{mappings.JUELICH_STAC_NAME}",
"type": mappings.MIME_GEOJSON,
"title": "Reference to this STAC file",
},
{
"rel": "root",
"href": f"./{mappings.CATALOGUE_URL}",
"type": mappings.MIME_GEOJSON,
"title": f"Reference to the entire catalogue for {mappings.POWER_PLANT_GPPD_ID}",
},
{
"rel": "parent",
"href": mappings.WEATHER_COLLECTION_URL,
"type": mappings.MIME_GEOJSON,
"title": "Reference to the collection STAC file",
},
{
"rel": "collection",
"href": mappings.WEATHER_COLLECTION_FILE,
"type": mappings.MIME_GEOJSON,
"title": "Reference to the collection STAC file",
},
],
"assets": {
mappings.WEATHER_DATA_KEY: {
"href": "./juelich-weather.h5",
"roles": ["data"],
"type": mappings.MIME_HDF5,
"title": "Weather data from the Juelich weather station",
}
},
}

0 comments on commit 8f2213c

Please sign in to comment.