Skip to main content

Scrape CO2 data from Mauna Loa Observatory off of NOAA Earth Science Research Lab

Project description

Mauna Loa Observatory Carbon Dioxide Data Scraper

This Python package includes a script to scrape the NOAA Earth Science Research Lab for Carbon Dioxide (CO2) readings from the Mauna Loa Observatory in Hawai'i. You can access this data here: https://www.esrl.noaa.gov/gmd/ccgg/trends/mlo.html

Installation

pip install git+https://github.com/kylepollina/mlo_co2.git

Features

monthly_mean()

# Data from March 1958 through April 1974 have been obtained by C. David Keeling
# of the Scripps Institution of Oceanography (SIO) and were obtained from the
# Scripps website (scrippsco2.ucsd.edu).
# Monthly mean CO2 constructed from daily mean values
# Scripps data downloaded from http://scrippsco2.ucsd.edu/data/atmospheric_co2
# Monthly values are corrected to center of month based on average seasonal
# cycle. Missing days can be asymmetric which would produce a high or low bias.
# Missing months have been interpolated, for NOAA data indicated by negative stdev
# and uncertainty. We have no information for SIO data about Ndays, stdv, unc
# so that they are also indicated by negative numbers

Optional start date and end date parameters. Scraped from this url: https://www.esrl.noaa.gov/gmd/webdata/ccgg/trends/co2/co2_mm_mlo.txt

>>> from mlo_co2 import monthly_mean
>>> mean = monthly_mean(start=datetime(year=1985, day=1, month=1), end=datetime(year=2014, day=1, month=1))
>>> mean.keys()
dict_keys(['url', 'license', 'description', 'headers', 'raw', 'data'])
>>> mean['data'].keys()
dict_keys(['yr', 'mon', 'decimal', 'monthly average (ppm)', 'de-seasonalized (ppm)', '#days', 'st.dev of days', 'unc. of mon mean'])

annual_mean()

# Data from March 1958 through April 1974 have been obtained by C. David Keeling
# of the Scripps Institution of Oceanography (SIO) and were obtained from the
# Scripps website (scrippsco2.ucsd.edu).
#
# The estimated uncertainty in the annual mean is the standard deviation
# of the differences of annual mean values determined independently by
# NOAA/ESRL and the Scripps Institution of Oceanography.
#
# NOTE: In general, the data presented for the last year are subject to change,
# depending on recalibration of the reference gas mixtures used, and other quality
# control procedures. Occasionally, earlier years may also be changed for the same
# reasons.  Usually these changes are minor.
#
# CO2 expressed as a mole fraction in dry air, micromol/mol, abbreviated as ppm

Optional start date and end date parameters. Scraped from this url: https://www.esrl.noaa.gov/gmd/webdata/ccgg/trends/co2/co2_annmean_mlo.txt

>>> from mlo_co2 import annual_mean
>>> mean = annual_mean(start=datetime(year=1985, day=1, month=1), end=datetime(year=2014, day=1, month=1))
>>> mean.keys()
dict_keys(['url', 'license', 'description', 'headers', 'raw', 'data'])
>>> mean['data'].keys()
dict_keys(['yr', 'mean (ppm)', 'unc'])

annual_mean_increase()

# Data from March 1958 through April 1974 have been obtained by C. David Keeling
# of the Scripps Institution of Oceanography (SIO) and were obtained from the
# Scripps website (scrippsco2.ucsd.edu).
#
# Annual CO2 mole fraction increase (ppm) from Jan 1 through Dec 31.
#
# The uncertainty in the Mauna Loa annual mean growth rate is estimated
# from the standard deviation of the differences between monthly mean
# values determined independently by the Scripps Institution of Oceanography
# and by NOAA/ESRL.
#
# NOTE: In general, the data presented for the last year are subject to change,
# depending on recalibration of the reference gas mixtures used, and other quality
# control procedures. Occasionally, earlier years may also be changed for the same
# reasons.  Usually these changes are minor.
#
# CO2 expressed as a mole fraction in dry air, micromol/mol, abbreviated as ppm

Optional start date and end date parameters. Scraped from this url: https://www.esrl.noaa.gov/gmd/webdata/ccgg/trends/co2/co2_gr_mlo.txt

>>> from mlo_co2 import annual_mean_increase
>>> mean = annual_mean_increase()
>>> mean.keys()
dict_keys(['url', 'license', 'description', 'headers', 'raw', 'data'])
>>> mean['data'].keys()
dict_keys(['yr', 'ann inc', 'unc'])

weekly_mean()

# NOTE: DATA FOR THE LAST SEVERAL MONTHS ARE PRELIMINARY, ARE STILL SUBJECT
# TO QUALITY CONTROL PROCEDURES.
# NOTE: The week "1 yr ago" is exactly 365 days ago, and thus does not run from
# Sunday through Saturday. 365 also ignores the possibility of a leap year.
# The week "10 yr ago" is exactly 10*365 days +3 days (for leap years) ago.

Optional start date and end date parameters. Scraped from this url: https://www.esrl.noaa.gov/gmd/webdata/ccgg/trends/co2/co2_weekly_mlo.txt

>>> from mlo_co2 import weekly_mean
>>> mean = weekly_mean()
>>> mean.keys()
dict_keys(['url', 'license', 'description', 'headers', 'raw', 'data'])
>>> mean['data'].keys()
dict_keys(['yr', 'mon', 'day', 'decimal', 'ppm', '#days', '1 yr ago', '10 yr ago', 'since 1800'])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlo_co2-0.3.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

mlo_co2-0.3-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file mlo_co2-0.3.tar.gz.

File metadata

  • Download URL: mlo_co2-0.3.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for mlo_co2-0.3.tar.gz
Algorithm Hash digest
SHA256 7e97e6a5d62e3f217b580a8d916e25d0a9136197262694563a13d916896ede6d
MD5 39d1d20efb9c2367e020aa0243e457e6
BLAKE2b-256 e56b8e55772166068e76de87508d96d13593d0b8a3f32c9fd6bce23fc4408b78

See more details on using hashes here.

File details

Details for the file mlo_co2-0.3-py3-none-any.whl.

File metadata

  • Download URL: mlo_co2-0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for mlo_co2-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f01a26c373c0de5d22223127b0f5efb0883e47590e712ddd228860b60069e40e
MD5 ccfde4e2fcbc273da3609c527ade1fcf
BLAKE2b-256 22b4cfc32518436e9cd5bda730027a10665e8fa09712893b1c6e8d9835d4e1a2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page