From 6a6753e0efacf89ddc5b66fb375397bdfb5bd2a1 Mon Sep 17 00:00:00 2001 From: Jan Tschada Date: Fri, 27 Sep 2024 16:35:11 +0200 Subject: [PATCH] #1 Updated documentation --- .../Urban Heat Risk Index Sample.ipynb | 360 +----------------- spatial-data-science/scripts/README.md | 20 +- 2 files changed, 36 insertions(+), 344 deletions(-) diff --git a/spatial-data-science/notebooks/Urban Heat Risk Index Sample.ipynb b/spatial-data-science/notebooks/Urban Heat Risk Index Sample.ipynb index 0548a2d..19aedab 100644 --- a/spatial-data-science/notebooks/Urban Heat Risk Index Sample.ipynb +++ b/spatial-data-science/notebooks/Urban Heat Risk Index Sample.ipynb @@ -11,19 +11,19 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "150b3605", "metadata": {}, "outputs": [], "source": [ "from arcgis.gis import GIS\n", - "from arcgis.features import FeatureLayer, GeoAccessor\n", + "from arcgis.features import GeoAccessor\n", "from heatri import calculate_heat_risk_index_using_extent, generate_renderer" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "472f9ae8", "metadata": {}, "outputs": [], @@ -33,54 +33,25 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "16bbe714", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "7700b03a9fe24b699ecd463e48b80833", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "MapView(layout=Layout(height='400px', width='100%'))" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "bonn_map = gis.map('Bonn, Germany')\n", "bonn_map" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "215f9d8d", + "metadata": {}, + "outputs": [], + "source": [ + "bonn_map.extent" + ] + }, { "cell_type": "markdown", "id": "605d12d8", @@ -92,264 +63,10 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "16076048", "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'NoneType' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'NoneType' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'NoneType' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'NoneType' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'float' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'float' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'NoneType' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'NoneType' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'NoneType' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'NoneType' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'NoneType' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'NoneType' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'NoneType' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'NoneType' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'NoneType' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'NoneType' and 'NoneType'" - ] - }, - { - "ename": "TypeError", - "evalue": "unsupported operand type(s) for +: 'NoneType' and 'NoneType'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'NoneType' and 'NoneType'" - ] - } - ], + "outputs": [], "source": [ "heat_risk_index_features = calculate_heat_risk_index_using_extent(bonn_map.extent)\n", "hri_sdf = GeoAccessor.from_featureclass(heat_risk_index_features)" @@ -366,51 +83,12 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "ff0b516f", "metadata": { "scrolled": false }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "a2895ea846c5429aa21a5ffe3bc88725", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "MapView(layout=Layout(height='400px', width='100%'))" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "drawing_info = {\n", " 'renderer': generate_renderer()\n", diff --git a/spatial-data-science/scripts/README.md b/spatial-data-science/scripts/README.md index 9c821c1..00149e3 100644 --- a/spatial-data-science/scripts/README.md +++ b/spatial-data-science/scripts/README.md @@ -16,7 +16,21 @@ pip install --user . ```python -from heatri import calculate_heat_risk_index - -# TODO +from arcgis.features import GeoAccessor +from heatri import calculate_heat_risk_index_using_extent + +# Calculates the heat risk index using an extent +extent = { + 'spatialReference': { + 'latestWkid': 3857, + 'wkid': 102100 + }, + 'xmin': 789781.3584458455, + 'ymin': 6573897.888560204, + 'xmax': 790368.9681008684, + 'ymax': 6574136.754273627 +} +heat_risk_index_features = calculate_heat_risk_index_using_extent(extent) +hri_sdf = GeoAccessor.from_featureclass(heat_risk_index_features) +hri_sdf ``` \ No newline at end of file