Welcome to Project Lovelace! We're still in early development so there are still tons of bugs to find and improvements to make. If you have any suggestions, complaints, or comments please let us know on Discourse, Discord, or GitHub!

El Niño intensities

You will learn about: El Niño–Southern Oscillation, 2D arrays, and reading files.

El Niño is a naturally occurring climate oscillation event in the equatorial Pacific which returns every 2–7 years. Originally, El Niño was the name used for warmer than average sea surface temperatures in the Pacific Ocean off the coast of South America but we now know that it's responsible for sea-surface temperature changes in the Pacific Ocean and global weather events. The ocean warming and associated wet climate off the coast of South America, which brings disastrous floods and reduces fishing stocks, is one of these events.

El Niño is associated with warm sea surface temperatures (SSTs) in the Equatorial Pacific. Scientists look at these SST anomalies in specific regions to determine whether El Niño is in effect. This map shows 4 regions. Scientists most often use SST anomalies in the Niño 3.4 region to compute the Oceanic Niño Index (ONI) which tells you how strong El Niño is when it is positive, and how strong La Niña is when it is negative. The ONI is computed using a 3-month running mean of SST anomalies in the Niño 3.4 region (5°N-5°S, 120°-170°W).

ENSO is the “El Niño-Southern Oscillation,” the name scientists use for El Niño. The other part of the climate oscillation, the Southern Oscillation, is a see-saw shift in surface air pressure between the eastern and western halves of the Pacific. When pressure rises in the east, it falls in the west and vice versa. In the 1950's scientists realized that El Niño and the Southern Oscillation were parts of the same event.

Warm water generally appears off the coast of South America close to Christmas, and reaches its peak warmth in fall of the following year. After peaking, the waters will tend to cool slowly through the winter and spring of the next year. The effects can be felt continually around the globe, for more than a year in some places.

The Multivariate ENSO Index (MEI) is a method used to characterize the intensity of an ENSO event using a single number. It is more comprehensive than the Oceanic Niño Index (ONI) described above. The MEI accounts for sea level pressure, zonal and meridional components of the surface wind, sea surface temperature, surface air temperature and cloudiness.

The MEI is calculated for each “sliding bi-monthly period” (December-January, January-February, February-March, etc.) for a total of 12 per year. A warm El Niño event occurs when the MEI is at or above +0.5, and a cold La Niña event occurs when the MEI is at or below -0.5. The threshold is further broken down into weak (with a 0.5 to 1.0 anomaly), moderate (1.0 to 1.5), strong (1.5 to 2.0) and very strong (≥ 2.0) events.

Multivariate ENSO Index (MEI) time series since 1950. Positive MEI is in red and corresponds to El Niño events while negative MEI is in blue and corresponds to La Niña events.

Write a function that reads in this text file (mei_index.txt) containing the MEI index values from 1871 to 2016 and determines whether a specific year experienced an El Niño event or a La Niña event (and the strength of the event). The file is provided by NOAA (source).

To determine whether a particular year experienced an El Niño or a La Niña event, use the maximum absolute MEI value in that year. So if one year saw a maximum MEI value of +1.8 and a minimum MEI value of -1.2, then it would be a strong El Niño event.

Input: Year as an integer.


Two strings:

  1. "El Nino", "La Nina", or "Neither" depending whether the year had an El Niño or La Niña event (or neither).
  2. "weak", "moderate", "strong, or "very strong" depending on the event's intensity. If there was no event, return "none" for the intensity.

Example 1

Input year: 2016 Output ENSO classification: "El Nino" Output ENSO strength: "very strong"

Example 2

Input two-year range: 1996 Output ENSO classification: "Neither" Output ENSO strength: "none"
 Difficulty  Timesink
 Function enso_classification(year)

You must be logged in to view your submissions.


Wolter & Timlin (2011), El Niño/Southern Oscillation behaviour since 1871 as diagnosed in an extended multivariate ENSO index (MEI.ext), International Journal of Climatology 31, 1074-1087.

Let us know what you think about this problem! Was it too hard? Difficult to understand? Also feel free to discuss the problem, ask questions, and post cool stuff on Discourse. You should be able see a discussion thread below. Would be nice if you don't post solutions in there but if you do then please organize and document your code well so others can learn from it.