From fbe4a68eccccf3674b5f414a0bfb5ee6d219fd91 Mon Sep 17 00:00:00 2001 From: Elise Hinman <ehinman@usgs.gov> Date: Thu, 10 Oct 2024 16:53:58 -0500 Subject: [PATCH] Add instructions for using conda --- ...t 9 Slider - Unequal access to water.ipynb | 308 ++++++++++++++++-- 1 file changed, 287 insertions(+), 21 deletions(-) diff --git a/2021 NLCD Pasture and Croplands vs Landsat 9 Slider - Unequal access to water.ipynb b/2021 NLCD Pasture and Croplands vs Landsat 9 Slider - Unequal access to water.ipynb index 756f9e7..ab9991a 100644 --- a/2021 NLCD Pasture and Croplands vs Landsat 9 Slider - Unequal access to water.ipynb +++ b/2021 NLCD Pasture and Croplands vs Landsat 9 Slider - Unequal access to water.ipynb @@ -7,16 +7,52 @@ "metadata": {}, "outputs": [], "source": [ - "# pip install geemap\n", - "# pip install ee " + "# Use the lines below to create and activate a conda environment containing the required packages\n", + "# conda env create -f environment.yaml\n", + "# conda activate ee-nb" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 11, "id": "2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " <style>\n", + " .geemap-dark {\n", + " --jp-widgets-color: white;\n", + " --jp-widgets-label-color: white;\n", + " --jp-ui-font-color1: white;\n", + " --jp-layout-color2: #454545;\n", + " background-color: #383838;\n", + " }\n", + "\n", + " .geemap-dark .jupyter-button {\n", + " --jp-layout-color3: #383838;\n", + " }\n", + "\n", + " .geemap-colab {\n", + " background-color: var(--colab-primary-surface-color, white);\n", + " }\n", + "\n", + " .geemap-colab .jupyter-button {\n", + " --jp-layout-color3: var(--colab-primary-surface-color, white);\n", + " }\n", + " </style>\n", + " " + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# Import the Earth Engine (ee) module, which allows interaction with Google Earth Engine.\n", "import ee\n", @@ -27,23 +63,113 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 12, + "id": "7ceffb2c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " <style>\n", + " .geemap-dark {\n", + " --jp-widgets-color: white;\n", + " --jp-widgets-label-color: white;\n", + " --jp-ui-font-color1: white;\n", + " --jp-layout-color2: #454545;\n", + " background-color: #383838;\n", + " }\n", + "\n", + " .geemap-dark .jupyter-button {\n", + " --jp-layout-color3: #383838;\n", + " }\n", + "\n", + " .geemap-colab {\n", + " background-color: var(--colab-primary-surface-color, white);\n", + " }\n", + "\n", + " .geemap-colab .jupyter-button {\n", + " --jp-layout-color3: var(--colab-primary-surface-color, white);\n", + " }\n", + " </style>\n", + " " + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ee.Authenticate()" + ] + }, + { + "cell_type": "code", + "execution_count": 13, "id": "3", "metadata": {}, "outputs": [ + { + "data": { + "text/html": [ + "\n", + " <style>\n", + " .geemap-dark {\n", + " --jp-widgets-color: white;\n", + " --jp-widgets-label-color: white;\n", + " --jp-ui-font-color1: white;\n", + " --jp-layout-color2: #454545;\n", + " background-color: #383838;\n", + " }\n", + "\n", + " .geemap-dark .jupyter-button {\n", + " --jp-layout-color3: #383838;\n", + " }\n", + "\n", + " .geemap-colab {\n", + " background-color: var(--colab-primary-surface-color, white);\n", + " }\n", + "\n", + " .geemap-colab .jupyter-button {\n", + " --jp-layout-color3: var(--colab-primary-surface-color, white);\n", + " }\n", + " </style>\n", + " " + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "c6e926d803204b36ac0901c05b331082", + "model_id": "2a97e195d2d24e40bc4b0e65d248833c", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "Map(center=[40, -100], controls=(WidgetControl(options=['position', 'transparent_bg'], widget=HBox(children=(T…" + "Map(center=[40, -100], controls=(WidgetControl(options=['position', 'transparent_bg'], widget=SearchDataGUI(ch…" ] }, + "execution_count": 13, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ @@ -56,10 +182,45 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 14, "id": "02297066", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " <style>\n", + " .geemap-dark {\n", + " --jp-widgets-color: white;\n", + " --jp-widgets-label-color: white;\n", + " --jp-ui-font-color1: white;\n", + " --jp-layout-color2: #454545;\n", + " background-color: #383838;\n", + " }\n", + "\n", + " .geemap-dark .jupyter-button {\n", + " --jp-layout-color3: #383838;\n", + " }\n", + "\n", + " .geemap-colab {\n", + " background-color: var(--colab-primary-surface-color, white);\n", + " }\n", + "\n", + " .geemap-colab .jupyter-button {\n", + " --jp-layout-color3: var(--colab-primary-surface-color, white);\n", + " }\n", + " </style>\n", + " " + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# Import the NLCD collection\n", "dataset = ee.ImageCollection('USGS/NLCD_RELEASES/2021_REL/NLCD')\n", @@ -100,23 +261,58 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 15, "id": "c9f2b271", "metadata": {}, "outputs": [ + { + "data": { + "text/html": [ + "\n", + " <style>\n", + " .geemap-dark {\n", + " --jp-widgets-color: white;\n", + " --jp-widgets-label-color: white;\n", + " --jp-ui-font-color1: white;\n", + " --jp-layout-color2: #454545;\n", + " background-color: #383838;\n", + " }\n", + "\n", + " .geemap-dark .jupyter-button {\n", + " --jp-layout-color3: #383838;\n", + " }\n", + "\n", + " .geemap-colab {\n", + " background-color: var(--colab-primary-surface-color, white);\n", + " }\n", + "\n", + " .geemap-colab .jupyter-button {\n", + " --jp-layout-color3: var(--colab-primary-surface-color, white);\n", + " }\n", + " </style>\n", + " " + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "c6e926d803204b36ac0901c05b331082", + "model_id": "2a97e195d2d24e40bc4b0e65d248833c", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "Map(bottom=992.0, center=[50.28933925329178, -82.08984375000001], controls=(WidgetControl(options=['position',…" + "Map(bottom=1888.0, center=[37.43997405227057, -97.03125000000001], controls=(WidgetControl(options=['position'…" ] }, + "execution_count": 15, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ @@ -159,10 +355,45 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 16, "id": "2bbe12a5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " <style>\n", + " .geemap-dark {\n", + " --jp-widgets-color: white;\n", + " --jp-widgets-label-color: white;\n", + " --jp-ui-font-color1: white;\n", + " --jp-layout-color2: #454545;\n", + " background-color: #383838;\n", + " }\n", + "\n", + " .geemap-dark .jupyter-button {\n", + " --jp-layout-color3: #383838;\n", + " }\n", + "\n", + " .geemap-colab {\n", + " background-color: var(--colab-primary-surface-color, white);\n", + " }\n", + "\n", + " .geemap-colab .jupyter-button {\n", + " --jp-layout-color3: var(--colab-primary-surface-color, white);\n", + " }\n", + " </style>\n", + " " + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "m = geemap.Map(center=[40, -100], zoom=4)\n", "m.add_basemap('CartoDB.DarkMatterNoLabels')" @@ -170,16 +401,50 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 17, "id": "c374e86f", "metadata": { "scrolled": false }, "outputs": [ + { + "data": { + "text/html": [ + "\n", + " <style>\n", + " .geemap-dark {\n", + " --jp-widgets-color: white;\n", + " --jp-widgets-label-color: white;\n", + " --jp-ui-font-color1: white;\n", + " --jp-layout-color2: #454545;\n", + " background-color: #383838;\n", + " }\n", + "\n", + " .geemap-dark .jupyter-button {\n", + " --jp-layout-color3: #383838;\n", + " }\n", + "\n", + " .geemap-colab {\n", + " background-color: var(--colab-primary-surface-color, white);\n", + " }\n", + "\n", + " .geemap-colab .jupyter-button {\n", + " --jp-layout-color3: var(--colab-primary-surface-color, white);\n", + " }\n", + " </style>\n", + " " + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "4a9aec747ad94aa4ab01a251dcde18c5", + "model_id": "abdc4ab5c6d74ef098d8768ca8eeff25", "version_major": 2, "version_minor": 0 }, @@ -187,8 +452,9 @@ "Map(center=[40, -100], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_t…" ] }, + "execution_count": 17, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ @@ -204,7 +470,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "ee-nb", "language": "python", "name": "python3" }, @@ -218,7 +484,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.15" + "version": "3.13.0" } }, "nbformat": 4, -- GitLab