Air Quality Data from Indian Monitoring Networks and Satellites

Downloads and examines air quality data from three sources. The Central Pollution Control Board (CPCB) of India operates more than 600 monitoring stations. Open Air Quality (OAQ) < https://oaq.notf.in> collects data from low-cost sensor networks in India. The Atmospheric Composition Analysis Group at Washington University in St. Louis gives satellite estimates of fine particulate matter (PM2.5) for all areas of the Earth < https://www.satpm.org>. The package calculates the CPCB National Air Quality Index and the mean PM2.5 in an area.


vayuayan vayuayan logo

R-CMD-check License: MIT

vayuayan is an R package. It downloads and processes air quality data from three sources: CPCB CAAQMS monitoring stations in India, OAQ low-cost sensor networks in India, and WUSTL ACAG satellite PM2.5 estimates for the whole globe. The package gives an easy R interface to get daily AQI, PM2.5 and other pollutants for a city, a station, a point or a region. The name means "the path of wind" (वायु, wind + अयन, path).

Installation

# Install from GitHub
# install.packages("devtools")
devtools::install_github("saketlab/vayuayan", subdir = "R")

Quick Start

CPCB monitoring stations

library(vayuayan)

# Find the stations in a city
stations <- cpcb_get_station_list("Mumbai")

# Daily AQI for two cities in 2022, one row per city and day
daily <- cpcb_city_daily(c("Delhi", "Mumbai"), 2022)
aggregate(value ~ city + month, daily, mean)

# Daily data for single stations
station_daily <- cpcb_station_daily(c("Anand Vihar, Delhi", "ITO, Delhi"), 2024)

Live AQI

# The 5 live stations nearest to central Delhi
cpcb_get_nearest_stations(c(28.6139, 77.2090), k = 5)

Satellite PM2.5

# Monthly PM2.5 at a point. region = "AS" downloads the smaller Asia file.
pm25_get_point(latitude = 28.61, longitude = 77.21, year = 2023, month = 11, region = "AS")

# Monthly mean PM2.5 over Delhi
delhi <- india_boundary(state = "Delhi")
pm25_monthly(delhi, 2022, region = "AS")

OAQ low-cost sensors

# Get your API key from OAQ and set it in ~/.Renviron as OAQ_API_KEY
session <- oaq_session()
oaq_list_providers(session)
sensors <- oaq_stations_table(session, "airnet")

Use cases

Seasonal pattern of a city

library(dplyr)
library(ggplot2)

cpcb_city_daily("Delhi", 2022) %>%
  group_by(month) %>%
  summarise(mean_aqi = mean(value, na.rm = TRUE)) %>%
  ggplot(aes(month, mean_aqi)) +
  geom_line(colour = "#d77027") +
  scale_x_continuous(breaks = 1:12, labels = month.abb) +
  labs(title = "Delhi 2022: monthly mean AQI", x = NULL, y = "AQI")

Satellite PM2.5 by state

# Mean PM2.5 for each state in a district GeoJSON
pm25_get_stats(
  geojson_file = "india_districts.geojson",
  year = 2023,
  month = 11,
  region = "AS",
  group_by = "state_name"
)

Documentation

  • Introduction: vignette("introduction", package = "vayuayan")
  • Articles: analyses of Delhi, five metros, and CPCB against Airnet sensors in Bengaluru
  • Function Reference

Contributing

We accept contributions. To send a change, open a Pull Request.

Disclaimer

This package is not affiliated with CPCB, OAQ or WUSTL. It is a third-party tool for publicly available data.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("vayuayan")

0.3.0 by Saket Choudhary, 17 hours ago


https://vayuayan.saketlab.org/R/, https://github.com/saketlab/vayuayan


Report a bug at https://github.com/saketlab/vayuayan/issues


Browse source code at https://github.com/cran/vayuayan


Authors: Saket Choudhary [aut, cre, cph] , Mahesh Kumar Prajapat [aut] , Darakhshan Nehal [ctb]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports cli, dplyr, httr, jsonlite, readxl, sf, stats, terra, tools, utils

Suggests ggplot2, knitr, ncdf4, patchwork, rmarkdown, scales, testthat, tidyterra


See at CRAN