Skip to content

Commit

Permalink
test 2
Browse files Browse the repository at this point in the history
Merge branch 'master' of https://github.com/ropensci/qualR

# Conflicts:
#	DESCRIPTION
  • Loading branch information
Schuch666 committed Dec 19, 2024
2 parents 94b643d + 9514131 commit 01748cd
Show file tree
Hide file tree
Showing 15 changed files with 315 additions and 131 deletions.
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' Use this to check the AQS \code{aqs_code} argument in CetesbRetrieveParam()
#' function. AQS names are without diacritics.
#'
#' @format A data frame with 70 observations and 5 variables:
#' @format A data frame with 74 observations and 5 variables:
#' \describe{
#' \item{name}{CETESB AQS name.}
#' \item{code}{CETESB AQS code in QUALAR System.}
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,8 @@ This information is often used for air pollution data analysis and for air quali

## Installation

First, you need to install `devtools`:
```R
install.packages("devtools")
```

Then, you can install `qualR` by:

```R
devtools::install_github("ropensci/qualR")
```
You can install it directly using:

Or, you can install it directly using:
```R
install.packages('qualR', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'))
```
Expand Down
40 changes: 14 additions & 26 deletions data-raw/cetesb.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
## code to prepare internal datasets goes here

cetesb <- read.table("~/R_tests/QualR/qualR/cetesb_qualR.dat", sep = ",",
header = FALSE, col.names = c("code", "name"),
stringsAsFactors = FALSE)
cetesb$ascii <- iconv(cetesb$name, from = "UTF-8", to = "ASCII//TRANSLIT")
params <- read.table("~/R_tests/cetesb_variables.dat", header = FALSE,
cetesb <- read.table("data-raw/cetesb_qualR.dat", sep = ",",
header = TRUE, col.names = c("code", "name"))
cetesb$ascii <- stri_trans_general(cetesb$name, "ASCII")

cetesb$ascii <- gsub("^", "", cetesb$ascii)
cetesb$ascii <- gsub("~", "", cetesb$ascii)
cetesb$ascii <- gsub("'", "", cetesb$ascii)

params <- read.table("data-raw/cetesb_variables.dat", header = TRUE,
sep = ",", col.names = c("code", "name"),
stringsAsFactors = FALSE)

Expand All @@ -18,28 +22,12 @@ params_code <- data.frame(
)

# Monitor Ar data
param_code <- c("SO2", "NO2", "NO", "NOx", "HCNM", "HCT",
"CH4", "CO", "O3", "PM10", "PM2_5",
"Chuva", "Pres", "RS", "Temp", "UR",
"Dir_Vento", "Vel_Vento")
param_name <- c("Dioxido de enxofre", "Dioxido de nitrogenio", "Monoxido de Nitrogenio", "Oxidos de nitrogenio",
"Hidrocarbonetos Totais menos Metano", "Hidrocarbonetos Totais", "Metano", "Monoxido de Carbono",
"Ozonio", "Particulas Inalaveis", "Particulas Inalaveis Finas", "Precipitacao Pluviometrica",
"Pressao Atmosferica", "Radiacao Solar", "Temperatura", "Umidade Relativa do Ar",
"Direcao do Vento", "Velocidade do Vento")
param_units <- c("ug/m3", "ug/m3", "ug/m3", "ug/m3", "ppm", "ppm",
"ug/m3", "ppm", "ug/m3", "ug/m3", "ug/m3",
"mm", "mbar", "W/m2", "ºC", "%",
"º", "m/s")

param_monitor_ar <- data.frame(code = param_code,
name = param_name,
units = param_units)

aqs_monitor_ar <- read.table("~/Downloads/aqs_rio.csv", header = TRUE, stringsAsFactors = FALSE,
param_monitor_ar <- read.table("data-raw/monitor_ar_variables.dat",
header = TRUE, sep = ",",
stringsAsFactors = FALSE)

aqs_monitor_ar <- read.table("data-raw/monitor_ar_qualR.dat", header = TRUE, stringsAsFactors = FALSE,
sep = ",", dec=".")
aqs_monitor_ar <- aqs_monitor_ar[, c(4, 8, 1, 2, 12, 13)]
names(aqs_monitor_ar) <- c("name", "code", "lon", "lat", "X_UTM_Sirgas2000", "Y_UTM_Sirgas2000")
aqs_monitor_ar$name <- iconv(aqs_monitor_ar$name, from = "UTF-8", to = "ASCII//TRANSLIT")


Expand Down
21 changes: 13 additions & 8 deletions data-raw/cetesb_aqs.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## code to prepare `DATASET` dataset goes here

cetesb_aqs <- read.table("~/R_tests/cetesb2017_latlon.dat",
sep = ",", header = TRUE, dec = ".",
stringsAsFactors = F)
cetesb_aqs <- read.table("data-raw/cetesb_aqs.dat",
sep = ",", header = TRUE, dec = ".",
stringsAsFactors = F)

sao_paulo_city <- c(269, 91, 95, 73, 98, 83, 262,
266, 97, 270, 85, 96, 72, 284,
Expand All @@ -21,11 +21,16 @@ cetesb_aqs$loc[cetesb_aqs$code %in% litoral] <- "Coast"
cetesb_aqs$loc[cetesb_aqs$code %in% interior] <- "Interior"

missing_aqs <- data.frame(
name = c("Lapa", "Perus"),
code = c(84, 293),
lat = c(-23.50897, -23.41321),
lon = c(-46.70122, -46.75605),
loc = c("São Paulo", "São Paulo")
name = c("Lapa", "Perus", "Americana-Vila Sta Maria",
"Paulínia-Sta Terezinha", "Rio Claro-Jd.Guanabara",
"São Sebastião" ),
code = c(84, 293, 105, 291, 292, 294),
lat = c(-23.50897, -23.41321, -22.72425,
-22.78021, -22.43906, -23.8052),
lon = c(-46.70122, -46.75605, -41.33955,
-41.113904, -41.58144, -39.40007),
loc = c("São Paulo", "São Paulo", "Interior", "Interior",
"Interior", "Litoral")
)

cetesb_aqs <- rbind(cetesb_aqs, missing_aqs)
Expand Down
70 changes: 70 additions & 0 deletions data-raw/cetesb_aqs.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
"name","code","lat","lon","loc"
"Americana",290,-22.7242526995067,-47.3395492909725,"Interior"
"Araçatuba",107,-21.1868410998752,-50.4393168498844,"Interior"
"Araraquara",106,-21.7825221457448,-48.1858318132219,"Interior"
"Bauru",108,-22.326608396587,-49.092759305391,"Interior"
"Cambuci",90,-23.5677084050662,-46.6122728561358,NA
"Campinas-Centro",89,-22.9025248038637,-47.0572107427735,"Interior"
"Campinas-Taquaral",276,-22.8746189449543,-47.0589727566842,"Interior"
"Campinas-V.União",275,-22.9467284160848,-47.1192808618633,"Interior"
"Capão Redondo",269,-23.6683561456718,-46.7800433836767,"São Paulo"
"Carapicuíba",263,-23.5313950283077,-46.8357797276639,"MASP"
"Catanduva",248,-21.1419427576013,-48.9830752705603,"Interior"
"Centro",94,-23.5478061597037,-46.6424144996321,NA
"Cerqueira César",91,-23.5535425616777,-46.6727047692529,"São Paulo"
"Cid.Universitária-USP-Ipen",95,-23.5663417755292,-46.7374142819519,"São Paulo"
"Congonhas",73,-23.6163200788182,-46.6634655273702,"São Paulo"
"Cubatão-Centro",87,-23.8790267306876,-46.418483361896,"Coast"
"Cubatão-V.Parisi",66,-23.8494161699591,-46.3886762431427,"Coast"
"Cubatão-Vale do Mogi",119,-23.8315890081254,-46.3695687908739,"Coast"
"Diadema",92,-23.6858764117137,-46.6116219323751,"MASP"
"Grajaú-Parelheiros",98,-23.776265984399,-46.6969610783657,"São Paulo"
"Guaratinguetá",289,-22.8019171385919,-45.1911223603662,"Interior"
"Guarulhos",118,-23.4632093829649,-46.4962135994365,"MASP"
"Guarulhos-Paço Municipal",264,-23.4555342581023,-46.5185334030574,"MASP"
"Guarulhos-Pimentas",279,-23.4401170078091,-46.4099487710006,"MASP"
"Ibirapuera",83,-23.5918419901379,-46.6606875025418,"São Paulo"
"Interlagos",262,-23.6805076511499,-46.6750431583082,"São Paulo"
"Itaim Paulista",266,-23.5015473609702,-46.4207368394923,"São Paulo"
"Itaquera",97,-23.5800148313619,-46.4666514114578,"São Paulo"
"Jacareí",259,-23.2941992435412,-45.9682338642508,"Interior"
"Jaú",110,-22.2986196635248,-48.5674574048007,"Interior"
"Jundiaí",109,-23.192003743039,-46.8970972725384,"Interior"
"Limeira",281,-22.5636037767457,-47.4143140341751,"Interior"
"Marg.Tietê-Pte Remédios",270,-23.5187058310122,-46.7433200408467,"São Paulo"
"Marília",111,-22.1998094871228,-49.9599697461499,"Interior"
"Mauá",65,-23.6685489997822,-46.4660002742069,"MASP"
"Mogi das Cruzes",287,-23.518172230148,-46.1868605711067,NA
"Mooca",85,-23.5497340450694,-46.6004166453369,"São Paulo"
"N.Senhora do Ó",96,-23.4800987059504,-46.6920519221288,"São Paulo"
"Osasco",120,-23.5267214190038,-46.7920776611899,"MASP"
"Parque D.Pedro II",72,-23.5448456586808,-46.6276755923666,"São Paulo"
"Paulínia",117,-22.772321379337,-47.1548428657284,"Interior"
"Paulínia Sul",112,-22.7868064343791,-47.1365588816311,"Interior"
"Pico do Jaraguá",284,-23.4562688997476,-46.7660977590058,"São Paulo"
"Pinheiros",99,-23.5614598947311,-46.7020165084763,"São Paulo"
"Piracicaba",113,-22.7012223402754,-47.6496526898721,"Interior"
"Pirassununga-EM",268,-22.0077128811569,-47.4275644904649,NA
"Presidente Prudente",114,-22.1199367347659,-51.4087770680215,NA
"Ribeirão Preto",288,-21.1539418919679,-47.828480526621,"Interior"
"Ribeirão Preto-Ipiranga",115,-21.15394,-47.82848,"Interior"
"S.André Capuava",100,-23.6398036991568,-46.4916367657882,"MASP"
"S.André-Centro",101,-23.6456163828539,-46.5363346692648,"MASP"
"S.André-Paço Municipal",254,-23.6569941995448,-46.5309187564731,NA
"S.Bernardo-Centro",272,-23.6986710864522,-46.5462321867186,"MASP"
"S.Bernardo-Paulicéia",102,-23.6713539571073,-46.5846678858857,"MASP"
"S.José Campos",88,-23.1878873302518,-45.8711976230777,"Interior"
"S.José Campos-Jd.Satélite",277,-23.2236454817019,-45.8907999962971,"Interior"
"S.José Campos-Vista Verde",278,-23.1836973451392,-45.8308969846329,"Interior"
"S.Miguel Paulista",236,-23.4985264108007,-46.4448027795288,NA
"Santa Gertrudes",273,-22.4599552691691,-47.5362983394974,"Interior"
"Santana",63,-23.5059927222475,-46.6289602999862,"São Paulo"
"Santo Amaro",64,-23.6549772296114,-46.7099983817602,"São Paulo"
"Santos",258,-23.9630572042475,-46.3211700936539,"Coast"
"Santos-Ponta da Praia",260,-23.9812951573645,-46.3005095935412,"Coast"
"São Caetano do Sul",86,-23.6184427729695,-46.5563539375078,"MASP"
"São José Do Rio Preto",116,-20.7846892839301,-49.3982777928726,"Interior"
"Sorocaba",67,-23.5024265843066,-47.4790299116269,"Interior"
"Taboão da Serra",103,-23.6093238641752,-46.7582943678197,"MASP"
"Tatuí",256,-23.3607515378568,-47.8707990664729,"Interior"
"Taubaté",280,-23.0323509589424,-45.5758050249834,"Interior"
76 changes: 76 additions & 0 deletions data-raw/cetesb_qualR.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"code","name"
290,"Americana"
105,"Americana-Vila Sta Maria"
107,"Araçatuba"
106,"Araraquara"
108,"Bauru"
90,"Cambuci"
89,"Campinas-Centro"
276,"Campinas-Taquaral"
275,"Campinas-V.União"
269,"Capão Redondo"
263,"Carapicuíba"
248,"Catanduva"
94,"Centro"
91,"Cerqueira César"
95,"Cid.Universitária-USP-Ipen"
73,"Congonhas"
87,"Cubatão-Centro"
66,"Cubatão-V.Parisi"
119,"Cubatão-Vale do Mogi"
92,"Diadema"
98,"Grajaú-Parelheiros"
289,"Guaratinguetá"
118,"Guarulhos"
264,"Guarulhos-Paço Municipal"
279,"Guarulhos-Pimentas"
83,"Ibirapuera"
262,"Interlagos"
266,"Itaim Paulista"
97,"Itaquera"
259,"Jacareí"
110,"Jaú"
109,"Jundiaí"
84,"Lapa"
281,"Limeira"
270,"Marg.Tietê-Pte Remédios"
111,"Marília"
65,"Mauá"
287,"Mogi das Cruzes"
85,"Mooca"
96,"N.Senhora do Ó"
120,"Osasco"
72,"Parque D.Pedro II"
117,"Paulínia"
112,"Paulínia Sul"
291,"Paulínia-Sta Terezinha"
293,"Perus"
284,"Pico do Jaraguá"
99,"Pinheiros"
113,"Piracicaba"
268,"Pirassununga-EM"
114,"Presidente Prudente"
288,"Ribeirão Preto"
115,"Ribeirão Preto-Ipiranga"
292,"Rio Claro-Jd.Guanabara"
100,"S.André Capuava"
101,"S.André-Centro"
254,"S.André-Paço Municipal"
272,"S.Bernardo-Centro"
102,"S.Bernardo-Paulicéia"
88,"S.José Campos"
277,"S.José Campos-Jd.Satélite"
278,"S.José Campos-Vista Verde"
236,"S.Miguel Paulista"
273,"Santa Gertrudes"
63,"Santana"
64,"Santo Amaro"
258,"Santos"
260,"Santos-Ponta da Praia"
86,"São Caetano do Sul"
116,"São José Do Rio Preto"
294,"São Sebastião"
67,"Sorocaba"
103,"Taboão da Serra"
256,"Tatuí"
280,"Taubaté"
21 changes: 21 additions & 0 deletions data-raw/cetesb_variables.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"code","name"
61,"BEN (Benzeno)"
16,"CO (Monoxido de Carbono)"
23,"DV (Direcao do Vento)"
21,"DVG (Direcao do Vento Global)"
19,"ERT (Enxofre Reduzido Total)"
59,"HCNM (Hidrocarbonetos Totais menos Metano)"
12,"MP10 (Particulas Inalaveis)"
57,"MP2.5 (Particulas Inalaveis Finas)"
17,"NO (Monoxido de Nitrogenio)"
15,"NO2 (Dioxido de Nitrogenio)"
18,"NOx (Oxidos de Nitrogenio)"
63,"O3 (Ozonio)"
29,"PRESS (Pressao Atmosferica)"
26,"RADG (Radiacao Solar Global)"
56,"RADUV (Radiacao Ultra-violeta)"
13,"SO2 (Dioxido de Enxofre)"
25,"TEMP (Temperatura do Ar)"
62,"TOL (Tolueno)"
28,"UR (Umidade Relativa do Ar)"
24,"VV (Velocidade do Vento)"
9 changes: 9 additions & 0 deletions data-raw/monitor_ar_qualR.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"name","code","lon","lat","X_UTM_Sirgas2000","Y_UTM_Sirgas2000"
"ESTACAO PEDRA DE GUARATIBA","PG",-43.629010366464,-23.0043789751932,640505.9556,7455338.4492
"ESTACAO BANGU","BG",-43.47107415449,-22.887909592765,656828.8045,7468074.5684
"ESTACAO CAMPO GRANDE","CG",-43.5565219722468,-22.8862546758774,648064.4921,7468346.2624
"ESTACAO IRAJA","IR",-43.326844698961,-22.831620802504,671696.6238,7474146.6215
"ESTACAO COPACABANA","AV",-43.1804816536037,-22.9650037338809,686537.0128,7459198.4024
"ESTACAO TIJUCA","SP",-43.2326565174968,-22.9249153429029,681240.2399,7463702.987
"ESTACAO SAO CRISTOVAO","SC",-43.2217454099382,-22.8977710880779,682395.7505,7466695.3372
"ESTACAO CENTRO","CA",-43.178151756386,-22.9083442826264,686853.7075,7465469.7974
19 changes: 19 additions & 0 deletions data-raw/monitor_ar_variables.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"code","name","units"
"SO2","Dioxido de enxofre","ug/m3"
"NO2","Dioxido de nitrogenio","ug/m3"
"NO","Monoxido de Nitrogenio","ug/m3"
"NOx","Oxidos de nitrogenio","ug/m3"
"HCNM","Hidrocarbonetos Totais menos Metano","ppm"
"HCT","Hidrocarbonetos Totais","ppm"
"CH4","Metano","ug/m3"
"CO","Monoxido de Carbono","ppm"
"O3","Ozonio","ug/m3"
"PM10","Particulas Inalaveis","ug/m3"
"PM2_5","Particulas Inalaveis Finas","ug/m3"
"Chuva","Precipitacao Pluviometrica","mm"
"Pres","Pressao Atmosferica","mbar"
"RS","Radiacao Solar","W/m2"
"Temp","Temperatura","ºC"
"UR","Umidade Relativa do Ar","%"
"Dir_Vento","Direcao do Vento","º"
"Vel_Vento","Velocidade do Vento","m/s"
Binary file modified data/cetesb_aqs.rda
Binary file not shown.
30 changes: 15 additions & 15 deletions docs/articles/qualr.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ pkgdown: 2.0.6
pkgdown_sha: ~
articles:
qualr: qualr.html
last_built: 2023-07-25T12:20Z
last_built: 2024-08-08T01:55Z

Loading

0 comments on commit 01748cd

Please sign in to comment.