The data from PACMAN does not include an ISO compliant date field so it must be constructed from the available data
library('openair')
## Loading required package: lazyeval
## Loading required package: dplyr
##
## Attaching package: 'dplyr'
##
## The following object is masked from 'package:stats':
##
## filter
##
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
##
## Loading required package: maps
library('ggplot2')
unitID<-'pacman_12'
pacman.data <- read.delim(paste0("/home/gustavo/data/CONA/PACMAN/campaign/",unitID,".txt"))
names(pacman.data)<-c('Count','Year','Month','Day','Hour','Minute','Second',
'Distance','Temperature_IN_C','Temperature_mV','PM_mV','CO2_mV','CO_mV','Movement','COstatus')
pacman.data$Temperature_mV <- pacman.data$Temperature_mV/1000
pacman.data$date<-ISOdatetime(year=pacman.data$Year,
month=pacman.data$Month,
day=pacman.data$Day,
hour=pacman.data$Hour,
min=pacman.data$Minute,
sec=pacman.data$Second,
tz="GMT")
dstart=as.character(min(pacman.data$date))
dend=as.character(max(pacman.data$date))
Parameter | Value |
---|---|
Date start | 2015-08-18 10:58:21 |
Date finish | 2015-08-25 14:18:35 |
Location | NIWA Christchurch |
Unit | pacman_12 |
Using data from previous deployments of similar dust sensors (ODIN project), the raw voltage reported by PACMAN was corrected to compensate for the impact of ambient temperature on its operation.
## Dust = dustA*PM_mV + dustB*Temperature_mV + dustC ug/m3 ##
# dustA=0.8798
# dustB=-3.5372
# dustC=-289.6213
# pacman.data$Dust<-dustA*pacman.data$PM_mV + dustB*pacman.data$Temperature_mV + dustC
pacman.data$Dust<-pacman.data$PM_mV
The sensor used by PACMAN operates in cycles and only one data point per cycle is valid. PACMAN reports the CO_status
flag that indicates the position in the cycle that the sensor is at. The valid data point correspond to the end of the CO_status
labelled 2.
nrecs=length(pacman.data$COstatus)
pacman.data$CO_ok<-FALSE
pacman.data$CO_ok[-1]=(pacman.data$COstatus[-1]==1)
To summarize the date, we produced weekly diurnal variation plots for the measurements.
diurnal.distance<-timeVariation(pacman.data,pollutant='Distance')
ggplot(diurnal.distance$data$day.hour)+
geom_ribbon(aes(x=hour,ymin=Lower,ymax=Upper),fill='red')+
geom_line(aes(x=hour,y=Mean),colour='red')+
facet_grid(~wkday)+
ggtitle('Distance')+
xlab('NZST hour')+
ylab('Distance from sensor [mV]')
diurnal.temp_out<-try(timeVariation(pacman.data,pollutant='Temperature_IN_C'))
if (class(diurnal.temp_out)!="try-error"){
ggplot(diurnal.temp_out$data$day.hour)+
geom_ribbon(aes(x=hour,ymin=Lower,ymax=Upper),fill='red')+
geom_line(aes(x=hour,y=Mean),colour='red')+
facet_grid(~wkday)+
ggtitle('External temperature')+
xlab('NZST hour')+
ylab('External Temperature [C]')
}
diurnal.temp_in<-try(timeVariation(pacman.data,pollutant='Temperature_mV'))
if (class(diurnal.temp_in)!="try-error"){
ggplot(diurnal.temp_in$data$day.hour)+
geom_ribbon(aes(x=hour,ymin=Lower,ymax=Upper),fill='red')+
geom_line(aes(x=hour,y=Mean),colour='red')+
facet_grid(~wkday)+
ggtitle('Internal Temperature')+
xlab('NZST hour')+
ylab('Internal Temperature [C]')
}
diurnal.dust<-try(timeVariation(pacman.data,pollutant='Dust'))
if (class(diurnal.dust)!="try-error"){
ggplot(diurnal.dust$data$day.hour)+
geom_ribbon(aes(x=hour,ymin=Lower,ymax=Upper),fill='red')+
geom_line(aes(x=hour,y=Mean),colour='red')+
facet_grid(~wkday)+
ggtitle('Dust \n Corrected with ODIN data')+
xlab('NZST hour')+
ylab('Dust [ug/m3]')
}
scatterPlot(pacman.data,x='Temperature_mV',y='Dust')
diurnal.co2<-try(timeVariation(pacman.data,pollutant='CO2_mV'))
if (class(diurnal.co2)!="try-error"){
ggplot(diurnal.co2$data$day.hour)+
geom_ribbon(aes(x=hour,ymin=Lower,ymax=Upper),fill='red')+
geom_line(aes(x=hour,y=Mean),colour='red')+
facet_grid(~wkday)+
ggtitle('CO2')+
xlab('NZST hour')+
ylab('CO2 [mV]')
}
diurnal.co<-try(timeVariation(pacman.data,pollutant='CO_mV',plot=FALSE))
if (class(diurnal.co)!="try-error"){
ggplot(diurnal.co$data$day.hour)+
geom_ribbon(aes(x=hour,ymin=Lower,ymax=Upper),fill='red')+
geom_line(aes(x=hour,y=Mean),colour='red')+
facet_grid(~wkday)+
ggtitle('CO')+
xlab('NZST hour')+
ylab('CO [mV]')
}
diurnal.mov<-try(timeVariation(pacman.data,pollutant='Movement'))
if (class(diurnal.mov)!="try-error"){
ggplot(diurnal.mov$data$day.hour)+
geom_ribbon(aes(x=hour,ymin=Lower,ymax=Upper),fill='red')+
geom_line(aes(x=hour,y=Mean),colour='red')+
facet_grid(~wkday)+
ggtitle('Movement')+
xlab('NZST hour')+
ylab('Movement')
}