Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gif generation notebook #163

Merged
merged 3 commits into from
Aug 19, 2024
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
41 changes: 27 additions & 14 deletions notebooks/tutorials/gif-generation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
"---"
]
},
{
"cell_type": "markdown",
"id": "c66864bc-302d-4d79-ad42-55c924f6f402",
"metadata": {},
"source": [
"::: {.callout-warning title=\"Notebook under review\"} \n",
"This notebook may have outdated dependencies and cell errors. It is currently [under review](https://github.com/NASA-IMPACT/veda-docs/issues/121) and undergoing changes with a different set of visualization libraries.\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "d929c8e7",
Expand Down Expand Up @@ -83,11 +93,11 @@
"metadata": {},
"outputs": [],
"source": [
"STAC_API_URL = \"https://staging-stac.delta-backend.com\"\n",
"RASTER_API_URL = \"https://staging-raster.delta-backend.com\"\n",
"STAC_API_URL = \"https://staging.openveda.cloud/api/stac\"\n",
"RASTER_API_URL = \"https://staging.openveda.cloud/api/raster\"\n",
"\n",
"# Collection we'll be using to generate the GIF\n",
"collection = \"no2-monthly\""
"collection_id = \"no2-monthly\""
]
},
{
Expand Down Expand Up @@ -180,7 +190,7 @@
"# NO2 monthly has a global extent, so we don't need to specify an area within\n",
"# which to search. For non-global datasets, use the `bbox` parameter to specify\n",
"# the bounding box within which to search.\n",
"items = requests.get(f\"{STAC_API_URL}/collections/{collection}/items?limit=100\").json()[\n",
"items = requests.get(f\"{STAC_API_URL}/collections/{collection_id}/items?limit=100\").json()[\n",
" \"features\"\n",
"]"
]
Expand Down Expand Up @@ -227,12 +237,15 @@
"metadata": {},
"outputs": [],
"source": [
"# get visualization parameters from collection summaries\n",
"COG_DEFAULT = [\n",
" x\n",
" for x in requests.get(f\"{STAC_API_URL}/collections\").json()[\"collections\"]\n",
" if x[\"id\"] == \"no2-monthly\"\n",
"][0][\"summaries\"][\"cog_default\"]"
"# get renders metadata\n",
"\n",
"renders = requests.get(\n",
" f\"{STAC_API_URL}/collections/{collection_id}\"\n",
").json()[\"renders\"]\n",
"\n",
"print(renders)\n",
"\n",
"rescale = renders[\"dashboard\"][\"rescale\"][0]"
]
},
{
Expand All @@ -258,7 +271,7 @@
" \"height\": 512,\n",
" \"width\": 512,\n",
" \"url\": items[0][\"assets\"][\"cog_default\"][\"href\"],\n",
" \"rescale\": f\"{COG_DEFAULT['min']},{COG_DEFAULT['max']}\",\n",
" \"rescale\": f\"{rescale[0]},{rescale[1]}\",\n",
" \"colormap_name\": \"viridis\",\n",
" },\n",
" json=france_aoi,\n",
Expand Down Expand Up @@ -626,9 +639,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:notebook] *",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "conda-env-notebook-py"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -640,7 +653,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
Loading