ENCN205 · GIS Component · Lab 3

Lab 3: Raster Analysis — Terrain, Hazards, and Catchments

University of Canterbury · Te Whare Wānanga o Waitaha

Duration: 2–3 hours  ·  Format: Python (Jupyter notebook)  ·  Prerequisites: Labs 1–2  ·  Assessment: sign-off quiz submitted to LEARN

1Learning Objectives

2Engineering Scenario

You are analysing terrain on Banks Peninsula for a slope stability and seismic hazard assessment. Using a real 8 m DEM, you will compute terrain derivatives, identify steep slopes on the volcanic flanks, and extract ground shaking intensities at building locations.

Start as usual: conda activate encn205, then jupyter lab, then open Lab3_RasterAnalysis.ipynb and run the cells in order with Shift + Enter.

3Step-by-Step Instructions

Section 1: Setup and Raster Fundamentals

Import numpy, matplotlib, and geopandas. Understand raster fundamentals: cells, resolution, and extent.

Section 2: Loading and Inspecting the DEM

Load the Banks Peninsula DEM. Inspect its shape, resolution, and elevation range. Visualise it with a terrain colourmap.

Section 3: Hillshade — Simulating Terrain Illumination

Compute hillshade from elevation gradients. Combine the DEM and hillshade for enhanced visualisation, and try different sun azimuths.

Section 4: Map Algebra — Reclassification and Masking

Reclassify elevation into engineering-relevant classes. Create Boolean masks for flood zones. Calculate areas.

Section 5: Terrain Derivatives — Slope and Aspect

Compute slope (steepness) and aspect (direction). Identify steep slopes above a threshold and calculate the steep area.

Section 6: Cropping Rasters with Vector Boundaries

Crop the DEM to a study area polygon boundary. Compare the full and cropped raster extents.

Section 7: Extracting Raster Values at Point Locations

Extract elevation and slope values at building locations. Write a function that maps point coordinates to raster cells.

Section 8: Combining Raster and Vector — Seismic Hazard Assessment

Create a PGA raster. Extract shaking intensity at buildings. Classify damage potential and produce a final assessment map.

Section 9: Zonal Statistics

Divide the study area into zones. Compute mean, max, and range statistics per zone. Visualise zone boundaries on the DEM.

Section 10: Elevation Distribution (Hypsometric Curve)

Plot the elevation histogram and hypsometric curve. Interpret what the curve shape says about Banks Peninsula's terrain compared to a flat alluvial plain.

4Assessment: Lab Sign-Off

This lab is not complete until you have submitted your sign-off to LEARN.

Step 1 — Self-check

Before you start the quiz, make sure you can do each of these:

Step 2 — Take the sign-off quiz

  1. Download Lab3_SignOff.html from LEARN and open it in your web browser.
  2. Enter your full name and University ID, then answer the 10 questions.
  3. You need 8 out of 10 to pass. You can retake it as often as you like — each attempt draws a new set of questions, and every answer comes with an explanation.
  4. When you pass, click Download Sign-Off PNG. This saves a file called ENCN205_Lab3_<yourID>.png.

Step 3 — Submit

Upload ENCN205_Lab3_<yourID>.png to the Lab 3 Sign-Off submission on LEARN.

The PNG records your name, ID, score, and a timestamp inside the QR code. It's your proof of completion — show it to your tutor if they ask.

Tips and Troubleshooting

SymptomFix
imshow shows the DEM upside-down Use the origin='lower' parameter
Colours look wrong Check for NaN values in your array
Slope values look far too small or large np.degrees() converts radians to degrees
Point extraction returns the wrong cell Array indexing is row = (y - y_origin) / resolution, col = (x - x_origin) / resolution
Shape errors when combining arrays Check the array shape — a DEM is (rows, cols), not (cols, rows)
Working with your own data later For real projects, use rioxarray to read GeoTIFF files