From ddef52090305b56265a89e484c07695ee99fb6e6 Mon Sep 17 00:00:00 2001 From: Carl Boettiger Date: Sun, 29 Dec 2024 04:45:32 +0000 Subject: [PATCH] debug iframe --- _quarto.yml | 2 +- static/ndvi-redlines.html | 38 +++++++++++++++++++++++++++ tutorials/python/1-intro-python.ipynb | 36 +++++++++---------------- 3 files changed, 52 insertions(+), 24 deletions(-) create mode 100644 static/ndvi-redlines.html diff --git a/_quarto.yml b/_quarto.yml index a802451..986543b 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -4,7 +4,6 @@ project: render: - "*.qmd" - "*.ipynb" - - "tutorials/python/*.html" - "!drafts/" execute: freeze: auto @@ -13,6 +12,7 @@ website: repo-url: https://github.com/boettiger-lab/nasa-topst-env-justice repo-actions: [edit, issue] page-navigation: true + resources: static navbar: background: black search: true diff --git a/static/ndvi-redlines.html b/static/ndvi-redlines.html new file mode 100644 index 0000000..290a9a2 --- /dev/null +++ b/static/ndvi-redlines.html @@ -0,0 +1,38 @@ + + + +My Awesome Map + + + + + + +
+ + + \ No newline at end of file diff --git a/tutorials/python/1-intro-python.ipynb b/tutorials/python/1-intro-python.ipynb index 3c7afb4..f0131b9 100644 --- a/tutorials/python/1-intro-python.ipynb +++ b/tutorials/python/1-intro-python.ipynb @@ -763,38 +763,28 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 15, "id": "0e84fb3a-fe46-4f2b-b016-be3e94852072", "metadata": {}, "outputs": [ { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" + "ename": "FileNotFoundError", + "evalue": "[Errno 2] No such file or directory: '../../static/ndvi-redlines.html'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[15], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# use an iframe so the map can display on webpages\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mIPython\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdisplay\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m IFrame\n\u001b[0;32m----> 3\u001b[0m \u001b[43mm\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_html\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m../../static/ndvi-redlines.html\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moverwrite\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 4\u001b[0m IFrame(src\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mhttps://boettiger-lab.github.io/nasa-topst-env-justice/ndvi-redlines.html\u001b[39m\u001b[38;5;124m'\u001b[39m, width\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m700\u001b[39m, height\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m400\u001b[39m)\n", + "File \u001b[0;32m/opt/conda/lib/python3.12/site-packages/leafmap/maplibregl.py:1457\u001b[0m, in \u001b[0;36mMap.to_html\u001b[0;34m(self, output, title, width, height, replace_key, remove_port, preview, overwrite, **kwargs)\u001b[0m\n\u001b[1;32m 1454\u001b[0m num \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlen\u001b[39m(glob\u001b[38;5;241m.\u001b[39mglob(output\u001b[38;5;241m.\u001b[39mreplace(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m.html\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m*.html\u001b[39m\u001b[38;5;124m\"\u001b[39m)))\n\u001b[1;32m 1455\u001b[0m output \u001b[38;5;241m=\u001b[39m output\u001b[38;5;241m.\u001b[39mreplace(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m.html\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mnum\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m.html\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m-> 1457\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28;43mopen\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43moutput\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mw\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mas\u001b[39;00m f:\n\u001b[1;32m 1458\u001b[0m f\u001b[38;5;241m.\u001b[39mwrite(html)\n\u001b[1;32m 1459\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m preview:\n", + "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '../../static/ndvi-redlines.html'" + ] } ], "source": [ "# use an iframe so the map can display on webpages\n", "from IPython.display import IFrame\n", - "m.to_html(\"ndvi-redlines.html\", overwrite=True)\n", - "IFrame(src='https://boettiger-lab.github.io/nasa-topst-env-justice/tutorials/python/ndvi-redlines.html', width=700, height=400)" + "m.to_html(\"../../static/ndvi-redlines.html\", overwrite=True)\n", + "IFrame(src='https://boettiger-lab.github.io/nasa-topst-env-justice/ndvi-redlines.html', width=700, height=400)" ] }, {