Created
April 14, 2023 11:52
-
-
Save TomAugspurger/bdc7f5694581a112130e5dee9fee1961 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "7e3fcbd9", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"import ipyleaflet\n", | |
"import shapely.geometry\n", | |
"import pystac_client\n", | |
"import itertools" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"id": "e86bd29e-da6f-4240-93e8-72df0e0e4bd1", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"catalog = pystac_client.Client.open(\"https://pct-apis-staging.westeurope.cloudapp.azure.com/stac\")\n", | |
"s5p = catalog.get_collection(\"sentinel-5p-l2-netcdf\")\n", | |
"items = list(itertools.islice(s5p.get_items(), 200))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"id": "f55958a0-4815-416d-b1b6-f204a52ea6b6", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.jupyter.widget-view+json": { | |
"model_id": "ab9f6d6bd73849c59441b8e597aae2c4", | |
"version_major": 2, | |
"version_minor": 0 | |
}, | |
"text/plain": [ | |
"interactive(children=(IntSlider(value=0, description='x', max=199), Output()), _dom_classes=('widget-interact'…" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"application/vnd.jupyter.widget-view+json": { | |
"model_id": "ab3c3de132b243d5abd374a0cf9b77bd", | |
"version_major": 2, | |
"version_minor": 0 | |
}, | |
"text/plain": [ | |
"Map(center=[0.0, 0.0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_t…" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"import ipywidgets\n", | |
"\n", | |
"layer = ipyleaflet.GeoJSON(data={})\n", | |
"m = ipyleaflet.Map(zoom=1)\n", | |
"m.add(layer)\n", | |
"\n", | |
"\n", | |
"@ipywidgets.interact(x=(0, len(items) - 1))\n", | |
"def h(x=0):\n", | |
" item = items[x]\n", | |
" print(x, item.id)\n", | |
" layer.data = item.geometry\n", | |
" \n", | |
"m " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "14a24028", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"language": "python", | |
"name": "python3" | |
}, | |
"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.10.8" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment