{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "2b6832a8-f2ef-41e7-9409-f371ef51e8d0", "metadata": { "tags": [] }, "outputs": [], "source": [ "import pystac\n", "import datetime" ] }, { "cell_type": "code", "execution_count": null, "id": "35c5a10b-f4db-46cb-a8ed-59b81c38213a", "metadata": { "tags": [] }, "outputs": [], "source": [ "!rm -r ../stac\n", "hrefroot=\"https://intake-catalog-data-infrastructure-services-714f5e0b87b6b0abc33.gitlab-pages.dkrz.de/stac/\"" ] }, { "cell_type": "code", "execution_count": null, "id": "fb7b4fbc-b781-4c7f-ae13-8ddad9e140d3", "metadata": { "tags": [] }, "outputs": [], "source": [ "dkrz_cat = pystac.Catalog(\n", " id=\"DKRZ\", \n", " title=\"The DKRZ Data Catalog\",\n", " description=\"# DKRZ projects \"+\n", " \"which provide and share data on DKRZ data storages and repositories\",\n", " href=hrefroot+\"dkrz_catalog.json\"\n", " )" ] }, { "cell_type": "code", "execution_count": null, "id": "92b2f64e-de73-4eca-83fa-8e6d5c3e33fd", "metadata": { "tags": [] }, "outputs": [], "source": [ "projects={\n", " \"ERA5\":dict(\n", " desc=\"\\n# Data of the ECMWF Reanalysis project phase 5\",\n", " title=\"Data of the ECMWF Reanalysis project phase 5\"\n", " ),\n", " \"NextGEMs\":dict(\n", " desc=\"\"\"\n", "# Data of the Next Generation Earth Modelling Systems project\n", "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. \n", "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,\n", "and how the weather, including its extreme events, will look like in the future. \n", "See further details at https://nextgems-h2020.eu/ and https://cordis.europa.eu/project/id/101003470. \n", "\"\"\",\n", " title=\"Data of the Next Generation Earth Modelling Systems project\",\n", " ),\n", " \"CMIP6\":dict(\n", " desc=\"\\n# Data of the Coupled Model Intercomparison Project phase 6\",\n", " title=\"CMIP6\"\n", " )\n", "}" ] }, { "cell_type": "code", "execution_count": null, "id": "b148847c-d3d9-4d48-bc79-67ffed5d609a", "metadata": { "tags": [] }, "outputs": [], "source": [ "project_catalogs={}\n", "for project, desc in projects.items():\n", " project_catalogs[project]=pystac.collection.Collection(\n", " project,\n", " description=projects[project][\"desc\"],\n", " title=projects[project][\"title\"],\n", " href=hrefroot+f\"{project}-stac.json\",\n", " extent=pystac.collection.Extent.from_dict(\n", " {\n", " \"spatial\":{\"bbox\":[[-180,-90,180,90]]},\n", " \"temporal\":{\"interval\":[[\"2024-01-01T00:00:00Z\",\"2024-01-02T00:00:00Z\"]]}\n", " }\n", " )\n", " )" ] }, { "cell_type": "code", "execution_count": null, "id": "a3cdb1e3-2b6a-4ab0-81aa-da18b69930b4", "metadata": { "tags": [] }, "outputs": [], "source": [ "project_catalogs[\"NextGEMs\"].add_asset(\n", " \"intake\",\n", " asset=pystac.asset.Asset(\"https://raw.githubusercontent.com/nextGEMS/catalog/main/catalog.yaml\")\n", ")\n", "project_catalogs[\"NextGEMs\"].add_asset(\n", " \"wdcc\",\n", " asset=pystac.asset.Asset(\"https://www.wdc-climate.de/ui/project?acronym=nextGEMS\")\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "df4390e9-9a8b-4c7e-bd3f-f4385c4b1afe", "metadata": { "tags": [] }, "outputs": [], "source": [ "for project, desc in projects.items():\n", " dkrz_cat.add_child(\n", " project_catalogs[project]\n", " )" ] }, { "cell_type": "code", "execution_count": null, "id": "145dc0f1-8409-468f-b6f8-b06384ac5acd", "metadata": { "tags": [] }, "outputs": [], "source": [ "dkrz_cat" ] }, { "cell_type": "code", "execution_count": null, "id": "18afebca-9b49-4f43-aa36-d3952f7fb51f", "metadata": { "tags": [] }, "outputs": [], "source": [ "dkrz_cat.save(\n", " pystac.CatalogType.ABSOLUTE_PUBLISHED,\n", " \"../stac\"\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "8eda2240-87ef-4436-b5a2-ecad18445817", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "8a7bbaed-c86e-422e-9028-aa073cc7e666", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "02adaae7-c3ad-4574-b670-33c190b75893", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "6f13cce9-67ba-419b-9f2b-16bb079df019", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "c807b17e-532a-43a5-a9b8-f36b4693fc64", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "70323387-5dc2-4773-bbb0-c62d8ecb1848", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "dkrzcatalog", "language": "python", "name": "dkrzcatalog" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.2" } }, "nbformat": 4, "nbformat_minor": 5 }