Title: | Download Data from Mexico's Air Quality Information System |
---|---|
Description: | Easy-to-use functions for downloading air quality data from the Mexican National Air Quality Information System (SINAICA). Allows you to query pollution and meteorological parameters from more than a hundred monitoring stations located throughout Mexico. See <https://sinaica.inecc.gob.mx> for more information. |
Authors: | Diego Valle-Jones [aut, cre] |
Maintainer: | Diego Valle-Jones <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.1.0 |
Built: | 2024-11-16 02:48:13 UTC |
Source: | https://github.com/diegovalle/rsinaica |
Valid air quality parameters
A data frame with 55 rows and 2 variables:
Abbreviation of the air quality parameter
Name of the air quality parameter
head(params_sinaica)
head(params_sinaica)
Download data from a single station by specifying a parameter and a date range
sinaica_station_data( station_id, parameter, start_date, end_date, type = "Crude", remove_extremes = FALSE )
sinaica_station_data( station_id, parameter, start_date, end_date, type = "Crude", remove_extremes = FALSE )
station_id |
the numeric code corresponding to each station. See
|
parameter |
type of parameter to download
|
start_date |
start of range in YYYY-MM-DD format |
end_date |
end of range from which to download data in YYYY-MM-DD format |
type |
The type of data to download. One of the following:
|
remove_extremes |
whether to remove extreme values. For O3 all values above .2 are set to NA, for PM10 those above 600, for PM2.5 above 175, for NO2 above .21, for SO2 above .2, and for CO above 15. This is done so that the values match exactly those of the SINAICA website, but it is recommended that you use a more complicated statistical procedure to remove outliers. |
data.frame with air quality data. Care should be taken when working with hourly data since
each station has their own timezone (available in the stations_sinaica
data.frame)
and some stations reported the timezome in which they are located erroneously.
Crude data comes from https://sinaica.inecc.gob.mx/data.php, validated data from https://sinaica.inecc.gob.mx/data.php?tipo=V, and manual data from https://sinaica.inecc.gob.mx/data.php?tipo=M
stations_sinaica[which(stations_sinaica$station_name == "Xalostoc"), 1:5] df <- sinaica_station_data(271, "O3", "2015-09-11", "2015-09-11", "Crude") head(df)
stations_sinaica[which(stations_sinaica$station_name == "Xalostoc"), 1:5] df <- sinaica_station_data(271, "O3", "2015-09-11", "2015-09-11", "Crude") head(df)
Start date and end date of the range for which SINAICA has data for an air quality station
sinaica_station_dates(station_id, type = "Crude")
sinaica_station_dates(station_id, type = "Crude")
station_id |
the numeric code corresponding to each station. See
|
type |
The type of data to download. One of the following:
|
a vector containing the date the station started reporting and end reporting date
## id 271 is Xalostoc. See `stations_sinaica` df <- sinaica_station_dates(271, "Manual") head(df)
## id 271 is Xalostoc. See `stations_sinaica` df <- sinaica_station_dates(271, "Manual") head(df)
List of air quality parameters of a measuring station for which SINAICA has data
sinaica_station_params(station_id, type = "Crude")
sinaica_station_params(station_id, type = "Crude")
station_id |
the numeric code corresponding to each station. See
|
type |
The type of data to download. One of the following:
|
a data.frame with the parameters supported by the station
## id 271 is Xalostoc. See `stations_sinaica` df <- sinaica_station_params(271, "Crude") head(df)
## id 271 is Xalostoc. See `stations_sinaica` df <- sinaica_station_params(271, "Crude") head(df)
This data set contains all the stations that report to the National Air Quality Information System SINAICA.
data(stations_sinaica)
data(stations_sinaica)
A data frame with 341 rows and 26 variables:
Numeric code of the station
Name of the station
Abbreviation of the station
Numeric code for the network
Name of the network
Abbreviation of the network
street
exterior number
interior number
colonia
zip code
state code
municipio code
date the station started operations
altitude in meters
address
last date the station was validated
second to last date the station was validated
did the station pass validation
link to video of the station
latitude
longitude
date the station started operations
time zone in which the station is located (may contain errors)
link to Google Street View
link to video of the interior of the station
SINAICA ans Solicitud de Información 1612100005118
head(stations_sinaica)
head(stations_sinaica)