weltby Ergodic Sign inGet started
All use cases

How Much CO2 Will Mauna Loa Measure Next Year?

Given every weekly reading since the 1970s, what will the CO2 level at Mauna Loa be over the next 52 weeks? The record climbs every year and rises and falls with the seasons, a good test of any forecast.

Use caseClimateForecastingPrediction

The table

Weekly average atmospheric CO2 measured at the Mauna Loa Observatory in Hawaii. It's in Welt's research catalogue as Mauna Loa Weekly Atmospheric CO2 Averages, 2,225 rows by 7 columns, licensed CC0. The catalogue measures its signal at 0.57, in time order. Chronos-2 forecasts the series in one request and needs no training.

Walkthrough

  1. Load it from the catalogue

    Find the table, read its recorded target and print the column names.

    import pandas as pd
    from welt import Client, Forecast
    
    with Client() as client:
        item = client.research_datasets(q="Mauna Loa weekly CO2", limit=1)["items"][0]
        info = client.research_dataset(item["id"])
        data = client.load_research_dataset(item["id"])
    
    target = info["targets"][0]
    target = target["name"] if isinstance(target, dict) else target
    print([column["name"] for column in info["schema"]], target)
  2. Pick the history

    Keep the time column and the target.

    time = "date"
    history = data[[time, target]].dropna()
    history[time] = pd.to_datetime(history[time])
    history = history.sort_values(time)
  3. Forecast with a range

    Ask for the next 52 steps, one per week. The median is the forecast, and the 10% and 90% columns give a low and a high case.

    model = Forecast(model="chronos-2").fit(history, time=time, target=[target])
    result = model.forecast(52, quantile_levels=[0.1, 0.5, 0.9])
    print(result.to_frame()[["timestamp", "median", "q_0.1", "q_0.9"]].head(52))

What you get

A year aheadWeekly CO2 with a range around each week.
The seasons keptThe forecast follows the yearly rise and fall.
One series, no set-upChronos-2 reads the history as it is.

Try it

Use Open with to run the research datasets notebook in Colab, Kaggle or Jupyter and search for "Mauna Loa weekly CO2", or run the code above after pip install "welt-client[parquet]".