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. /A carbon dioxide record: trend and cycle
Earth and Environmental ScienceHardHigh School (11–12)Remote Sensing, GIS and Earth Data

A carbon dioxide record: trend and cycle

A record like the one at Mauna Loa Observatory in Hawaii has a trend and a yearly cycle. Here are three years of monthly values in ppm, from January of year 1. The values are rounded and were made for this lab. You will find the yearly means, the trend and the month of the peak.

The idea. The mean of twelve months has no yearly cycle. The slope of the yearly means is the trend. Taking each yearly mean from its own months leaves the cycle, and the mean of each calendar month then gives its size.

Your tasks.

  1. In yearly_means, return the list of the three yearly means.
  2. In trend_per_year, return the least-squares slope of the yearly means against the years 0,1,20, 1, 20,1,2, in ppm per year.
  3. In peak_month, return the number of the calendar month, 111 to 121212, with the highest mean after each year's own mean has been taken away.

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, print the twelve monthly means that task 3 uses. How far is the highest from the lowest?

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
← A raster calculation: slope and floodingAnomalies, a running mean and a trend →
More onRemote Sensing, GIS and Earth Data

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Time series, trends and the seasonal cycleEarth Data with Python: Trends, Anomalies and Models

More labs on this topic

  1. Anomalies, a running mean and a trendHard
  2. A raster calculation: slope and floodingHard
  3. Degrees, distances and zonesHard
  4. How often does the satellite pass?Hard
From digital numbers to a map of greenHard
All labs on this topic →