Skip to main content

Python interface to RSIG Web API

Project description

pyrsig

Docs Tests pypi

pyrsig is a Python interface to the RSIG Web API. RSIG connects you to petabytes of air quality data from EPA, NASA, NOAA, and many other partners. pyrsig connects RSIG to xarray, pandas, and all your favorite python libraries.

Install

There are two easy ways to isntall pyrsig easily.

From pypi.org (most stable):

pip install pyrsig

From github (latest):

pip install git+https://github.com/barronh/pyrsig.git

User Guide

Many examples, tutorials, and guides are available at https://barronh.github.io/pyrsig. Only a few very basic examples are shown below.

Example

Get DataFrame for AQS ozone

import pyrsig

rsigapi = pyrsig.RsigApi(bdate='2022-03-01')
print([k for k in rsigapi.keys() if 'ozone' in k])
# ['airnow.ozone', 'airnow2.ozone', 'aqs.ozone', 'aqs.ozone_8hour_average', 'aqs.ozone_daily_8hour_maximum', 'pandora.ozone']
df = rsigapi.to_dataframe('aqs.ozone')
print(df.shape, *df.columns)
# (26760, 6) Timestamp(UTC) LONGITUDE(deg) LATITUDE(deg) STATION(-) ozone(ppb) SITE_NAME

Get DataFrame for PurpleAir PM25

import pyrsig

rsigapi = pyrsig.RsigApi(bdate='2022-03-01')
rsigapi.purpleair_kw['api_key'] = '<put your api key here>'
df = rsigapi.to_dataframe('purpleair.pm25_corrected')

Get DataFrame for TropOMI NO2

import pyrsig

rsigapi = pyrsig.RsigApi(bdate='2022-03-01')
df = rsigapi.to_dataframe('tropomi.offl.no2.nitrogendioxide_tropospheric_column')
print(df.shape, *df.columns)
# (303444, 4) Timestamp(UTC) LONGITUDE(deg) LATITUDE(deg) nitrogendioxide_tropospheric_column(molecules/cm2)

Get IOAPI formatted NetCDF TropOMI NO2

import pyrsig

rsigapi = pyrsig.RsigApi(bdate='2022-03-01')
ds = rsigapi.to_ioapi('tropomi.offl.no2.nitrogendioxide_tropospheric_column')
print(ds.data_vars)
# Data variables:
#     TFLAG      (TSTEP, VAR, DATE-TIME) int32 ...
#     LONGITUDE  (TSTEP, LAY, ROW, COL) float32 ...
#     LATITUDE   (TSTEP, LAY, ROW, COL) float32 ...
#     COUNT      (TSTEP, LAY, ROW, COL) int32 ...
#     NO2        (TSTEP, LAY, ROW, COL) float32 ...

Get List of Possible

import pyrsig

rsigapi = pyrsig.RsigApi()
keys = rsigapi.keys()
print(len(keys), keys)
# 80 ('airnow.pm25', ... 'aqs.ozone', ... 'cmaq.equates.conus.aconc.O3', ... 'hms.smoke',
#     'metar.wind', ... 'pandora.ozone', 'purpleair.pm25_corrected', ...
#     'tropomi.offl.no2.nitrogendioxide_tropospheric_column', ...
#     'viirsnoaa.jrraod.AOD550', ...)
keys = rsigapi.keys(offline=False) # slow and likely to many options
print(len(keys))
# 3875

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

pyrsig-0.12.0.tar.gz (192.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrsig-0.12.0-py3-none-any.whl (197.5 kB view details)

Uploaded Python 3

File details

Details for the file pyrsig-0.12.0.tar.gz.

File metadata

  • Download URL: pyrsig-0.12.0.tar.gz
  • Upload date:
  • Size: 192.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyrsig-0.12.0.tar.gz
Algorithm Hash digest
SHA256 e50550a29e44542e7210fa17243cb149af22df0f1da8ee745dc0676c14c05d33
MD5 90b53dee856406d3e930eecc4c8fc0c5
BLAKE2b-256 7292b620ea90e691c9c75f6ddc2b4b35314493c31287d3a848ead5033c362162

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrsig-0.12.0.tar.gz:

Publisher: python-publish.yml on barronh/pyrsig

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyrsig-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: pyrsig-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 197.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyrsig-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b4320432bbf0530b2f59de9f91afab5b03630c497b3a60501e1f70972fc6eca
MD5 2806407691658d2e3b204ab930cad478
BLAKE2b-256 9186c568028fea021984bbf2f29addd19b03576d0d6fbfdbcc36c8436607c4c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrsig-0.12.0-py3-none-any.whl:

Publisher: python-publish.yml on barronh/pyrsig

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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