# Load libraries
require('openair')
## Loading required package: 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
require('reshape2')
## Loading required package: reshape2
# load_odin data
## ODIN_02. Temperature and RH sensor failed. See below for proxy data used
odin_02 <- read.table("/home/gustavo/data/CONA/ODIN/deployment/odin_02.data",
header=T, quote="")
odin_02$date=as.POSIXct(paste(odin_02$Date,odin_02$Time),tz='NZST')
odin_02$Time<-NULL
odin_02$Date<-NULL
odin_02$Batt<-5*odin_02$Batt/1024
timePlot(odin_02,pollutant = c('Dust','Temp'))
## Warning in checkPrep(mydata, vars, type, remove.calm = FALSE): Detected
## data with Daylight Saving Time, converting to UTC/GMT

## ODIN_03 ... Failed after 24 hours. not used
odin_03 <- read.table("/home/gustavo/data/CONA/ODIN/deployment/odin_03.data",
header=T, quote="")
odin_03$date=as.POSIXct(paste(odin_03$Date,odin_03$Time),tz='NZST')
odin_03$Time<-NULL
odin_03$Date<-NULL
odin_03$Batt<-5*odin_03$Batt/1024
timePlot(odin_03,pollutant = c('Dust','Temp'))
## Warning in checkPrep(mydata, vars, type, remove.calm = FALSE): Detected
## data with Daylight Saving Time, converting to UTC/GMT

## ODIN_04
odin_04 <- read.table("/home/gustavo/data/CONA/ODIN/deployment/odin_04.data",
header=T, quote="")
odin_04$date=as.POSIXct(paste(odin_04$Date,odin_04$Time),tz='NZST')
odin_04$Time<-NULL
odin_04$Date<-NULL
odin_04$Batt<-5*odin_04$Batt/1024
timePlot(odin_04,pollutant = c('Dust','Temp'))
## Warning in checkPrep(mydata, vars, type, remove.calm = FALSE): Detected
## data with Daylight Saving Time, converting to UTC/GMT

## ODIN_05
odin_05 <- read.table("/home/gustavo/data/CONA/ODIN/deployment/odin_05.data",
header=T, quote="")
odin_05$date=as.POSIXct(paste(odin_05$Date,odin_05$Time),tz='NZST')
odin_05$Time<-NULL
odin_05$Date<-NULL
odin_05$Batt<-5*odin_05$Batt/1024
timePlot(odin_05,pollutant = c('Dust','Temp'))
## Warning in checkPrep(mydata, vars, type, remove.calm = FALSE): Detected
## data with Daylight Saving Time, converting to UTC/GMT

## ODIN_06
odin_06 <- read.table("/home/gustavo/data/CONA/ODIN/deployment/odin_06.data",
header=T, quote="")
#force GMT as the time zone to avoid openair issues with daylight saving switches
#The actual time zone is 'NZST'
odin_06$date=as.POSIXct(paste(odin_06$Date,odin_06$Time),tz='NZST')
odin_06$Time<-NULL
odin_06$Date<-NULL
odin_06$Batt<-5*odin_06$Batt/1024
timePlot(odin_06,pollutant = c('Dust','Temp'))
## Warning in checkPrep(mydata, vars, type, remove.calm = FALSE): Detected
## data with Daylight Saving Time, converting to UTC/GMT

## ODIN_07. Data not downloaded. Not used.
odin_07 <- read.table("/home/gustavo/data/CONA/ODIN/deployment/odin_07.data",
header=T, quote="")
odin_07$date=as.POSIXct(paste(odin_07$Date,odin_07$Time),tz='NZST')
odin_07$Time<-NULL
odin_07$Date<-NULL
odin_07$Batt<-5*odin_07$Batt/1024
timePlot(odin_07,pollutant = c('Dust','Temp'))
## Warning in checkPrep(mydata, vars, type, remove.calm = FALSE): Detected
## data with Daylight Saving Time, converting to UTC/GMT

