Skip to content

Commit

Permalink
removed band_data
Browse files Browse the repository at this point in the history
  • Loading branch information
huard committed May 7, 2024
1 parent ecd1a65 commit 4287425
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions docs/notebooks/02_Extract_geographical_watershed_properties.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"source": [
"features, statistics, raster = stats_resp.get(asobj=True)\n",
"grid = raster[0]\n",
"grid.band_data.plot()"
"grid.plot()"
]
},
{
Expand Down Expand Up @@ -226,7 +226,7 @@
},
"outputs": [],
"source": [
"unique, counts = np.unique(grid.band_data, return_counts=True)\n",
"unique, counts = np.unique(grid, return_counts=True)\n",
"print(\"The land-use categories available are: \" + str(unique))\n",
"print(\"The number of occurrences of each land-use category is: \" + str(counts))\n",
"\n",
Expand All @@ -245,8 +245,8 @@
"plt.ylabel(\"Number of pixels\")\n",
"plt.show()\n",
"\n",
"grid.band_data.where(grid.band_data != 127).sel(band=1).plot.imshow(cmap=\"tab20\")\n",
"grid.band_data.name = \"Land-use categories\"\n",
"grid.where(grid != 127).sel(band=1).plot.imshow(cmap=\"tab20\")\n",
"grid.name = \"Land-use categories\"\n",
"plt.show()"
]
},
Expand Down Expand Up @@ -301,10 +301,8 @@
")\n",
"\n",
"ax = plt.subplot(projection=crs)\n",
"grid.band_data.name = \"Land-use categories\"\n",
"grid.band_data.where(grid.band_data != 127).sel(band=1).plot.imshow(\n",
" ax=ax, transform=crs, cmap=\"tab20\"\n",
")\n",
"grid.name = \"Land-use categories\"\n",
"grid.where(grid != 127).sel(band=1).plot.imshow(ax=ax, transform=crs, cmap=\"tab20\")\n",
"plt.show()"
]
},
Expand Down Expand Up @@ -364,12 +362,10 @@
" central_latitude=49, central_longitude=-95, standard_parallels=(49, 77)\n",
")\n",
"\n",
"dem.band_data.name = \"Elevation\"\n",
"dem.band_data.attrs[\"units\"] = \"m\"\n",
"dem.name = \"Elevation\"\n",
"dem.attrs[\"units\"] = \"m\"\n",
"ax = plt.subplot(projection=crs)\n",
"dem.band_data.where(dem.band_data != -32768).sel(band=1).plot.imshow(\n",
" ax=ax, transform=crs, cmap=\"gnuplot\"\n",
")\n",
"dem.where(dem != -32768).sel(band=1).plot.imshow(ax=ax, transform=crs, cmap=\"gnuplot\")\n",
"plt.show()"
]
},
Expand Down

0 comments on commit 4287425

Please sign in to comment.