Package 'qualR'

Title: An R package to download São Paulo and Rio de Janeiro air pollution data
Description: A package to download information from CETESB QUALAR <https://cetesb.sp.gov.br/ar/qualar/> and MonitorAr <http://jeap.rio.rj.gov.br/je-metinfosmac/institucional/index.html> systems. It contains function to download different parameters, a set of criteria pollutants and the most frequent meteorological parameters used in air quality data analysis and air quality model evaluation.
Authors: Mario Gavidia-Calderón [aut, cre] , Maria de Fatima Andrade [ctb, ths] , Daniel Schuch [aut, ctb] , Beatriz Milz [rev] (Beatriz reviewed the package (v. 0.9.6) for rOpenSci), Kaue de Sousa [rev] (Kaue reviewed the package (v. 0.9.6) for rOpenSci)
Maintainer: Mario Gavidia-Calderón <[email protected]>
License: MIT + file LICENSE
Version: 0.9.7
Built: 2024-12-19 21:20:55 UTC
Source: https://github.com/ropensci/qualR

Help Index


CETESB AQS station latitude and longitude

Description

List of CETESB QUALAR air quality stations (AQS) latitudes and longitudes. Use this to check the AQS aqs_code argument in CetesbRetrieveParam() function. AQS names are without diacritics.

Usage

cetesb_aqs

Format

A data frame with 74 observations and 5 variables:

name

CETESB AQS name.

code

CETESB AQS code in QUALAR System.

lat

CETESB AQS latitude.

lon

CETESB AQS longitude.

loc

CETESB AQS location.

Examples

cetesb_aqs

CETESB Parameters

Description

List of CETESB QUALAR available parameters and units. Use this to check the parameters argument. Parameter names are without diacritics.

Usage

cetesb_param

Format

A data frame with 20 observations and 3 variables:

name

CETESB QUALAR parameter abbreviation and name.

units

Parameter units.

code

Parameter CETESB QUALAR code.

Examples

cetesb_param

Download meteorological parameters from CETESB QUALAR

Description

This function download the main meteorological parameters for model evaluation from one air quality station (AQS) of CETESB AQS network. It will pad out the date with missing data with NA. This function requires to have an account in CETESB QUALAR.

Usage

cetesb_retrieve_met(
  username,
  password,
  aqs_code,
  start_date,
  end_date,
  verbose = TRUE,
  to_csv = FALSE,
  csv_path = ""
)

Arguments

username

User name of CETESB QUALAR

password

User name's password of CETESB QUALAR

aqs_code

Code of AQS

start_date

Date to start downloading in dd/mm/yyyy

end_date

Date to end downloading in dd/mm/yyyy

verbose

Print query summary

to_csv

Creates a csv file. FALSE by default

csv_path

Path to save the csv file.

Value

data.frame with Temperature (C), Relative Humidity (%), Wind Speed (m/s) and Direction (degrees), and Pressure information.

Examples

## Not run: 
# Downloading meteorological data from Pinheiros AQS
# from January first to 7th of 2020
my_user_name <- "John Doe"
my_pass_word <- "drowssap"
pin_code <- 99 # Check with cetesb_aqs
start_date <- "01/01/2020"
end_date <- "07/01/2020"

pin_pol <- cetesb_retrieve_met(my_user_name, my_pass_word, pin_code,
                               start_date, end_date)

## End(Not run)

Download meteorological and pollutant data from CETESB QUALAR

Description

This function download the main meteorological parameters for model evaluation, together with criteria pollutants for one air quality station (AQS). It will pad out the date with missing data with NA. This function required to have an account in CETESB QUALAR.

Usage

cetesb_retrieve_met_pol(
  username,
  password,
  aqs_code,
  start_date,
  end_date,
  verbose = TRUE,
  to_csv = FALSE,
  csv_path = ""
)

Arguments

username

User name of CETESB QUALAR

password

User name's password of CETESB QUALAR

aqs_code

Code of AQS

start_date

Date to start downloading in dd/mm/yyyy

end_date

Date to end downloading in dd/mm/yyyy

verbose

Print query summary

to_csv

Creates a csv file. FALSE by default

csv_path

Path to save the csv file.

Value

data.frame with Temperature (C), Relative Humidity (%), Wind Speed (m/s) and Direction (degrees), Pressure information (hPa), O3, NO, NO2, NOx, PM2.5, PM10 and CO information.

Examples

## Not run: 
# Downloading main meteorological parameters and criteria pollutants
# from Pinheiros AQS from January first to 7th of 2020
my_user_name <- "John Doe"
my_pass_word <- "drowssap"
pin_code <- 99 # Check with cetesb_aqs
start_date <- "01/01/2020"
end_date <- "07/01/2020"