# Load ECan data
download.file(url = "http://data.ecan.govt.nz/data/29/Air/Air%20quality%20data%20for%20a%20monitored%20site%20(Hourly)/CSV?SiteId=5&StartDate=14%2F08%2F2015&EndDate=01%2F09%2F2015",destfile = "ecan_data.csv",method = "curl")
system("sed -i 's/a.m./AM/g' ecan_data.csv")
system("sed -i 's/p.m./PM/g' ecan_data.csv")
ecan_data_raw <- read.csv("ecan_data.csv",stringsAsFactors=FALSE)
ecan_data_raw$date<-as.POSIXct(ecan_data_raw$DateTime,format = "%d/%m/%Y %I:%M:%S %p",tz='NZST')
ecan_data<-as.data.frame(ecan_data_raw[,c('date','PM10.FDMS','Temperature..2m')])
names(ecan_data)<-c('date','PM10.FDMS','Temperature..1m')
## Merging the data
# ECan's data was provided as 10 minute values while ODIN reports every 1 minute so before merging the data, the timebase must be homogenized
names(odin_02)<-c('Dust.02','RH.02','Temperature.02','Batt.02','date')
names(odin_03)<-c('Dust.03','RH.03','Temperature.03','Batt.03','date')
names(odin_04)<-c('Dust.04','RH.04','Temperature.04','Batt.04','date')
names(odin_05)<-c('Dust.05','RH.05','Temperature.05','Batt.05','date')
names(odin_06)<-c('Dust.06','RH.06','Temperature.06','Batt.06','date')
names(odin_07)<-c('Dust.07','RH.07','Temperature.07','Batt.07','date')
odin <- merge(odin_02,odin_03,by = 'date', all = TRUE)
odin <- merge(odin,odin_04,by='date',all=TRUE)
odin <- merge(odin,odin_05,by='date',all=TRUE)
odin <- merge(odin,odin_06,by='date',all=TRUE)
odin <- merge(odin,odin_07,by='date',all=TRUE)
odin <- selectByDate(odin,start = '2015-08-15',end = '2015-08-31')
## Warning in checkPrep(mydata, vars, "default", remove.calm = FALSE,
## strip.white = FALSE): Detected data with Daylight Saving Time, converting
## to UTC/GMT
odin.10min<-timeAverage(odin,avg.time='10 min')
all_merged.10min<-merge(odin.10min,ecan_data,by='date',all=TRUE)
timePlot(all_merged.10min,pollutant = c('Temperature..1m',
'Temperature.02',
'Temperature.03',
'Temperature.04',
'Temperature.05',
'Temperature.06',
'Temperature.07'))

## Time sync
lag_test=ccf(all_merged.10min$Temperature.05,
all_merged.10min$Temperature..1m,
na.action=na.pass,
lag.max=100,
type='covariance',
ylab='Correlation',
main='Temperature correlation as function of clock lag')

odin_lag=lag_test$lag[which.max(lag_test$acf)]
# correct timing
odin$date=odin$date-odin_lag*10*60
odin.10min<-timeAverage(odin,avg.time='10 min')
all_merged.10min<-merge(odin.10min,ecan_data,by='date',all=TRUE)
lag_test=ccf(all_merged.10min$Temperature.05,
all_merged.10min$Temperature..1m,
na.action=na.pass,
lag.max=100,
type='covariance',
ylab='Correlation',
main='Temperature correlation as function of clock lag')

