Quick Start

It’s easy as 1 - 2 - 3!

1 - import package

The standard is to abbreviate ahlive as ah.

[1]:
import ahlive as ah

2 - load data

Here, CO2 concentrations data is fetched from “Our World in Data” (and subset to jump every 4 years up until 1958 for the sake of the tutorial).

[2]:
df = ah.open_dataset(
    "owid_co2_concentrations_over_the_long_term_scripps",
    names=["entity", "year", "co2"], index_col="year", verbose=True
)
df = df.loc[list(range(1, 1958, 4)) + list(range(1958, max(df.index)))]
display(df)
CO2 CONCENTRATIONS OVER THE LONG-TERM - SCRIPPS

Source: Macfarling Meure, C. et al., 2006: Law Dome CO2, CH4 and N2O ice core records extended to 2000 years BP. Geophysical Research Letters, 33. curated by Our World in Data (OWID)
http://scrippsco2.ucsd.edu/data/atmospheric_co2/icecore_merged_products through https://github.com/owid/owid-datasets

Description: Spline of the atmospheric CO2 record based on ice core data before 1958 is sourced from (Ethridge et. al., 1996; MacFarling Meure et al., 2006) based on ice-core records and yearly averages of direct observations from Mauna Loa and the South Pole are used after 1958.

Additional source:
C. D. Keeling, S. C. Piper, R. B. Bacastow, M. Wahlen, T. P. Whorf, M. Heimann, and H. A. Meijer, Exchanges of atmospheric CO2 and 13CO2 with the terrestrial biosphere and oceans from 1978 to 2000. I. Global aspects, SIO Reference Series, No. 01-06, Scripps Institution of Oceanography, San Diego, 88 pages, 2001.

Data: https://raw.githubusercontent.com/owid/owid-datasets/master//datasets/CO2%20concentrations%20over%20the%20long-term%20-%20Scripps/CO2%20concentrations%20over%20the%20long-term%20-%20Scripps.csv

entity co2
year
1 World 276.064
5 World 276.276
9 World 276.531
13 World 276.808
17 World 277.086
... ... ...
2013 World 393.553
2014 World 395.857
2015 World 398.205
2016 World 400.585
2017 World 402.982

550 rows × 2 columns

3 - generate animation

Simply input the dataframe, df and map the dataframe’s column names to the plot’s axes, xs and ys.

[3]:
ah.DataFrame(
    df,
    xs="year",
    ys="co2",
).render()
[3]: