Python interface to RSIG Web API
From pypi.org (most stable):
pip install pyrsig
From github (latest):
pip install git+https://github.com/barronh/pyrsig.git
Examples and more information are available at https://barronh.github.io/pyrsig
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
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')
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)
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 ...
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