## Remove drift from ODIN raw data
# Estimate the baseline from a simple linear regression
all_merged.10min$ODIN_drift.02<-predict(lm(all_merged.10min$Dust.02~seq(all_merged.10min$Dust.02)),newdata = all_merged.10min)
#all_merged.10min$ODIN_drift.03<-predict(lm(all_merged.10min$Dust.03~seq(all_merged.10min$Dust.03)),newdata = all_merged.10min)
all_merged.10min$ODIN_drift.04<-predict(lm(all_merged.10min$Dust.04~seq(all_merged.10min$Dust.04)),newdata = all_merged.10min)
all_merged.10min$ODIN_drift.05<-predict(lm(all_merged.10min$Dust.05~seq(all_merged.10min$Dust.05)),newdata = all_merged.10min)
all_merged.10min$ODIN_drift.06<-predict(lm(all_merged.10min$Dust.06~seq(all_merged.10min$Dust.06)),newdata = all_merged.10min)
#all_merged.10min$ODIN_drift.07<-predict(lm(all_merged.10min$Dust.07~seq(all_merged.10min$Dust.07)),newdata = all_merged.10min)
# Remove the baseline drift from the raw ODIN data
all_merged.10min$Dust.02.raw <- all_merged.10min$Dust.02
all_merged.10min$Dust.02.detrend<-all_merged.10min$Dust.02.raw - all_merged.10min$ODIN_drift.02
# all_merged.10min$Dust.03.raw <- all_merged.10min$Dust.03
# all_merged.10min$Dust.03.detrend<-all_merged.10min$Dust.03.raw - all_merged.10min$ODIN_drift.03
all_merged.10min$Dust.04.raw <- all_merged.10min$Dust.04
all_merged.10min$Dust.04.detrend<-all_merged.10min$Dust.04.raw - all_merged.10min$ODIN_drift.04
all_merged.10min$Dust.05.raw <- all_merged.10min$Dust.05
all_merged.10min$Dust.05.detrend<-all_merged.10min$Dust.05.raw - all_merged.10min$ODIN_drift.05
all_merged.10min$Dust.06.raw <- all_merged.10min$Dust.06
all_merged.10min$Dust.06.detrend<-all_merged.10min$Dust.06.raw - all_merged.10min$ODIN_drift.06
# all_merged.10min$Dust.07.raw <- all_merged.10min$Dust.07
# all_merged.10min$Dust.07.detrend<-all_merged.10min$Dust.07.raw - all_merged.10min$ODIN_drift.07
## Testing not correcting drift
all_merged.10min$Dust.02.detrend<-all_merged.10min$Dust.02.raw
# all_merged.10min$Dust.03.detrend<-all_merged.10min$Dust.03.raw
all_merged.10min$Dust.04.detrend<-all_merged.10min$Dust.04.raw
all_merged.10min$Dust.05.detrend<-all_merged.10min$Dust.05.raw
all_merged.10min$Dust.06.detrend<-all_merged.10min$Dust.06.raw
# all_merged.10min$Dust.07.detrend<-all_merged.10min$Dust.07.raw
## Estimate temperature for ODIN 02 as the average of all the other temperatures (which are very well correlated)
all_merged.10min$Temperature.02 <- with(all_merged.10min,(Temperature.04+Temperature.05+Temperature.06)/3)
## Calculate the temperature interference
all_merged.10min$Temperature.02.bin<-cut(all_merged.10min$Temperature.02,breaks = c(0,5,10,15,20,25),labels = c('2.5','7.5','12.5','17.5','22.5'))
# all_merged.10min$Temperature.03.bin<-cut(all_merged.10min$Temperature.03,breaks = c(0,5,10,15,20,25),labels = c('2.5','7.5','12.5','17.5','22.5'))
all_merged.10min$Temperature.04.bin<-cut(all_merged.10min$Temperature.04,breaks = c(0,5,10,15,20,25),labels = c('2.5','7.5','12.5','17.5','22.5'))
all_merged.10min$Temperature.05.bin<-cut(all_merged.10min$Temperature.05,breaks = c(0,5,10,15,20,25),labels = c('2.5','7.5','12.5','17.5','22.5'))
all_merged.10min$Temperature.06.bin<-cut(all_merged.10min$Temperature.06,breaks = c(0,5,10,15,20,25),labels = c('2.5','7.5','12.5','17.5','22.5'))
# all_merged.10min$Temperature.07.bin<-cut(all_merged.10min$Temperature.07,breaks = c(0,5,10,15,20,25),labels = c('2.5','7.5','12.5','17.5','22.5'))
Temp <- c(2.5,7.5,12.5,17.5,22.5)
Dust.02<-tapply(all_merged.10min$Dust.02.detrend,all_merged.10min$Temperature.02.bin,quantile,0.25)
# Dust.03<-tapply(all_merged.10min$Dust.03.detrend,all_merged.10min$Temperature.03.bin,quantile,0.25)
Dust.04<-tapply(all_merged.10min$Dust.04.detrend,all_merged.10min$Temperature.04.bin,quantile,0.25)
Dust.05<-tapply(all_merged.10min$Dust.05.detrend,all_merged.10min$Temperature.05.bin,quantile,0.25)
Dust.06<-tapply(all_merged.10min$Dust.06.detrend,all_merged.10min$Temperature.06.bin,quantile,0.25)
# Dust.07<-tapply(all_merged.10min$Dust.07.detrend,all_merged.10min$Temperature.07.bin,quantile,0.25)
TC_Dust.02 <- data.frame(Dust.02.detrend = Dust.02,Temperature.02 = Temp)
# TC_Dust.03 <- data.frame(Dust.03.detrend = Dust.03,Temperature.03 = Temp)
TC_Dust.04 <- data.frame(Dust.04.detrend = Dust.04,Temperature.04 = Temp)
TC_Dust.05 <- data.frame(Dust.05.detrend = Dust.05,Temperature.05 = Temp)
TC_Dust.06 <- data.frame(Dust.06.detrend = Dust.06,Temperature.06 = Temp)
# TC_Dust.07 <- data.frame(Dust.07.detrend = Dust.07,Temperature.07 = Temp)
# Now we calculate the linear regression for the minimum dust response in each temperature bin and subtract it from the detrended data
summary(odin.02_T<-lm(data = TC_Dust.02,Dust.02.detrend~Temperature.02))
##
## Call:
## lm(formula = Dust.02.detrend ~ Temperature.02, data = TC_Dust.02)
##
## Residuals:
## 2.5 7.5 12.5 17.5 22.5
## 20.50 -10.76 -33.02 16.32 6.96
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -22.630 23.104 -0.979 0.3996
## Temperature.02 4.452 1.609 2.767 0.0697 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 25.44 on 3 degrees of freedom
## Multiple R-squared: 0.7185, Adjusted R-squared: 0.6247
## F-statistic: 7.658 on 1 and 3 DF, p-value: 0.06972
# summary(odin.03_T<-lm(data = TC_Dust.03,Dust.03.detrend~Temperature.03))
summary(odin.04_T<-lm(data = TC_Dust.04,Dust.04.detrend~Temperature.04))
##
## Call:
## lm(formula = Dust.04.detrend ~ Temperature.04, data = TC_Dust.04)
##
## Residuals:
## 2.5 7.5 12.5 17.5 22.5
## -0.19 0.26 0.11 -0.24 0.06
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 33.16500 0.22062 150.32 6.49e-07 ***
## Temperature.04 0.41000 0.01536 26.69 0.000115 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2429 on 3 degrees of freedom
## Multiple R-squared: 0.9958, Adjusted R-squared: 0.9944
## F-statistic: 712.3 on 1 and 3 DF, p-value: 0.0001154
summary(odin.05_T<-lm(data = TC_Dust.05,Dust.05.detrend~Temperature.05))
##
## Call:
## lm(formula = Dust.05.detrend ~ Temperature.05, data = TC_Dust.05)
##
## Residuals:
## 2.5 7.5 12.5 17.5 22.5
## -0.06 0.16 -0.02 -0.20 0.12
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 43.57000 0.15199 286.7 9.36e-08 ***
## Temperature.05 0.43600 0.01058 41.2 3.15e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1673 on 3 degrees of freedom
## Multiple R-squared: 0.9982, Adjusted R-squared: 0.9976
## F-statistic: 1697 on 1 and 3 DF, p-value: 3.147e-05
summary(odin.06_T<-lm(data = TC_Dust.06,Dust.06.detrend~Temperature.06))
##
## Call:
## lm(formula = Dust.06.detrend ~ Temperature.06, data = TC_Dust.06)
##
## Residuals:
## 2.5 7.5 12.5 17.5 22.5
## -0.125 0.400 -0.075 -0.550 0.350
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 50.88750 0.40831 124.63 1.14e-06 ***
## Temperature.06 0.49500 0.02843 17.41 0.000413 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4495 on 3 degrees of freedom
## Multiple R-squared: 0.9902, Adjusted R-squared: 0.9869
## F-statistic: 303.1 on 1 and 3 DF, p-value: 0.000413
# summary(odin.07_T<-lm(data = TC_Dust.07,Dust.07.detrend~Temperature.07))
all_merged.10min$Dust.02.corr <- all_merged.10min$Dust.02.detrend - predict(odin.02_T,newdata = all_merged.10min)
# all_merged.10min$Dust.03.corr <- all_merged.10min$Dust.03.detrend - predict(odin.03_T,newdata = all_merged.10min)
all_merged.10min$Dust.04.corr <- all_merged.10min$Dust.04.detrend - predict(odin.04_T,newdata = all_merged.10min)
all_merged.10min$Dust.05.corr <- all_merged.10min$Dust.05.detrend - predict(odin.05_T,newdata = all_merged.10min)
all_merged.10min$Dust.06.corr <- all_merged.10min$Dust.06.detrend - predict(odin.06_T,newdata = all_merged.10min)
# all_merged.10min$Dust.07.corr <- all_merged.10min$Dust.07.detrend - predict(odin.07_T,newdata = all_merged.10min)
## Dust performance using ECan data for calibration
### Full dataset 1 hour PM$_{2.5}$ fdms
#all_merged.1hr<-timeAverage(all_merged.10min,avg.time='1 hour')
# It's called "1 hr" but it is in fact 10 min
all_merged.1hr<- all_merged.10min
summary(odin2.lm.full.1hr.pm2.5<-
lm(data=all_merged.1hr,PM10.FDMS~
Dust.02.corr))
##
## Call:
## lm(formula = PM10.FDMS ~ Dust.02.corr, data = all_merged.1hr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -25.016 -14.098 -6.397 6.910 139.920
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 25.49599 0.52329 48.723 < 2e-16 ***
## Dust.02.corr 0.04005 0.01004 3.989 6.84e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 21.25 on 2445 degrees of freedom
## (147 observations deleted due to missingness)
## Multiple R-squared: 0.006465, Adjusted R-squared: 0.006058
## F-statistic: 15.91 on 1 and 2445 DF, p-value: 6.841e-05
# summary(odin3.lm.full.1hr.pm2.5<-
# lm(data=all_merged.1hr,PM10.FDMS~
# Dust.03.corr))
summary(odin4.lm.full.1hr.pm2.5<-
lm(data=all_merged.1hr,PM10.FDMS~
Dust.04.corr))
##
## Call:
## lm(formula = PM10.FDMS ~ Dust.04.corr, data = all_merged.1hr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -24.374 -14.186 -6.487 6.755 141.837
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 26.4192 0.4905 53.858 <2e-16 ***
## Dust.04.corr 0.2209 0.1929 1.145 0.252
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 21.31 on 2445 degrees of freedom
## (147 observations deleted due to missingness)
## Multiple R-squared: 0.0005359, Adjusted R-squared: 0.0001271
## F-statistic: 1.311 on 1 and 2445 DF, p-value: 0.2523
summary(odin5.lm.full.1hr.pm2.5<-
lm(data=all_merged.1hr,PM10.FDMS~
Dust.05.corr))
##
## Call:
## lm(formula = PM10.FDMS ~ Dust.05.corr, data = all_merged.1hr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -49.977 -12.092 -5.211 5.158 136.705
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 20.8875 0.4722 44.24 <2e-16 ***
## Dust.05.corr 3.6080 0.1626 22.19 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 19.45 on 2445 degrees of freedom
## (147 observations deleted due to missingness)
## Multiple R-squared: 0.1677, Adjusted R-squared: 0.1673
## F-statistic: 492.5 on 1 and 2445 DF, p-value: < 2.2e-16
summary(odin6.lm.full.1hr.pm2.5<-
lm(data=all_merged.1hr,PM10.FDMS~
Dust.06.corr))
##
## Call:
## lm(formula = PM10.FDMS ~ Dust.06.corr, data = all_merged.1hr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -37.976 -12.782 -5.979 5.166 142.950
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 22.6392 0.4940 45.83 <2e-16 ***
## Dust.06.corr 2.2886 0.1535 14.91 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 20.41 on 2445 degrees of freedom
## (147 observations deleted due to missingness)
## Multiple R-squared: 0.08335, Adjusted R-squared: 0.08297
## F-statistic: 222.3 on 1 and 2445 DF, p-value: < 2.2e-16
# summary(odin7.lm.full.1hr.pm2.5<-
# lm(data=all_merged.1hr,PM10.FDMS~
# Dust.07.corr))
### Calibrated Dust
all_merged.1hr$Dust.02.cal<-predict(odin2.lm.full.1hr.pm2.5,newdata = all_merged.1hr)
# all_merged.1hr$Dust.03.cal<-predict(odin3.lm.full.1hr.pm2.5,newdata = all_merged.1hr)
all_merged.1hr$Dust.04.cal<-predict(odin4.lm.full.1hr.pm2.5,newdata = all_merged.1hr)
all_merged.1hr$Dust.05.cal<-predict(odin5.lm.full.1hr.pm2.5,newdata = all_merged.1hr)
all_merged.1hr$Dust.06.cal<-predict(odin6.lm.full.1hr.pm2.5,newdata = all_merged.1hr)
# all_merged.1hr$Dust.07.cal<-predict(odin7.lm.full.1hr.pm2.5,newdata = all_merged.1hr)
timePlot(all_merged.1hr,pollutant = c('PM10.FDMS',
'Dust.02.corr',
#'Dust.03.corr',
'Dust.04.corr',
'Dust.05.corr',
'Dust.06.corr'
#'Dust.07.corr'
)
,group = FALSE
,main = '10 min')

