diff --git a/DESCRIPTION b/DESCRIPTION index 765b95d3..07d5d5fe 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Type: Package Package: PWFSLSmoke -Version: 0.99.22 +Version: 0.99.23 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 8b1cda5e..d7c8447b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,7 +9,11 @@ from the US EPA, AirNow, AIRSIS, WRCC and others. ## Version 0.99 -- Regularized and Consistent (beta) -### PWFSLSmoke 0.99.21 +### PWFSLSmoke 0.99.23 + + * bug fix for monitor assignment issues in WRCC and AIRSIS monitors that move + +### PWFSLSmoke 0.99.22 * correction to monitor_nowcast() algorithm * updated vignettes to use package datasets diff --git a/R/airsis_createDataDataframe.R b/R/airsis_createDataDataframe.R index 5c450ae1..1afb351b 100644 --- a/R/airsis_createDataDataframe.R +++ b/R/airsis_createDataDataframe.R @@ -71,9 +71,10 @@ airsis_createDataDataframe <- function(df, meta) { maxCount <- max(valueCountPerCell[,-1]) if (maxCount > 1) logger.warn("Up to %s measurements per hour -- median used",maxCount) - # NOTE: The resulting dataframe is [datetime,monitorID] with an extra first column containing datetime + # NOTE: The resulting dataframe is [datetime,monitorIDs] with monitorIDs in alphabetical order pm25DF <- reshape2::dcast(melted, datetime ~ monitorID, stats::median) - colnames(pm25DF) <- c('datetime',meta$monitorID) + # Reorder data columns to match the order of monitorIDs in 'meta' + pm25DF <- pm25DF[,c('datetime',meta$monitorID)] # Create an empty hourlyDF dataframe with a full time axis (no missing hours) datetime <- seq(min(df$datetime), max(df$datetime), by="hours") diff --git a/R/wrcc_createDataDataframe.R b/R/wrcc_createDataDataframe.R index 1f06b490..4884d665 100644 --- a/R/wrcc_createDataDataframe.R +++ b/R/wrcc_createDataDataframe.R @@ -63,17 +63,17 @@ wrcc_createDataDataframe <- function(df, meta) { if ( monitorType == 'ESAM' ) melted$value <- melted$value * 1 # no conversion needed # Use median if multiple values are found - + # Sanity check -- only one pm25DF measure per hour valueCountPerCell <- reshape2::dcast(melted, datetime ~ monitorID, length) maxCount <- max(valueCountPerCell[,-1]) if (maxCount > 1) logger.warn("Up to %s measurements per hour -- median used",maxCount) - # NOTE: The resulting dataframe is [datetime,monitorID] with an extra first column containing datetime + # NOTE: The resulting dataframe is [datetime,monitorIDs] with monitorIDs in alphabetical order pm25DF <- reshape2::dcast(melted, datetime ~ monitorID, stats::median) - colnames(pm25DF) <- c('datetime',meta$monitorID) - rownames(pm25DF) <- format(pm25DF$datetime,"%Y%m%d%H",tz="GMT") - + # Reorder data columns to match the order of monitorIDs in 'meta' + pm25DF <- pm25DF[,c('datetime',meta$monitorID)] + # Create an empty hourlyDF dataframe with a full time axis (no missing hours) datetime <- seq(min(df$datetime), max(df$datetime), by="hours") hourlyDF <- data.frame(datetime=datetime) diff --git a/man/monitor_nowcast.Rd b/man/monitor_nowcast.Rd index 2a1bd37e..ce634fb2 100644 --- a/man/monitor_nowcast.Rd +++ b/man/monitor_nowcast.Rd @@ -55,5 +55,9 @@ title("Missing values") \url{https://www3.epa.gov/airnow/ani/pm25_aqi_reporting_nowcast_overview.pdf} \url{https://aqicn.org/faq/2015-03-15/air-quality-nowcast-a-beginners-guide/} + +\url{https://forum.airnowtech.org/t/the-nowcast-for-ozone-and-pm/172} + +\url{https://forum.airnowtech.org/t/the-aqi-equation/169} } \keyword{ws_monitor}