Skip to content

Commit

Permalink
Updated notebooks 2024-01-15 UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 15, 2024
1 parent 0e3af74 commit 9de8f79
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions content/notebooks/89_image_array_viz.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,92 @@
"m"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can also specify the image metadata (e.g., cellsize, crs, and transform) when creating the in-memory raster dataset.\n",
"\n",
"First, check the metadata of the origina image."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dataset.profile"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Check the crs of the original image."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dataset.crs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Check the transform of the original image."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dataset.transform"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Create an in-memory raster dataset from the NDVI array and specify the cellsize, crs, and transform."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"transform = (30.0, 0.0, -13651650.0, 0.0, -30.0, 4576290.0)\n",
"ndvi_image = leafmap.array_to_image(ndvi, cellsize=30, crs=\"EPSG:3857\", transform=transform)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Add the NDVI image to the map."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"m = leafmap.Map()\n",
"m.add_raster(satellite, band=[1, 2, 3], nodata=-1, layer_name=\"Landsat 7\")\n",
"m.add_raster(ndvi_image, cmap=\"Greens\", layer_name=\"NDVI\")\n",
"m"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 9de8f79

Please sign in to comment.