pin_all <- cetesb_retrieve_met_pol(my_user_name, my_pass_word, pin_code,
                                   start_date, end_date)


## End(Not run)

Download list of observation from CETESB QUALAR

Description

This function downloads the parameters in a vector. These parameters can be both pollutants or meteorological observations for one air quality station (AQS). It will pad out the date with missing data with NA. This function requires to have an account in CETESB QUALAR.

Usage

cetesb_retrieve_param(
  username,
  password,
  parameters,
  aqs_code,
  start_date,
  end_date,
  verbose = TRUE,
  to_csv = FALSE,
  csv_path = ""
)

Arguments

username

User name of CETESB QUALAR

password

User name's password of CETESB QUALAR

parameters

a character vector with the parameters abbreviations to download

aqs_code

Code of AQS

start_date

Date to start downloading in dd/mm/yyyy

end_date

Date to end downloading in dd/mm/yyyy

verbose

Print query summary

to_csv

Creates a csv file. FALSE by default

csv_path

Path to save the csv file

Value

data.frame with parameters described in params vector

Examples

## Not run: 
# Download ozone, nitrogen dioxide, and wind speed
# from Pinheiros AQS, from January first to 7th of 2020

my_user_name <- "John Doe"
my_pass_word <- "drowssap"
pin_code <- 99 # Check with cetesb_aqs
start_date <- "01/01/2020"
end_date <- "07/01/2020"
params <- c("o3","NOX", "VV")

pin_param <- cetesb_retrieve_param(my_user_name, my_pass_word,
                                   params, pin_code,
                                   start_date, end_date)

## End(Not run)

Download criteria pollutants from CETESB QUALAR

Description

This function download the criteria pollutants from one air quality station (AQS) of CETESB AQS network. It will pad out the date with missing data with NA. This function required to have an account in CETESB QUALAR.

Usage

cetesb_retrieve_pol(
  username,
  password,
  aqs_code,
  start_date,
  end_date,
  verbose = TRUE,
  to_csv = FALSE,
  csv_path = ""
)

Arguments

username

User name of CETESB QUALAR

password

User name's password of CETESB QUALAR

aqs_code

Code of AQS

start_date

Date to start downloading in dd/mm/yyyy

end_date

Date to end downloading in dd/mm/yyyy

verbose

Print query summary

to_csv

Creates a csv file. FALSE by default

csv_path

Path to save the csv file

Value

data.frame with O3, NO, NO2, PM2.5, PM10 and CO information. Units are ug/m3 except for CO which is in ppm, and NOx which is in ppb.

Examples

## Not run: 
# Downloading criteria pollutants from Pinheiros AQS
# from January first to 7th of 2020
my_user_name <- "John Doe"
my_pass_word <- "drowssap"
pin_code <- 99 # Check with cetesb_aqs
start_date <- "01/01/2020"
end_date <- "07/01/2020"

pin_pol <- cetesb_retrieve_pol(my_user_name, my_pass_word, pin_code,
                               start_date, end_date)


## End(Not run)

Monitor Ar AQS stations.

Description

List of Monitor Ar Rio air quality stations (AQS) with their codes and locations. Use this to check the parameters argument in MonitorArRetrieveParam() function.

Usage

monitor_ar_aqs

Format

A data frame with 8 observation and 6 variables:

name

MonitorAr Program AQS name.

code

MonitorAr Program AQS abbreviation.

lon

MonitorAr Program AQS longitude.

lat

MonitorAr Program AQS latitude.

x_utm_sirgas2000

MonitorAr Program AQS longitude in SIRGAS 2000 (EPSG:31983).

y_utm_sirgas2000

MonitorAr Program AQS latitude in SIRGAS 2000 (EPSG:31983).

Examples

monitor_ar_aqs

Monitor Ar Parameters

Description

List of Monitor Ar Rio available parameters. Use this to check the parameters argument in MonitorArRetrieveParam() function. Parameter names are without diacritics.

Usage

monitor_ar_param

Format

A data frame with 18 observations and 3 variables:

code

MonitorAr parameter abbreviation or code.

name

MonitorAr parameter name

units

Parameter units.

Examples

monitor_ar_param

Download meteorological parameters from Monitor Ar program

Description

This function download the main meteorological parameters from one air quality station (AQS) of Monitor Ar network. It will pad out the date with missing data with NA.

Usage

monitor_ar_retrieve_met(
  start_date,
  end_date,
  aqs_code,
  verbose = TRUE,
  to_local = TRUE,
  to_csv = FALSE,
  csv_path = ""
)

Arguments

start_date

Date to start downloading in dd/mm/yyyy.

end_date

Date to end downloading in dd/mm/yyyy.

aqs_code

