Assignment

Assignment#

Before starting this assignment, follow the instructions to install Python, activate the course environment, and launch JupyterLab.

conda activate rs

and

jupyter lab

In this assignment, we will be working with a Landsat 8 image of the Greenland Ice Sheet from Jul 24, 2015. The image can be downloaded from here. There are three bands in this image corresponding to Blue, Green, and Red (in that order).

Task 1 (10 points)#

  • a) Open the landsat-rgb.tif file (i.e. src = rasterio.open('data/landsat-rgb.tif')). How many rows and columns are in this image?

  • b) What is the coordinate reference system of this image? What is the spatial resolution of this image?

  • c) Read each band as a separate variable (e.g. band1 = src.read(1)) and scale the values between 0 and 1 by dividing by the maximum value of a 16-bit integer (i.e. band1 = src1.read(1) / 65536).

  • d) Stack the bands and plot a true color image.

  • e) Compute spectral index based on the RGB bands that emphasizes the water in the image. Once you have done that, make another plot (with a colorbar) to show your index.

Hint

Access the first band of the stacked variable using rgb[:,:,0].

  • f) Export your spectral index as a GeoTIFF and open it in QGIS. If you were asked to distinguish between water and non-water pixels in your index, what threshold would you use? Note you can use the Identify features to obtain pixel values.

Important

Save your notebook to your local course folder and submit assignment (in .pdf format) to Canvas by the deadline.