HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Python Labs
  2. /From digital numbers to a map of green
Earth and Environmental ScienceHardHigh School (11–12)Remote Sensing, GIS and Earth Data

From digital numbers to a map of green

Here are six pixels of a Landsat-like scene, with the digital numbers of their red and near-infrared bands. You will turn them into reflectances and a vegetation index, and count the dense plant cover.

The idea. Rescale each count with ρ′=2.0×10−5 DN−0.1\rho' = 2.0 \times 10^{-5}\,\text{DN} - 0.1ρ′=2.0×10−5DN−0.1, divide by sin⁡θSE\sin\theta_{SE}sinθSE​ for the Sun's elevation, and then take the NDVI of the two reflectances.

Your tasks.

  1. In reflectance, return the reflectance of one digital number for the given Sun elevation.
  2. In ndvi, return the NDVI of a pixel from its red and near-infrared digital numbers.
  3. In count_dense, return how many pixels have an NDVI of 0.50.50.5 or more.

Run it first, just as it is. The checker at the end prints FAIL for each task. Then do the tasks one at a time, and run the program again after each one. A Hint appears under every check that still fails.

When every line says PASS, change the Sun elevation to 25.0. Do the reflectances change? Does the count of dense pixels change?

StemPy LabContributed by StemPy Lab
python
Loading Python runtime…

A worked solution

Run your code once to unlock the worked solution.

Have you tried it?

Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.

Log in to save
← All Labs
← How fast does a cyclone move?How often does the satellite pass? →
More onRemote Sensing, GIS and Earth Data

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Reflectance, spectral signatures and indicesRemote Sensing: Spectra, Satellites and Vegetation

More labs on this topic

  1. Anomalies, a running mean and a trendHard
  2. A carbon dioxide record: trend and cycleHard
  3. A raster calculation: slope and floodingHard
  4. Degrees, distances and zonesHard
  • How often does the satellite pass?Hard
  • All labs on this topic →