timePlot(all_merged.1hr,pollutant = c('PM10.FDMS'
,'Dust.02.cal'
#,'Dust.03.cal'
,'Dust.04.cal'
,'Dust.05.cal'
,'Dust.06.cal'
#,'Dust.07.cal'
)
,group = FALSE
,avg.time = '1 hour'
,main = '1 hour'
)

timeVariation(all_merged.1hr,pollutant = c('PM10.FDMS'
,'Dust.02.cal'
#,'Dust.03.cal'
,'Dust.04.cal'
,'Dust.05.cal'
,'Dust.06.cal'
#,'Dust.07.cal'
))

timeVariation(all_merged.1hr,pollutant = c('PM10.FDMS'
,'Dust.02.corr'
#,'Dust.03.corr'
,'Dust.04.corr'
,'Dust.05.corr'
,'Dust.06.corr'
#,'Dust.07.corr'
))

timebase = '1 hour'
for (xday in (15:31)){
current_day = paste0('2015-08-',sprintf('%02.f',xday))
plot_data <- selectByDate(all_merged.1hr,start = current_day, end = current_day)
png(paste0('./tseries_',current_day,'.png'),width = 1024, height = 1024)
timePlot(plot_data,pollutant = c('PM10.FDMS'
,'Dust.02.cal'
#,'Dust.03.cal'
,'Dust.04.cal'
,'Dust.05.cal'
,'Dust.06.cal'
#,'Dust.07.cal'
)
,group = FALSE
#,normalise = 'mean'
,avg.time = timebase
,main = paste(current_day,timebase)
)
dev.off()
}