diff --git a/DESCRIPTION b/DESCRIPTION index 11015038..3790cf60 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Type: Package Package: PWFSLSmoke -Version: 1.2.111 +Version: 1.2.112 Title: Utilities for Working with Air Quality Monitoring Data Authors@R: c( person("Jonathan", "Callahan", email="jonathan.s.callahan@gmail.com", role=c("aut","cre")), diff --git a/NEWS.md b/NEWS.md index 78f6b723..4da449b8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# PWFSLSmoke 1.2.112 + +* Updated support for parsing AIRSIS "ESAM Multi" format. + # PWFSLSmoke 1.2.111 CRAN manual review suggestions: diff --git a/R/airsis_ESAM_MULTIQualityControl.R b/R/airsis_ESAM_MULTIQualityControl.R index 2b088ff2..80cee586 100644 --- a/R/airsis_ESAM_MULTIQualityControl.R +++ b/R/airsis_ESAM_MULTIQualityControl.R @@ -38,7 +38,7 @@ airsis_ESAM_MULTIQualityControl <- function( valid_Flow = c(1.999, 2.001), # anything other than 2 is bad valid_AT = c(-Inf, 150), valid_RHi = c(-Inf, 55), - valid_Conc = c(-Inf, 5000), + valid_Conc = c(-Inf, 5), flagAndKeep = FALSE ) { @@ -48,7 +48,7 @@ airsis_ESAM_MULTIQualityControl <- function( # > names(tbl) # [1] "MasterTable_ID" "Alias" "Latitude" "Longitude" - # [5] "Conc.ug.m3." "Flow.l.m." "AT.C." "BP.PA." + # [5] "Conc.mg.m3." "Flow.l.m." "AT.C." "BP.PA." # [9] "RHx..." "RHi..." "WS.M.S." "WD.Deg." # [13] "BV.V." "Alarm" "Oceaneering.Unit.Voltage" "TimeStamp" # [17] "PDate" "monitorName" "monitorType" "monitorSubtype" @@ -182,7 +182,7 @@ airsis_ESAM_MULTIQualityControl <- function( goodFlow <- !is.na(tbl$Flow.l.m.) & tbl$Flow.l.m. >= valid_Flow[1] & tbl$Flow.l.m. <= valid_Flow[2] goodAT <- !is.na(tbl$AT.C.) & tbl$AT.C. >= valid_AT[1] & tbl$AT.C. <= valid_AT[2] goodRHi <- !is.na(tbl$RHi...) & tbl$RHi... >= valid_RHi[1] & tbl$RHi... <= valid_RHi[2] - goodConcHr <- !is.na(tbl$Conc.ug.m3.) & tbl$Conc.ug.m3. >= valid_Conc[1] & tbl$Conc.ug.m3. <= valid_Conc[2] + goodConcHr <- !is.na(tbl$Conc.mg.m3.) & tbl$Conc.mg.m3. >= valid_Conc[1] & tbl$Conc.mg.m3. <= valid_Conc[2] gooddatetime <- !is.na(tbl$datetime) & tbl$datetime < lubridate::now(tzone = "UTC") # saw a future date once logger.trace("Flow has %s missing or out of range values", sum(!goodFlow)) @@ -296,7 +296,7 @@ if ( FALSE ) { valid_Flow = c(1.999, 2.001) # anything other than 2 is bad valid_AT = c(-Inf, 150) valid_RHi = c(-Inf, 55) - valid_Conc = c(-Inf, 5000) + valid_Conc = c(-Inf, 5) flagAndKeep = FALSE } diff --git a/R/airsis_createDataDataframe.R b/R/airsis_createDataDataframe.R index 3b9e0e38..23a096eb 100644 --- a/R/airsis_createDataDataframe.R +++ b/R/airsis_createDataDataframe.R @@ -73,11 +73,7 @@ airsis_createDataDataframe <- function( if ( monitorType == 'EBAM' ) { pm25Var <- 'ConcHr' } else if ( monitorType == 'ESAM' ) { - if ( monitorSubtype == 'MULTI' ) { - pm25Var <- 'Conc.ug.m3.' - } else { - pm25Var <- 'Conc.mg.m3.' - } + pm25Var <- 'Conc.mg.m3.' } else if ( monitorType == 'BAM1020' ) { pm25Var <- 'Conc..\u00B5g.m3.' } else { @@ -96,11 +92,7 @@ airsis_createDataDataframe <- function( } if ( monitorType == 'ESAM' ) { - if ( monitorSubtype == 'MULTI') { - melted$value <- melted$value * 1 - } else { - melted$value <- melted$value * 1000 - } + melted$value <- melted$value * 1000 } # Use median if multiple values are found diff --git a/R/airsis_createMonitorObject.R b/R/airsis_createMonitorObject.R index 2fa2ff63..3fdb4d46 100644 --- a/R/airsis_createMonitorObject.R +++ b/R/airsis_createMonitorObject.R @@ -188,8 +188,8 @@ if ( FALSE ) { # 2020 "ESAM Multi" format -- usfs.2072-5 - startdate = MazamaCoreUtils::parseDatetime("2020-06-14", timezone = "UTC") - enddate = MazamaCoreUtils::parseDatetime("2020-06-20", timezone = "UTC") + startdate = MazamaCoreUtils::parseDatetime("2020-07-01", timezone = "UTC") + enddate = MazamaCoreUtils::parseDatetime("2020-07-07", timezone = "UTC") provider = "usfs" unitID = 1072 clusterDiameter = 1000 diff --git a/R/airsis_identifyMonitorType.R b/R/airsis_identifyMonitorType.R index c983009f..9289d14b 100644 --- a/R/airsis_identifyMonitorType.R +++ b/R/airsis_identifyMonitorType.R @@ -42,9 +42,8 @@ airsis_identifyMonitorType <- function(df) { # ----- Different header styles ---------------------------------------------- - # USFS_esamMulti, provider = "usfs", unitID=1072-5 (starting in June, 2020) - ###"MasterTable_ID,Alias,Latitude,Longitude,Conc(mg/m3),Flow(l/m),AT(C),BP(PA),RHx(%),RHi(%),WS(M/S),WD(Deg),BV(V),Alarm,Oceaneering Unit Voltage,TimeStamp,PDate" - esamMulti_header <- "MasterTable_ID,Alias,Latitude,Longitude,Conc(ug/m3),Flow(l/m),AT(C),BP(PA),RHx(%),RHi(%),WS(M/S),WD(Deg),BV(V),Alarm,Oceaneering Unit Voltage,TimeStamp,PDate" + # USFS_esamMulti, provider = "usfs", unitID=1072-5 (starting in July 08, 2020; was mistakenly in units of ug/m3 before that) + esamMulti_header <- "MasterTable_ID,Alias,Latitude,Longitude,Conc(mg/m3),Flow(l/m),AT(C),BP(PA),RHx(%),RHi(%),WS(M/S),WD(Deg),BV(V),Alarm,Oceaneering Unit Voltage,TimeStamp,PDate" esamMulti_rawNames <- unlist(stringr::str_split(esamMulti_header, ',')) esamMulti_names <- make.names(esamMulti_rawNames) # "64424513,USFS 1072,,,2,2.0,33.3,86107,1,13,2.6,175,14,,,6/14/2020 12:05:13 AM,6/14/2020 12:05:00 AM" diff --git a/docker/Dockerfile b/docker/Dockerfile index 8c4ceb71..8dc02a03 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,6 +18,5 @@ RUN install2.r --error -r "https://cran.rstudio.com" \ # Install latest updates from GitHub RUN installGithub.r \ - mazamascience/MazamaCoreUtils \ mazamascience/PWFSLSmoke diff --git a/docker/Makefile b/docker/Makefile index ae15084c..d4c492d2 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -3,5 +3,7 @@ # PRODUCTION version ----------------------------------------------------------- production_build: - docker build --no-cache -t mazamascience/pwfslsmoke:1.2.108 -t mazamascience/pwfslsmoke:latest . + docker build --no-cache -t mazamascience/pwfslsmoke:1.2.112 -t mazamascience/pwfslsmoke:latest . +production_publish: + docker login && docker push mazamascience/pwfslsmoke:1.2.112 diff --git a/docker/README.md b/docker/README.md index feea2eae..55f006c7 100644 --- a/docker/README.md +++ b/docker/README.md @@ -13,7 +13,7 @@ You should then be able to see something like the following: ``` $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE -mazamascience/pwfslsmoke 1.2.108 1824e396e3f3 34 seconds ago 2.61GB +mazamascience/pwfslsmoke 1.2.112 1824e396e3f3 34 seconds ago 2.61GB mazamascience/pwfslsmoke latest 1824e396e3f3 34 seconds ago 2.61GB ... ``` @@ -27,7 +27,8 @@ the docker image in `/home/mazama/data/Spatial`. ## Test the Docker Image ## Having built the docker image we can now test it. The following output was -obtained on April 03, 2019: +obtained on July 08, 2020 -- Fourth of July Fireworks!!!: + ``` docker run -ti mazamascience/pwfslsmoke R --vanilla @@ -40,30 +41,27 @@ ids <- names(maxValues) df <- wa$meta[ids,c('siteName','countyName')] df$max_pm25 <- maxValues print(df) - siteName countyName max_pm25 -840530390006_01 Mobile-White Salmon Klickitat 63.2 -TT1010003_01 Inchelium 51.8 -530650002_01 Wellpinit-Spokane Tribe Stevens 51.3 -840530739992_01 Maple Falls-Azure Way Whatcom 49.7 -530070011_01 Wenatchee-Fifth St Chelan 49.4 -530610020_01 Darrington-Fir St Snohomish 49.0 + siteName countyName max_pm25 +530330080_01 Seattle-Beacon Hill King 943.0 +530272002_01 Aberdeen-Division St Grays Harbor 203.7 +530611007_01 Marysville-7th Ave Snohomish 134.0 +530650005_01 Colville-E 1st St Stevens 123.0 +530110024_01 Vancouver-NE 84th Ave Clark 115.0 +530350007_01 Bremerton-Spruce Ave Kitsap 113.0 ``` ## Publish the Docker Image ## ``` -docker login -... -docker push mazamascience/pwfslsmoke:1.2.108 +make production_publish ``` - ## Download the Docker Image ## -A recent image can also be obtained from DockerHub with: +This image can also be pulled from DockerHub with: ``` -docker pull mazamascience/pwfslsmoke:1.2.108 +docker pull mazamascience/pwfslsmoke:1.2.112 ``` diff --git a/man/airsis_ESAM_MULTIQualityControl.Rd b/man/airsis_ESAM_MULTIQualityControl.Rd index bccdbc79..86dddb9b 100644 --- a/man/airsis_ESAM_MULTIQualityControl.Rd +++ b/man/airsis_ESAM_MULTIQualityControl.Rd @@ -13,7 +13,7 @@ airsis_ESAM_MULTIQualityControl( valid_Flow = c(1.999, 2.001), valid_AT = c(-Inf, 150), valid_RHi = c(-Inf, 55), - valid_Conc = c(-Inf, 5000), + valid_Conc = c(-Inf, 5), flagAndKeep = FALSE ) }