Code of AQS. See monitor_ar_aqs.

verbose

Print query summary.

to_local

Date information in local time. TRUE by default.

to_csv

Create a csv file. FALSE by default.

csv_path

Path to save the csv file.

Value

data.frame with Temperature (c), Relative Humidity (%), Wind speed (m/s) and direction (degrees) and Pressure information.

Examples

## Not run: 
# Downloading meteorological data from CENTRO AQS
# from January first to 7th of 2020
start_date <- "01/01/2020"
end_date <- "07/01/2020"
ca_met <- monitor_ar_retrieve_met(start_date, end_date, "CA")

## End(Not run)

Download meteorological and pollutant data from Monitor Ar Program

Description

This function download the main meteorological parameters for model evaluation, together with criteria pollutants for in air quality station (AQS) of Monitor Ar program. It will pad out the date with missing data with NA

Usage

monitor_ar_retrieve_met_pol(
  start_date,
  end_date,
  aqs_code,
  verbose = TRUE,
  to_local = TRUE,
  to_csv = FALSE,
  csv_path = ""
)

Arguments

start_date

Date to start downloading dd/mm/yyyy

end_date

Date to end downloading dd/mm/yyyy

aqs_code

Code of AQS

verbose

Print query summary

to_local

Date information in local time. TRUE by default.

to_csv

Creates a csv file. FALSE by default.

csv_path

Path to save the csv file.

Value

data.frame with Temperature (C), Relative Humidity (%), Wind Speed (m/s) and Direction (degrees), Pressure information (hPa), O3, NO, NO2, NOx, PM2.5, PM10 and CO information.

Examples

## Not run: 
# Downloading main meteorological parameters and criteria pollutant
# from CENTRO AQS from January first to 7th of 2020
start_date <- "01/01/2020"
end_date <- "07/01/2020"
ca_all <- monitor_ar_retrieve_met_pol(start_date, end_date, "CA")

## End(Not run)

Download air quality and meteorology information from MonitorAr-Rio

Description

This function download air quality and meteorology measurements from MonitorAr-Rio program from Rio de Janeiro city.

Usage

monitor_ar_retrieve_param(
  start_date,
  end_date,
  aqs_code,
  parameters,
  to_local = TRUE,
  verbose = TRUE,
  to_csv = FALSE,
  csv_path = ""
)

Arguments

start_date

Date to start downloading in dd/mm/yyyy

end_date

Date to end downloading in dd/mm/yyyy

aqs_code

AQS code

parameters

Parameters to download. It can be a vector with many parameters.

to_local

Date information in local time. TRUE by default.

verbose

Print query summary.

to_csv

Creates a csv file. FALSE by default

csv_path

Path to save the csv file.

Value

data.frame with the selected parameter information

Examples

## Not run: 
# Downloading Ozone information from Centro AQS
# from February of 2019
date_start <- "01/02/2019"
date_end <- "01/03/2019"
aqs_code <- "CA"
param <- "O3"
ca_o3 <- monitor_ar_retrieve_param(date_start, date_end, aqs_code, param)


## End(Not run)

Download criteria pollutants from Monitor Ar program

Description

This function download the criteria pollutants from one air quality station (AQS) of Monitor Ar Program. It will pad out the date with missing data with NA.

Usage

monitor_ar_retrieve_pol(
  start_date,
  end_date,
  aqs_code,
  verbose = TRUE,
  to_local = TRUE,
  to_csv = FALSE,
  csv_path = ""
)

Arguments

start_date

Date to start downloading in dd/mm/yyyy.

end_date

Date to end downloading in dd/mm/yyyy.

aqs_code

Code of AQS.

verbose

Print query summary.

to_local

Date information in local time. TRUE by default.

to_csv

Creates a csv file. FALSE by default.

csv_path

Path to save the csv file.

Value

data.frame with O3, NO, NO2, NOx, PM2.5, PM10 and CO information.

Examples

## Not run: 
# Downloading criteria pollutants from CENTRO AQS
# from January first to 7th of 2020
start_date <- "01/01/2020"
end_date <- "07/01/2020"
ca_pol <- monitor_ar_retrieve_pol(start_date, end_date, "CA")

## End(Not run)

qualR: An R package to download Sao Paulo and Rio de Janeiro air pollution data

Description

A package to download information from CETESB QUALAR https://cetesb.sp.gov.br/ar/qualar/ and MonitorAr http://jeap.rio.rj.gov.br/je-metinfosmac/institucional/index.html systems. It contains function to download different parameters, a set of criteria pollutants and the most frequent meteorological parameters used in air quality data analysis and air quality model evaluation.

Author(s)

Mario Gavidia-Calderon and Daniel Schuch and Maria de Fatima Andrade

See Also

Useful links: