Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions OSC/osc_pr_pystac.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"outputs": [],
"source": [
"# read the catalog root\n",
"catalog = pystac.Catalog.from_file('../open-science-catalog-metadata-staging/catalog.json')\n",
"catalog = pystac.Catalog.from_file('../../open-science-catalog-metadata/catalog.json')\n",
"\n",
"# access the list of the themes in open science catalog\n",
"themes = catalog.get_child('themes')\n",
Expand Down Expand Up @@ -241,7 +241,7 @@
"outputs": [],
"source": [
"def create_product_collection(product_id, product_title, product_description, product_extent, product_license,\n",
" product_keywords, product_status, product_region, product_project_id,\n",
" product_keywords, product_status, product_region, product_project_id, product_project_title,\n",
" product_parameters=None, product_doi=None):\n",
"\n",
" collection = pystac.Collection(\n",
Expand All @@ -263,7 +263,7 @@
" pystac.Link(rel=\"root\", target=\"../../catalog.json\", media_type=\"application/json\", title=\"Open Science Catalog\"),\n",
" pystac.Link(rel=\"parent\", target=\"../catalog.json\", media_type=\"application/json\", title=\"Products\"),\n",
" # pystac.Link(rel=\"self\", target=f\"https://esa-earthcode.github.io/open-science-catalog-metadata/products/{project_id}/collection.json\", media_type=\"application/json\"),\n",
" pystac.Link(rel=\"related\", target=f\"../../projects/{product_project_id}/collection.json\", media_type=\"application/json\", title=f\"Project: {project_title}\"),\n",
" pystac.Link(rel=\"related\", target=f\"../../projects/{product_project_id}/collection.json\", media_type=\"application/json\", title=f\"Project: {product_project_title}\"),\n",
"\n",
" ])\n",
"\n",
Expand Down Expand Up @@ -304,7 +304,7 @@
"source": [
"def create_workflow_collection(workflow_id, workflow_title, \n",
" workflow_description, workflow_license, workflow_extent,\n",
" workflow_keywords, workflow_formats, workflow_project):\n",
" workflow_keywords, workflow_formats, workflow_project, workflow_project_title):\n",
"\n",
" '''Create a workflow collection template from the provided information.'''\n",
"\n",
Expand Down Expand Up @@ -348,7 +348,7 @@
" \"rel\": \"related\",\n",
" \"href\": f\"../../projects/{workflow_project}/collection.json\",\n",
" \"type\": \"application/json\",\n",
" \"title\": f\"Project: {project_title}\"\n",
" \"title\": f\"Project: {workflow_project_title}\"\n",
" },\n",
" \n",
" ]\n",
Expand Down Expand Up @@ -521,14 +521,15 @@
"# Define spatial and temporal extent\n",
"product_spatial_extent = pystac.SpatialExtent([[2.5135, 49.529, 6.156, 51.475]])\n",
"product_temporal_extent = pystac.TemporalExtent([[datetime(2021, 1, 1), datetime(2021, 12, 31, 23, 59, 59)]])\n",
"product_extent = pystac.Extent(spatial=spatial_extent, temporal=temporal_extent)\n",
"product_extent = pystac.Extent(spatial=product_spatial_extent, temporal=product_temporal_extent)\n",
"product_region = \"Belgium\"\n",
"product_themes = [\"land\"]\n",
"product_missions = [ \"sentinel-2\"]\n",
"product_variables = [ \"crop-yield-forecast\" ]\n",
"product_parameters = [ \"crop-yield-forecast\" ]\n",
"\n",
"product_project_id = \"worldcereal2\"\n",
"product_project_title = \"WorldCereal2\"\n",
"\n",
"product_doi = \"https://doi.org/10.57780/s3d-83ad619\"\n",
"\n",
Expand All @@ -549,9 +550,10 @@
"metadata": {},
"outputs": [],
"source": [
"product_collection = create_product_collection(product_id, product_title, product_description, product_extent, product_license,\n",
" product_keywords, product_status, product_region, product_project_id,\n",
" product_parameters, product_doi)"
"product_collection = create_product_collection(\n",
" product_id, product_title, product_description, product_extent, \n",
" product_license, product_keywords, product_status, product_region, \n",
" product_project_id, product_project_title, product_parameters, product_doi)"
]
},
{
Expand Down Expand Up @@ -666,6 +668,8 @@
"workflow_keywords= [\"agriculture\", \"crops\"]\n",
"workflow_formats = [\"GeoTIFF\"]\n",
"workflow_project = \"worldcereal2\"\n",
"workflow_project_title = \"WorldCereal2\"\n",
"\n",
"workflow_themes = ['land']\n",
"\n",
"# Define spatial and temporal extent\n",
Expand All @@ -692,7 +696,7 @@
"source": [
"workflow_collection = create_workflow_collection(workflow_id, workflow_title, \n",
" workflow_description, workflow_license, workflow_extent,\n",
" workflow_keywords, workflow_formats, workflow_project)"
" workflow_keywords, workflow_formats, workflow_project, workflow_project_title)"
]
},
{
Expand Down
Loading