Contents

import pystac
import datetime
!rm -r ../stac
hrefroot="https://intake-catalog-data-infrastructure-services-714f5e0b87b6b0abc33.gitlab-pages.dkrz.de/stac/"
rm: cannot remove '../stac': No such file or directory
dkrz_cat = pystac.Catalog(
    id="DKRZ", 
    title="The DKRZ Data Catalog",
    description="# DKRZ projects "+
    "which provide and share data on DKRZ data storages and repositories",
    href=hrefroot+"dkrz_catalog.json"
    )
projects={
    "ERA5":dict(
        desc="\n# Data of the ECMWF Reanalysis project phase 5",
        title="Data of the ECMWF Reanalysis project phase 5"
    ),
    "NextGEMs":dict(
        desc="""
# Data of the Next Generation Earth Modelling Systems project
nextGEMS is a collaborative European project. Funded by the EU’s Horizon 2020 programme, it will tap expertise from fourteen European Nations to develop two next generation (storm-resolving) Earth-system Models. 
Through breakthroughs in simulation realism, these models will allow us to understand and reliably quantify how the climate will change on a global and regional scale,
and how the weather, including its extreme events, will look like in the future. 
See further details at https://nextgems-h2020.eu/ and https://cordis.europa.eu/project/id/101003470. 
""",
        title="Data of the Next Generation Earth Modelling Systems project",
    ),
    "CMIP6":dict(
        desc="\n# Data of the Coupled Model Intercomparison Project phase 6",
        title="CMIP6"
    )
}
project_catalogs={}
for project, desc in projects.items():
    project_catalogs[project]=pystac.collection.Collection(
        project,
        description=projects[project]["desc"],
        title=projects[project]["title"],
        href=hrefroot+f"{project}-stac.json",
        extent=pystac.collection.Extent.from_dict(
            {
                "spatial":{"bbox":[[-180,-90,180,90]]},
                "temporal":{"interval":[["2024-01-01T00:00:00Z","2024-01-02T00:00:00Z"]]}
            }
        )
    )
project_catalogs["NextGEMs"].add_asset(
    "intake",
    asset=pystac.asset.Asset("https://raw.githubusercontent.com/nextGEMS/catalog/main/catalog.yaml")
)
project_catalogs["NextGEMs"].add_asset(
    "wdcc",
    asset=pystac.asset.Asset("https://www.wdc-climate.de/ui/project?acronym=nextGEMS")
)
for project, desc in projects.items():
    dkrz_cat.add_child(
        project_catalogs[project]
    )
dkrz_cat
dkrz_cat.save(
    pystac.CatalogType.ABSOLUTE_PUBLISHED,
    "../stac"
)