This is an automated email from the ASF dual-hosted git repository. lahirujayathilake pushed a commit to branch cybershuttle-dev in repository https://gitbox.apache.org/repos/asf/airavata.git
commit 3debcbcc4b3df429df846b921bf6c024c3efdf08 Author: yasith <[email protected]> AuthorDate: Sat Mar 1 17:34:57 2025 -0600 updated notebooks --- .../cyberfaces/Solution_DA3_DEM_Access_v4.ipynb | 226 +++++- .../Solution_DP6_DEM_Processing_v2.ipynb | 890 +++++++++++++++++---- 2 files changed, 956 insertions(+), 160 deletions(-) diff --git a/modules/agent-framework/deployments/jupyterhub/data/cyberfaces/Solution_DA3_DEM_Access_v4.ipynb b/modules/agent-framework/deployments/jupyterhub/data/cyberfaces/Solution_DA3_DEM_Access_v4.ipynb index 40d216689b..39cb8e96f3 100644 --- a/modules/agent-framework/deployments/jupyterhub/data/cyberfaces/Solution_DA3_DEM_Access_v4.ipynb +++ b/modules/agent-framework/deployments/jupyterhub/data/cyberfaces/Solution_DA3_DEM_Access_v4.ipynb @@ -72,8 +72,8 @@ " %copy_data <r1:file1> <r2:file2> -- Copy <file1> in <r1> to <file2> in <r2>.\n", "\n", "\n", - "User code: MDZT-FMPY\n", - "Please authenticate by visiting: https://auth.cybershuttle.org/realms/default/device?user_code=MDZT-FMPY\n", + "User code: YGEX-OJDG\n", + "Please authenticate by visiting: https://auth.cybershuttle.org/realms/default/device?user_code=YGEX-OJDG\n", "Authorization pending, retrying...\n", "Received access token\n", "Requested runtime=test_cpu. state=14\n", @@ -347,11 +347,50 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n" + ] + }, + { + "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'watershed' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[4], line 2\n", + " 1 ## Get the min and max of latitude and longitude (or easting and northing)\n", + "----> 2 extents_basin=watershed.total_bounds\n", + " 4 ## N or S and W or E may become a problem\n", + " 5 print(f'Left Bounding Longtitude is {extents_basin[0]:.3f}\\u00b0 or {abs(extents_basin[0]):.3f}\\u00b0 W')\n", + "\n", + "NameError: name 'watershed' is not defined\n", + "</pre></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "## Get the min and max of latitude and longitude (or easting and northing)\n", "extents_basin=watershed.total_bounds\n", @@ -365,11 +404,56 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n" + ] + }, + { + "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'extents_basin' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[5], line 4\n", + " 1 ## DEMs are numbered using integer\n", + " 2 ## Calculate largest integer that equals or not greater than left and bottom bounds\n", + " 3 ## WRITE THE CODE BELOW\n", + "----> 4 extent_left=abs(math.floor(extents_basin[0]))\n", + " 5 extent_right=abs(math.floor(extents_basin[2]))\n", + " 6 ## You may be tempted to calculate the ceil of right extent\n", + " 7 ## But, number scheme is such that 84W indicates data from -84 to -83 deg W\n", + " 8 \n", + " 9 ## Calculate smallest integer that equals or not less than right and upper bounds\n", + " 10 ## WRITE THE CODE BELOW\n", + "\n", + "NameError: name 'extents_basin' is not defined\n", + "</pre></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "## DEMs are numbered using integer\n", "## Calculate largest integer that equals or not greater than left and bottom bounds\n", @@ -402,9 +486,50 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n" + ] + }, + { + "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'extent_right' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[6], line 5\n", + " 2 overlap_lonlat=[]\n", + " 4 ## Create a for loop to create a rectangular boundary and see if overlaps with watershed\n", + "----> 5 for lon in (range(extent_right,extent_left+1,1)):\n", + " 6 for lat in (range(extent_bottom,extent_top+1,1)):\n", + " 7 ## Defining in anticlockwise direction\n", + " 8 corner_left_bottom=(-lon,lat-1)\n", + "\n", + "NameError: name 'extent_right' is not defined\n", + "</pre></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "## Define a empty list to hold lon and lat pair\n", "overlap_lonlat=[]\n", @@ -451,11 +576,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n" + ] + } + ], "source": [ "## Create a progress bar for monitoring the download process\n", "class MyProgressBar():\n", @@ -487,11 +620,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n" + ] + } + ], "source": [ "current_filenum=1\n", "\n", @@ -536,9 +677,53 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n" + ] + }, + { + "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'watershed' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[9], line 12\n", + " 8 rasterio.plot.show(raster,\n", + " 9 ax=ax,\n", + " 10 cmap='viridis')\n", + " 11 #print(f'lat: {lat},lon: {lon},file:{local_fileloc_filename}')\n", + "---> 12 watershed.plot(ax=ax, \n", + " 13 facecolor='none', \n", + " 14 edgecolor='red')\n", + " 15 plt.title(\"Unmerged Raster DEMs\")\n", + " 16 plt.xlabel(\"Longitude (DD)\")\n", + "\n", + "NameError: name 'watershed' is not defined\n", + "</pre></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "fig, ax = plt.subplots(figsize=(8, 8))\n", "\n", @@ -561,9 +746,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Terminated runtime=test_cpu. state={'experimentId': 'CS_Agent_cfd825be-8531-4103-a9c9-77dace080fcd', 'terminated': True}\n", + "Switched to runtime=local.\n" + ] + } + ], "source": [ "%stop_runtime test_cpu\n", "%switch_runtime local" diff --git a/modules/agent-framework/deployments/jupyterhub/data/cyberfaces/Solution_DP6_DEM_Processing_v2.ipynb b/modules/agent-framework/deployments/jupyterhub/data/cyberfaces/Solution_DP6_DEM_Processing_v2.ipynb index 406539ccec..676b62a712 100644 --- a/modules/agent-framework/deployments/jupyterhub/data/cyberfaces/Solution_DP6_DEM_Processing_v2.ipynb +++ b/modules/agent-framework/deployments/jupyterhub/data/cyberfaces/Solution_DP6_DEM_Processing_v2.ipynb @@ -54,11 +54,58 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Loaded airavata_jupyter_magic\n", + "(current runtime = local)\n", + "\n", + " %authenticate -- Authenticate to access high-performance runtimes.\n", + " %request_runtime <rt> [args] -- Request a runtime named <rt> with configuration <args>. Call multiple times to request multiple runtimes.\n", + " %stop_runtime <rt> -- Stop runtime <rt> when no longer needed.\n", + " %switch_runtime <rt> -- Switch active runtime to <rt>. All subsequent executions will use this runtime.\n", + " %%run_on <rt> -- Force a cell to always execute on <rt>, regardless of the active runtime.\n", + " %copy_data <r1:file1> <r2:file2> -- Copy <file1> in <r1> to <file2> in <r2>.\n", + "\n", + "\n", + "User code: CRRQ-PFFQ\n", + "Please authenticate by visiting: https://auth.cybershuttle.org/realms/default/device?user_code=CRRQ-PFFQ\n", + "Authorization pending, retrying...\n", + "Received access token\n", + "Requested runtime=test_cpu. state=14\n", + "Switched to runtime=test_cpu.\n" + ] + } + ], + "source": [ + "# %pip install airavata-jupyter-magic\n", + "import airavata_jupyter_magic\n", + "\n", + "%authenticate\n", + "%request_runtime test_cpu --cluster=Anvil --cpus=4 --memory=4096 --walltime=10 --queue=shared --group=CyberFaCES\n", + "%switch_runtime test_cpu" + ] + }, + { + "cell_type": "code", + "execution_count": 1, "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n" + ] + } + ], "source": [ "## Import the modules/packages/libraries required\n", "import math\n", @@ -87,7 +134,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 1, "metadata": { "tags": [] }, @@ -96,9 +143,10 @@ "name": "stdout", "output_type": "stream", "text": [ - "1.4.3\n", - "1.0.1\n", - "3.7.0\n" + "Runtime=test_cpu is ready!\n", + "1.3.8\n", + "0.14.4\n", + "3.6.1\n" ] } ], @@ -120,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 1, "metadata": { "tags": [] }, @@ -129,20 +177,98 @@ "name": "stdout", "output_type": "stream", "text": [ - "The required lon and lat pairs are: \n", - " [(85, 41), (86, 41), (86, 42), (87, 41), (87, 42), (88, 41)]\n", - "\n", - "Number of tiles required to cover the entire region: 8\n", - "Left: 88, Right: 85, Bottom: 41, Top: 42\n", - "\n", - "Number of tiles within watershed boundary: 6\n" + "Runtime=test_cpu is ready!\n" ] }, { "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAtkAAAIDCAYAAADR6ALXAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQABAABJREFUeJzsvXm8JVV57v9dQ9UezthNdwNNM4kaBDQKzkbBCyoCGr2iweHGgRtNIg6JXvNJJEajUaKJmlx/imYyUdRc5yReNaByzVUvojhh1BhFRZChobvPsPeuYa3398e7qvY+3Y2goiDW8/kc+uzatatWrdpNP+up531eIyJChw4dOnTo0KFDhw4dbjXY23oAHTp06NChQ4cOHTrc0dCR7A4dOnTo0KFDhw4dbmV0JLtDhw4dOnTo0KFDh1sZHcnu0KFDhw4dOnTo0OFWRkeyO3To0KFDhw4dOnS4ldGR7A4d [...] + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>DriverError: ./input_03335500/shape_03335500.shp: No such file or directory</strong>\n", + " ---------------------------------------------------------------------------\n", + "CPLE_OpenFailedError Traceback (most recent call last)\n", + "File fiona/ogrext.pyx:136, in fiona.ogrext.gdal_open_vector()\n", + "\n", + "File fiona/_err.pyx:291, in fiona._err.exc_wrap_pointer()\n", + "\n", + "CPLE_OpenFailedError: ./input_03335500/shape_03335500.shp: No such file or directory\n", + "\n", + "During handling of the above exception, another exception occurred:\n", + "\n", + "DriverError Traceback (most recent call last)\n", + "Cell In[3], line 13\n", + " 11 dem_files_store= folder_input\n", + " 12 ##Read the shapefile using geopandas\n", + "---> 13 watershed =geopandas.read_file(f'{folder_input}/shape_{site_id}.shp')\n", + " 14 ## Get the extents and number of tiles downloaded\n", + " 15 extents_basin=watershed.total_bounds\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/geopandas/io/file.py:289, in _read_file(filename, bbox, mask, rows, engine, **kwargs)\n", + " 286 else:\n", + " 287 path_or_bytes = filename\n", + "--> 289 return _read_file_fiona(\n", + " 290 path_or_bytes, from_bytes, bbox=bbox, mask=mask, rows=rows, **kwargs\n", + " 291 )\n", + " 293 else:\n", + " 294 raise ValueError(f\"unknown engine '{engine}'\")\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/geopandas/io/file.py:315, in _read_file_fiona(path_or_bytes, from_bytes, bbox, mask, rows, where, **kwargs)\n", + " 312 reader = fiona.open\n", + " 314 with fiona_env():\n", + "--> 315 with reader(path_or_bytes, **kwargs) as features:\n", + " 316 crs = features.crs_wkt\n", + " 317 # attempt to get EPSG code\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/fiona/env.py:457, in ensure_env_with_credentials.<locals>.wrapper(*args, **kwds)\n", + " 454 session = DummySession()\n", + " 456 with env_ctor(session=session):\n", + "--> 457 return f(*args, **kwds)\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/fiona/__init__.py:292, in open(fp, mode, driver, schema, crs, encoding, layer, vfs, enabled_drivers, crs_wkt, allow_unsupported_drivers, **kwargs)\n", + " 289 path = parse_path(fp)\n", + " 291 if mode in (\"a\", \"r\"):\n", + "--> 292 colxn = Collection(\n", + " 293 path,\n", + " 294 mode,\n", + " 295 driver=driver,\n", + " 296 encoding=encoding,\n", + " 297 layer=layer,\n", + " 298 enabled_drivers=enabled_drivers,\n", + " 299 allow_unsupported_drivers=allow_unsupported_drivers,\n", + " 300 **kwargs\n", + " 301 )\n", + " 302 elif mode == \"w\":\n", + " 303 colxn = Collection(\n", + " 304 path,\n", + " 305 mode,\n", + " (...)\n", + " 314 **kwargs\n", + " 315 )\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/fiona/collection.py:243, in Collection.__init__(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, include_fields, wkt_version, allow_unsupported_drivers, **kwargs)\n", + " 241 if self.mode == \"r\":\n", + " 242 self.session = Session()\n", + "--> 243 self.session.start(self, **kwargs)\n", + " 244 elif self.mode in (\"a\", \"w\"):\n", + " 245 self.session = WritingSession()\n", + "\n", + "File fiona/ogrext.pyx:588, in fiona.ogrext.Session.start()\n", + "\n", + "File fiona/ogrext.pyx:143, in fiona.ogrext.gdal_open_vector()\n", + "\n", + "DriverError: ./input_03335500/shape_03335500.shp: No such file or directory\n", + "</pre></div>" + ], "text/plain": [ - "<Figure size 800x800 with 1 Axes>" + "<IPython.core.display.HTML object>" ] }, "metadata": {}, @@ -267,7 +393,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 1, "metadata": { "tags": [] }, @@ -276,6 +402,7 @@ "name": "stdout", "output_type": "stream", "text": [ + "Runtime=test_cpu is ready!\n", "The new directory \u001b[1m'./input_03335500/intermediate_03335500'\u001b[0m is created!\n", "The new directory \u001b[1m'./input_03335500/results_03335500'\u001b[0m is created!\n" ] @@ -311,7 +438,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 1, "metadata": { "tags": [] }, @@ -320,8 +447,40 @@ "name": "stdout", "output_type": "stream", "text": [ - "Merging completed for 6 DEM raster files\n" + "Runtime=test_cpu is ready!\n" ] + }, + { + "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'num_tiles_download' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[5], line 48\n", + " 42 del mosaic_new_raster\n", + " 47 ## WRITE THE CODE BELOW \n", + "---> 48 if num_tiles_download==1:\n", + " 49 merged_raster_filename=f'{dem_files_store}/USGS_{resolution}_{usgs_filename}.tif'\n", + " 50 print(\"No need to merge as only one tiff file\")\n", + "\n", + "NameError: name 'num_tiles_download' is not defined\n", + "</pre></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ @@ -384,18 +543,16 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 1, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "'dem_files = [f for f in os.listdir(dem_files_store) if f.startswith(f\"USGS_{resolution}_\")]\\n#print(dem_files)\\n## Create a list to store the raster datasets\\ndatasets = []\\n## Open each DEM file and append it to the datasets list\\nfor dem_file in dem_files:\\n file_path = os.path.join(dem_files_store, dem_file)\\n src = rasterio.open(file_path)\\n datasets.append(src)\\n#print(datasets)\\n## Merge the raster datasets into a single mosaic\\nmosaic, out_trans = me [...] - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n", + "'dem_files = [f for f in os.listdir(dem_files_store) if f.startswith(f\"USGS_{resolution}_\")]\\n#print(dem_files)\\n## Create a list to store the raster datasets\\ndatasets = []\\n## Open each DEM file and append it to the datasets list\\nfor dem_file in dem_files:\\n file_path = os.path.join(dem_files_store, dem_file)\\n src = rasterio.open(file_path)\\n datasets.append(src)\\n#print(datasets)\\n## Merge the raster datasets into a single mosaic\\nmosaic, out_trans = mer [...] + ] } ], "source": [ @@ -418,7 +575,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 1, "metadata": { "tags": [] }, @@ -427,14 +584,34 @@ "name": "stdout", "output_type": "stream", "text": [ - "<open DatasetReader name='./input_03335500/intermediate_03335500/merged_1_03335500.tif' mode='r'>\n" + "Runtime=test_cpu is ready!\n" ] }, { "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAq4AAAGxCAYAAACjlzTVAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQABAABJREFUeJzsXXeYHVX5fs85M3Pv3ZZeIR0kJDRpGkUCJKEFkBKRTgAJVRARFEUpShUkiIiAGvhBIgLSRFqQIiAl0pUihBYgIYGUzZZ778w53++P75wzc3c3VQgE5n2efXbv3DP97u4773m/9xNERMiRI0eOHDly5MiR4zMO+WkfQI4cOXLkyJEjR44cK4OcuObIkSNHjhw5cuRYK5AT1xw5cuTIkSNHjhxrBXLimiNHjhw5cuTIkWOtQE5cc+TIkSNHjhw5cqwVyIlrjhw5cuTIkSNHjrUCOXHNkSNHjhw5cuTI [...] + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'merged_raster_filename' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[7], line 1\n", + "----> 1 with rasterio.open(merged_raster_filename) as src:\n", + " 2 print(src)\n", + " 3 fig, ax = plt.subplots(figsize = (8,8))\n", + "\n", + "NameError: name 'merged_raster_filename' is not defined\n", + "</pre></div>" + ], "text/plain": [ - "<Figure size 800x800 with 2 Axes>" + "<IPython.core.display.HTML object>" ] }, "metadata": {}, @@ -480,7 +657,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 1, "metadata": { "tags": [] }, @@ -489,8 +666,37 @@ "name": "stdout", "output_type": "stream", "text": [ - "EPSG:4326\n" + "Runtime=test_cpu is ready!\n" ] + }, + { + "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'watershed' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[8], line 2\n", + " 1 ## Find if basin has a projection\n", + "----> 2 print(watershed.crs)\n", + "\n", + "NameError: name 'watershed' is not defined\n", + "</pre></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ @@ -512,75 +718,48 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 1, "metadata": { "tags": [] }, "outputs": [ { - "name": "stderr", + "name": "stdout", "output_type": "stream", "text": [ - "/tmp/ipykernel_955/2437152260.py:3: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.\n", - "\n", - " df['geometry'].centroid\n", - "/tmp/ipykernel_955/2437152260.py:5: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.\n", - "\n", - " df['Center_point'] = df['geometry'].centroid\n" + "Runtime=test_cpu is ready!\n" ] }, { "data": { "text/html": [ - "<div>\n", - "<style scoped>\n", - " .dataframe tbody tr th:only-of-type {\n", - " vertical-align: middle;\n", - " }\n", - "\n", - " .dataframe tbody tr th {\n", - " vertical-align: top;\n", - " }\n", - "\n", - " .dataframe thead th {\n", - " text-align: right;\n", - " }\n", - "</style>\n", - "<table border=\"1\" class=\"dataframe\">\n", - " <thead>\n", - " <tr style=\"text-align: right;\">\n", - " <th></th>\n", - " <th>identifier</th>\n", - " <th>geometry</th>\n", - " <th>Center_point</th>\n", - " <th>lon</th>\n", - " <th>lat</th>\n", - " </tr>\n", - " </thead>\n", - " <tbody>\n", - " <tr>\n", - " <th>0</th>\n", - " <td>USGS-03335500</td>\n", - " <td>POLYGON ((-86.89955 40.41564, -86.90128 40.418...</td>\n", - " <td>POINT (-85.89738 40.73546)</td>\n", - " <td>-85.897381</td>\n", - " <td>40.735461</td>\n", - " </tr>\n", - " </tbody>\n", - "</table>\n", - "</div>" + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'watershed' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[9], line 2\n", + " 1 ## Find the approximate centroid\n", + "----> 2 df=watershed\n", + " 3 df['geometry'].centroid\n", + " 4 ## Find the center point\n", + "\n", + "NameError: name 'watershed' is not defined\n", + "</pre></div>" ], "text/plain": [ - " identifier geometry \\\n", - "0 USGS-03335500 POLYGON ((-86.89955 40.41564, -86.90128 40.418... \n", - "\n", - " Center_point lon lat \n", - "0 POINT (-85.89738 40.73546) -85.897381 40.735461 " + "<IPython.core.display.HTML object>" ] }, - "execution_count": 32, "metadata": {}, - "output_type": "execute_result" + "output_type": "display_data" } ], "source": [ @@ -597,20 +776,48 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 1, "metadata": { "tags": [] }, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n" + ] + }, { "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'df' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[10], line 2\n", + " 1 ## Calculate N or S\n", + "----> 2 if 0 < df['lat'][0] < 84:\n", + " 3 lat_zone='N'\n", + " 4 elif -84 < df['lat'][0] < 0:\n", + "\n", + "NameError: name 'df' is not defined\n", + "</pre></div>" + ], "text/plain": [ - "'EPSG:32616'" + "<IPython.core.display.HTML object>" ] }, - "execution_count": 33, "metadata": {}, - "output_type": "execute_result" + "output_type": "display_data" } ], "source": [ @@ -662,33 +869,47 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 1, "metadata": { "tags": [] }, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n" + ] + }, { "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'watershed' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[11], line 2\n", + " 1 ## Alternative Method to estimate the CRS\n", + "----> 2 crs_string2=watershed.estimate_utm_crs(datum_name='WGS 84')\n", + " 3 crs_string2\n", + "\n", + "NameError: name 'watershed' is not defined\n", + "</pre></div>" + ], "text/plain": [ - "<Projected CRS: EPSG:32616>\n", - "Name: WGS 84 / UTM zone 16N\n", - "Axis Info [cartesian]:\n", - "- E[east]: Easting (metre)\n", - "- N[north]: Northing (metre)\n", - "Area of Use:\n", - "- name: Between 90°W and 84°W, northern hemisphere between equator and 84°N, onshore and offshore. Belize. Canada - Manitoba; Nunavut; Ontario. Costa Rica. Cuba. Ecuador - Galapagos. El Salvador. Guatemala. Honduras. Mexico. Nicaragua. United States (USA).\n", - "- bounds: (-90.0, 0.0, -84.0, 84.0)\n", - "Coordinate Operation:\n", - "- name: UTM zone 16N\n", - "- method: Transverse Mercator\n", - "Datum: World Geodetic System 1984 ensemble\n", - "- Ellipsoid: WGS 84\n", - "- Prime Meridian: Greenwich" + "<IPython.core.display.HTML object>" ] }, - "execution_count": 34, "metadata": {}, - "output_type": "execute_result" + "output_type": "display_data" } ], "source": [ @@ -710,15 +931,109 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "Runtime=test_cpu is ready!\n", "The new directory \u001b[1m'./input_03335500/results_03335500'\u001b[0m is not created as it already exists!\n" ] + }, + { + "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>DriverError: ./input_03335500/shape_03335500.shp: No such file or directory</strong>\n", + " ---------------------------------------------------------------------------\n", + "CPLE_OpenFailedError Traceback (most recent call last)\n", + "File fiona/ogrext.pyx:136, in fiona.ogrext.gdal_open_vector()\n", + "\n", + "File fiona/_err.pyx:291, in fiona._err.exc_wrap_pointer()\n", + "\n", + "CPLE_OpenFailedError: ./input_03335500/shape_03335500.shp: No such file or directory\n", + "\n", + "During handling of the above exception, another exception occurred:\n", + "\n", + "DriverError Traceback (most recent call last)\n", + "Cell In[12], line 6\n", + " 3 check_create_path_func(folder_results)\n", + " 5 shapefile_fileloc_filename=f'{folder_input}/shape_{site_id}.shp'\n", + "----> 6 watershed_file=geopandas.read_file(shapefile_fileloc_filename)\n", + " 7 watershed_proj=watershed_file.to_crs(crs_string)\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/geopandas/io/file.py:289, in _read_file(filename, bbox, mask, rows, engine, **kwargs)\n", + " 286 else:\n", + " 287 path_or_bytes = filename\n", + "--> 289 return _read_file_fiona(\n", + " 290 path_or_bytes, from_bytes, bbox=bbox, mask=mask, rows=rows, **kwargs\n", + " 291 )\n", + " 293 else:\n", + " 294 raise ValueError(f\"unknown engine '{engine}'\")\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/geopandas/io/file.py:315, in _read_file_fiona(path_or_bytes, from_bytes, bbox, mask, rows, where, **kwargs)\n", + " 312 reader = fiona.open\n", + " 314 with fiona_env():\n", + "--> 315 with reader(path_or_bytes, **kwargs) as features:\n", + " 316 crs = features.crs_wkt\n", + " 317 # attempt to get EPSG code\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/fiona/env.py:457, in ensure_env_with_credentials.<locals>.wrapper(*args, **kwds)\n", + " 454 session = DummySession()\n", + " 456 with env_ctor(session=session):\n", + "--> 457 return f(*args, **kwds)\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/fiona/__init__.py:292, in open(fp, mode, driver, schema, crs, encoding, layer, vfs, enabled_drivers, crs_wkt, allow_unsupported_drivers, **kwargs)\n", + " 289 path = parse_path(fp)\n", + " 291 if mode in (\"a\", \"r\"):\n", + "--> 292 colxn = Collection(\n", + " 293 path,\n", + " 294 mode,\n", + " 295 driver=driver,\n", + " 296 encoding=encoding,\n", + " 297 layer=layer,\n", + " 298 enabled_drivers=enabled_drivers,\n", + " 299 allow_unsupported_drivers=allow_unsupported_drivers,\n", + " 300 **kwargs\n", + " 301 )\n", + " 302 elif mode == \"w\":\n", + " 303 colxn = Collection(\n", + " 304 path,\n", + " 305 mode,\n", + " (...)\n", + " 314 **kwargs\n", + " 315 )\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/fiona/collection.py:243, in Collection.__init__(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, include_fields, wkt_version, allow_unsupported_drivers, **kwargs)\n", + " 241 if self.mode == \"r\":\n", + " 242 self.session = Session()\n", + "--> 243 self.session.start(self, **kwargs)\n", + " 244 elif self.mode in (\"a\", \"w\"):\n", + " 245 self.session = WritingSession()\n", + "\n", + "File fiona/ogrext.pyx:588, in fiona.ogrext.Session.start()\n", + "\n", + "File fiona/ogrext.pyx:143, in fiona.ogrext.gdal_open_vector()\n", + "\n", + "DriverError: ./input_03335500/shape_03335500.shp: No such file or directory\n", + "</pre></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ @@ -733,7 +1048,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 1, "metadata": { "tags": [] }, @@ -742,11 +1057,38 @@ "name": "stdout", "output_type": "stream", "text": [ - "EPSG:4326\n", - "EPSG:32616\n", - "<class 'geopandas.geodataframe.GeoDataFrame'>\n", - "<class 'geopandas.geodataframe.GeoDataFrame'>\n" + "Runtime=test_cpu is ready!\n" ] + }, + { + "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'watershed_file' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[13], line 1\n", + "----> 1 print(watershed_file.crs)\n", + " 2 print(watershed_proj.crs)\n", + " 3 print(type(watershed_file))\n", + "\n", + "NameError: name 'watershed_file' is not defined\n", + "</pre></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ @@ -758,7 +1100,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 1, "metadata": { "tags": [] }, @@ -767,8 +1109,39 @@ "name": "stdout", "output_type": "stream", "text": [ + "Runtime=test_cpu is ready!\n", "./input_03335500/results_03335500/proj_shp_03335500.shp\n" ] + }, + { + "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'watershed_proj' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[14], line 3\n", + " 1 proj_shapefile_filename=f'{folder_results}/proj_shp_{site_id}.shp'\n", + " 2 print(proj_shapefile_filename)\n", + "----> 3 watershed_proj.to_file(proj_shapefile_filename, driver='ESRI Shapefile',mode='w')\n", + "\n", + "NameError: name 'watershed_proj' is not defined\n", + "</pre></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ @@ -790,7 +1163,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 1, "metadata": { "tags": [] }, @@ -799,12 +1172,39 @@ "name": "stdout", "output_type": "stream", "text": [ - "./input_03335500/intermediate_03335500/merged_1_03335500.tif \n", - " ./input_03335500/intermediate_03335500/reprojected_1_03335500.tif\n", - "<open DatasetReader name='./input_03335500/intermediate_03335500/merged_1_03335500.tif' mode='r'>\n", - "Band(ds=<open DatasetReader name='./input_03335500/intermediate_03335500/merged_1_03335500.tif' mode='r'>, bidx=1, dtype='float32', shape=(7212, 14412))\n", - "Reprojection complete.\n" + "Runtime=test_cpu is ready!\n" ] + }, + { + "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>NameError: name 'merged_raster_filename' is not defined</strong>\n", + " ---------------------------------------------------------------------------\n", + "NameError Traceback (most recent call last)\n", + "Cell In[15], line 35\n", + " 32 ## WRITE CODE BELOW\n", + " 34 reprojected_raster_filename=f'{folder_intermediate}/reprojected_{resolution}_{site_id}.tif'\n", + "---> 35 print(merged_raster_filename,\"\\n\",reprojected_raster_filename)\n", + " 36 reproject_raster_func(merged_raster_filename, reprojected_raster_filename, crs_string)\n", + "\n", + "NameError: name 'merged_raster_filename' is not defined\n", + "</pre></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ @@ -848,16 +1248,73 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 1, "metadata": { "tags": [] }, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n" + ] + }, { "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAqYAAAHCCAYAAAA99gtOAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQABAABJREFUeJzsfXm8HUW19aqq7j7DHTKTQICEhDkkgBEEBQIyySQ85kkwgoCAoD55yEM+iIqAwhNUREQJEkEUHBBkDMiggsyCCphE5imBjHc4p7ur9vfHrqruc+/NBEgC1vr9bs49faq7q6tP7lln7b3XFkRECAgICAgICAgICFjFkKt6AgEBAQEBAQEBAQFAIKYBAQEBAQEBAQGrCQIxDQgICAgICAgIWC0QiGlAQEBAQEBAQMBqgUBMAwICAgICAgICVgsEYhoQEBAQEBAQELBaIBDTgICAgICAgICA1QKBmAYE [...] + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>RasterioIOError: ./input_03335500/intermediate_03335500/reprojected_1_03335500.tif: No such file or directory</strong>\n", + " ---------------------------------------------------------------------------\n", + "CPLE_OpenFailedError Traceback (most recent call last)\n", + "File rasterio/_base.pyx:310, in rasterio._base.DatasetBase.__init__()\n", + "\n", + "File rasterio/_base.pyx:221, in rasterio._base.open_dataset()\n", + "\n", + "File rasterio/_err.pyx:221, in rasterio._err.exc_wrap_pointer()\n", + "\n", + "CPLE_OpenFailedError: ./input_03335500/intermediate_03335500/reprojected_1_03335500.tif: No such file or directory\n", + "\n", + "During handling of the above exception, another exception occurred:\n", + "\n", + "RasterioIOError Traceback (most recent call last)\n", + "Cell In[16], line 2\n", + " 1 reprojected_raster_filename=f'{folder_intermediate}/reprojected_{resolution}_{site_id}.tif'\n", + "----> 2 with rasterio.open(reprojected_raster_filename) as src:\n", + " 3 fig, ax = plt.subplots(figsize = (8,8))\n", + " 4 mapped=rasterio.plot.show(src,\n", + " 5 ax=ax, \n", + " 6 cmap='viridis')\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/rasterio/env.py:451, in ensure_env_with_credentials.<locals>.wrapper(*args, **kwds)\n", + " 448 session = DummySession()\n", + " 450 with env_ctor(session=session):\n", + "--> 451 return f(*args, **kwds)\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/rasterio/__init__.py:304, in open(fp, mode, driver, width, height, count, crs, transform, dtype, nodata, sharing, **kwargs)\n", + " 301 path = _parse_path(raw_dataset_path)\n", + " 303 if mode == \"r\":\n", + "--> 304 dataset = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)\n", + " 305 elif mode == \"r+\":\n", + " 306 dataset = get_writer_for_path(path, driver=driver)(\n", + " 307 path, mode, driver=driver, sharing=sharing, **kwargs\n", + " 308 )\n", + "\n", + "File rasterio/_base.pyx:312, in rasterio._base.DatasetBase.__init__()\n", + "\n", + "RasterioIOError: ./input_03335500/intermediate_03335500/reprojected_1_03335500.tif: No such file or directory\n", + "</pre></div>" + ], "text/plain": [ - "<Figure size 800x800 with 2 Axes>" + "<IPython.core.display.HTML object>" ] }, "metadata": {}, @@ -905,7 +1362,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 1, "metadata": { "tags": [] }, @@ -914,8 +1371,111 @@ "name": "stdout", "output_type": "stream", "text": [ - "Raster clipping complete.\n" + "Runtime=test_cpu is ready!\n" ] + }, + { + "data": { + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>DriverError: ./input_03335500/results_03335500/proj_shp_03335500.shp: No such file or directory</strong>\n", + " ---------------------------------------------------------------------------\n", + "CPLE_OpenFailedError Traceback (most recent call last)\n", + "File fiona/ogrext.pyx:136, in fiona.ogrext.gdal_open_vector()\n", + "\n", + "File fiona/_err.pyx:291, in fiona._err.exc_wrap_pointer()\n", + "\n", + "CPLE_OpenFailedError: ./input_03335500/results_03335500/proj_shp_03335500.shp: No such file or directory\n", + "\n", + "During handling of the above exception, another exception occurred:\n", + "\n", + "DriverError Traceback (most recent call last)\n", + "Cell In[17], line 30\n", + " 27 buffer_value_in_meters=1500\n", + " 29 clipped_raster_filename=f'{folder_results}/clipped_{resolution}_{site_id}.tif'\n", + "---> 30 clip_raster_with_shapefile_func(reprojected_raster_filename,\n", + " 31 clipped_raster_filename,\n", + " 32 proj_shapefile_filename,\n", + " 33 buffer_value_in_meters)\n", + "\n", + "Cell In[17], line 5, in clip_raster_with_shapefile_func(input_raster, output_raster, shapefile, buffer_value)\n", + " 3 def clip_raster_with_shapefile_func(input_raster, output_raster, shapefile,buffer_value):\n", + " 4 ## Open the shapefile using geopandas\n", + "----> 5 shapefile_gdf = geopandas.read_file(shapefile).buffer(buffer_value)\n", + " 6 ## Open the input raster\n", + " 7 with rasterio.open(input_raster) as src:\n", + " 8 ## Convert the shapefile geometry to the same CRS as the raster\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/geopandas/io/file.py:289, in _read_file(filename, bbox, mask, rows, engine, **kwargs)\n", + " 286 else:\n", + " 287 path_or_bytes = filename\n", + "--> 289 return _read_file_fiona(\n", + " 290 path_or_bytes, from_bytes, bbox=bbox, mask=mask, rows=rows, **kwargs\n", + " 291 )\n", + " 293 else:\n", + " 294 raise ValueError(f\"unknown engine '{engine}'\")\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/geopandas/io/file.py:315, in _read_file_fiona(path_or_bytes, from_bytes, bbox, mask, rows, where, **kwargs)\n", + " 312 reader = fiona.open\n", + " 314 with fiona_env():\n", + "--> 315 with reader(path_or_bytes, **kwargs) as features:\n", + " 316 crs = features.crs_wkt\n", + " 317 # attempt to get EPSG code\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/fiona/env.py:457, in ensure_env_with_credentials.<locals>.wrapper(*args, **kwds)\n", + " 454 session = DummySession()\n", + " 456 with env_ctor(session=session):\n", + "--> 457 return f(*args, **kwds)\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/fiona/__init__.py:292, in open(fp, mode, driver, schema, crs, encoding, layer, vfs, enabled_drivers, crs_wkt, allow_unsupported_drivers, **kwargs)\n", + " 289 path = parse_path(fp)\n", + " 291 if mode in (\"a\", \"r\"):\n", + "--> 292 colxn = Collection(\n", + " 293 path,\n", + " 294 mode,\n", + " 295 driver=driver,\n", + " 296 encoding=encoding,\n", + " 297 layer=layer,\n", + " 298 enabled_drivers=enabled_drivers,\n", + " 299 allow_unsupported_drivers=allow_unsupported_drivers,\n", + " 300 **kwargs\n", + " 301 )\n", + " 302 elif mode == \"w\":\n", + " 303 colxn = Collection(\n", + " 304 path,\n", + " 305 mode,\n", + " (...)\n", + " 314 **kwargs\n", + " 315 )\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/fiona/collection.py:243, in Collection.__init__(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, include_fields, wkt_version, allow_unsupported_drivers, **kwargs)\n", + " 241 if self.mode == \"r\":\n", + " 242 self.session = Session()\n", + "--> 243 self.session.start(self, **kwargs)\n", + " 244 elif self.mode in (\"a\", \"w\"):\n", + " 245 self.session = WritingSession()\n", + "\n", + "File fiona/ogrext.pyx:588, in fiona.ogrext.Session.start()\n", + "\n", + "File fiona/ogrext.pyx:143, in fiona.ogrext.gdal_open_vector()\n", + "\n", + "DriverError: ./input_03335500/results_03335500/proj_shp_03335500.shp: No such file or directory\n", + "</pre></div>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ @@ -956,14 +1516,70 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 1, "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runtime=test_cpu is ready!\n" + ] + }, { "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAq0AAAGXCAYAAACZVWn9AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQABAABJREFUeJzsnXd4FFXbh+8pu5seCISEGnoNCAIqvUtXQFCUjiIqFqzIZwN7FxuIiCCIDRA7XUWkSC/SCb33hLTdnZnz/TElWRJKEAVf576uKHv2zMw5s7Ozv3nOUyQhhMDFxcXFxcXFxcXlCka+3ANwcXFxcXFxcXFxOR+uaHVxcXFxcXFxcbnicUWri4uLi4uLi4vLFY8rWl1cXFxcXFxcXK54XNHq4uLi4uLi4uJyxeOKVhcXFxcXFxcXlyseV7S6uLi4uLi4uLhc8bii1cXFxcXFxcXF5YrHFa0uLi4uLi4u [...] + "text/html": [ + "\n", + " <div style=\"\n", + " color: #a71d5d;\n", + " background-color: #fdd;\n", + " border: 1px solid #a71d5d;\n", + " padding: 5px;\n", + " border-radius: 5px;\n", + " font-family: Consolas, 'Courier New', monospace;\n", + " \">\n", + " <pre><strong>RasterioIOError: ./input_03335500/results_03335500/clipped_1_03335500.tif: No such file or directory</strong>\n", + " ---------------------------------------------------------------------------\n", + "CPLE_OpenFailedError Traceback (most recent call last)\n", + "File rasterio/_base.pyx:310, in rasterio._base.DatasetBase.__init__()\n", + "\n", + "File rasterio/_base.pyx:221, in rasterio._base.open_dataset()\n", + "\n", + "File rasterio/_err.pyx:221, in rasterio._err.exc_wrap_pointer()\n", + "\n", + "CPLE_OpenFailedError: ./input_03335500/results_03335500/clipped_1_03335500.tif: No such file or directory\n", + "\n", + "During handling of the above exception, another exception occurred:\n", + "\n", + "RasterioIOError Traceback (most recent call last)\n", + "Cell In[18], line 1\n", + "----> 1 with rasterio.open(clipped_raster_filename) as src1:\n", + " 2 fig, ax = plt.subplots(figsize = (8,8))\n", + " 3 mapped=rasterio.plot.show(src1,\n", + " 4 ax=ax, \n", + " 5 cmap='viridis')\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/rasterio/env.py:451, in ensure_env_with_credentials.<locals>.wrapper(*args, **kwds)\n", + " 448 session = DummySession()\n", + " 450 with env_ctor(session=session):\n", + "--> 451 return f(*args, **kwds)\n", + "\n", + "File /opt/conda/lib/python3.11/site-packages/rasterio/__init__.py:304, in open(fp, mode, driver, width, height, count, crs, transform, dtype, nodata, sharing, **kwargs)\n", + " 301 path = _parse_path(raw_dataset_path)\n", + " 303 if mode == \"r\":\n", + "--> 304 dataset = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)\n", + " 305 elif mode == \"r+\":\n", + " 306 dataset = get_writer_for_path(path, driver=driver)(\n", + " 307 path, mode, driver=driver, sharing=sharing, **kwargs\n", + " 308 )\n", + "\n", + "File rasterio/_base.pyx:312, in rasterio._base.DatasetBase.__init__()\n", + "\n", + "RasterioIOError: ./input_03335500/results_03335500/clipped_1_03335500.tif: No such file or directory\n", + "</pre></div>" + ], "text/plain": [ - "<Figure size 800x800 with 2 Axes>" + "<IPython.core.display.HTML object>" ] }, "metadata": {}, @@ -993,27 +1609,13 @@ " edgecolor='red')\n", "src.close()" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { "kernelspec": { - "display_name": "ct-fair", + "display_name": "airavata_examples", "language": "python", - "name": "ct-fair" + "name": "python3" }, "language_info": { "codemirror_mode": {
