diff --git a/impetusModel/impetusModel.Rmd b/impetusModel/impetusModel.Rmd index 2e7c2e2bc19363146462c326e6e3784d5bcaf732..b981bd11a68e9ec2e275e6ef161128f21372b872 100644 --- a/impetusModel/impetusModel.Rmd +++ b/impetusModel/impetusModel.Rmd @@ -163,6 +163,7 @@ The final data output consists of 1800 household records for each month of each * v1_2: uses median mcm values from [@parkerThesis2014] Table 4.1 * v1_3: uses median mcm values from [@parkerThesis2014] Table 4.4 & Fig 5.1 * v2: uses values estimated from the SPRG Traces of Water Household Survey +* v2_1: applies an enhanced WE uptake (dual flush WCs) scenario # Conference papers: @@ -171,37 +172,37 @@ The final data output consists of 1800 household records for each month of each # Import generic data -```{r Import generic data, child = "importGenericData.Rmd"} +```{r Import generic data, child = "1_importGenericData.Rmd"} # Import generic data ``` # Baseline Year 0 consumption estimation (model v1) -```{r Run Model v1, child = "baselineModel_v1_3.Rmd"} +```{r Run Model v1, child = "2_baselineModel_v1_3.Rmd"} # Run model 1 baseline estimation & tests and write out synthetic household file ``` # Baseline Year 0 consumption estimation (model v2) -```{r Run Model v2, child = "baselineModel_v2_0.Rmd"} +```{r Run Model v2, child = "3_baselineModel_v2_0.Rmd"} # Run model 2 baseline estimation & tests and write out synthetic household file ``` # Historical 1995-2014 consumption estimation -```{r Run Historical Construction, child = "computeHistoricalMonthly.Rmd"} +```{r Run Historical Construction, child = "4_computeHistoricalMonthly.Rmd"} # Construct historical consumption levels for each month ``` # Add Water Efficiency uptake -```{r Run WE Model, child = "addBaselineWE.Rmd"} +```{r Run WE Model, child = "5_addBaselineWE.Rmd"} # Run water efficiency model ``` # Drought Response Water Efficiency Model -```{r Run Drought Model, child = "applyDroughtModel.Rmd"} +```{r Run Drought Model, child = "6_applyDroughtModel.Rmd"} # Run water efficiency model ``` diff --git a/impetusModel/importGenericData.Rmd b/impetusModel/importGenericData.Rmd deleted file mode 100644 index ba48aa4155e9f3689353c3dad17fa976e92ccf3f..0000000000000000000000000000000000000000 --- a/impetusModel/importGenericData.Rmd +++ /dev/null @@ -1,187 +0,0 @@ -Import generic data used in all models - -## Climate data for East Anglia region - -Importing climate data from Met office files - One file per variable. - -* Rainfall -* Temperature -* Sunshine - -```{r loadClimate} -# metData1DT <- data.table(read.dta(paste(iPath,"mean_temp_all_places.dta", sep = ""))) -# metData2DT <- data.table(read.dta(paste(iPath,"mean_sunshine_all_places.dta", sep = ""))) -# metData3DT <- data.table(read.dta(paste(iPath,"mean_rainfall_all_places.dta", sep = ""))) - -metDataMeanTempDT <- data.table(read.csv(paste0(iPath,"meanTempEA.csv"))) -metDataMeanRainfallDT <- data.table(read.csv(paste0(iPath,"totalRainfallEA.csv"))) -metDataMeanSunshineDT <- data.table(read.csv(paste0(iPath,"totalSunshineEA.csv"))) - -kable(caption = "Summary of Met Office tables", - tables() -) -``` - -Sunshine only starts in 1929 so the sunshine table has fewer rows. - -Now extract relevant data. We have [Met Office data](http://www.metoffice.gov.uk/climate/uk/summaries/datasets) up to 2016 but we only have CEH reconstructed drough thistories form 1994. - -> Why are we just using East Anglia? One catchment is in Sussex so don't we want more data...? - -```{r extractMetData} - -relMetDataMeanRainfallDT <- metDataMeanRainfallDT[year >= 1994] - -relMetDataMeanSunshineDT <- metDataMeanSunshineDT[year >= 1994] - -relMetDataMeanTempDT <- metDataMeanTempDT[year >= 1994] - -``` - -Now reshape the data so it is in long form and test year/month coverage - should be one row (observation) per month/year. - -```{r reshapeMetData} -temperatureDT <- ba_IMPETUSreshapeTemp(relMetDataMeanTempDT) - -sunshineDT <- ba_IMPETUSreshapeSun(relMetDataMeanSunshineDT) - -# merge those sunshine & temperature -metDataDT <- merge(temperatureDT, sunshineDT) - -rainfallDT <- ba_IMPETUSreshapeRain(relMetDataMeanRainfallDT) - -# add rainfall - -metDataDT <- merge(metDataDT, rainfallDT) - -# check we have met data for all months & years required -kable(caption = "Check of Met data months vs year", - metDataDT[, .(meanDailyTemp = round(mean(meanTemp),2), - meanMonthlySun = round(mean(totalSunshine),2), - meanMonthlyRain = round(mean(totalRainfall),2), - nMonths = .N), by = year] -) -``` - -Now run some met data tests - do these distributions look OK? - -```{r metDataTests} -# do some tests pn the met data to check - -rainPlot <- ba_IMPETUSplotRain(metDataDT) -rainPlot - -sunPlot <- ba_IMPETUSplotSun(metDataDT) -sunPlot - -tempPlot <- ba_IMPETUSplotTemp(metDataDT) -tempPlot - -``` - -Looks OK - the new Met Office data has removed the strange spike in sunshine in 2011. - -Data restrictions/filters: - -* We only have the CEH reconstructed drought phase available from Winter (Dec-Feb) 1994/1995 onwards -* We have Met Office data to end 2016 but test to 2014 for now (could extend) - -```{r getFinalInputData} -# if (rw == 1994 & mn <= 12) { -# }# skip these values. start from December 1994. -# # CEH reconstructed Drought phase available from Winter1994/1995 onwards(Dec-Feb). -# else if (rw == 2011 & mn >= 10){ -# } # Met data unavailable from 2011-Sep onwards. - -relevantMetDataDT <- metDataDT[year >= 1994] # CEH reconstructed drought from Dec 1994 onwards so we start from that year - -relevantMetDataDT <- relevantMetDataDT[year <= 2014] # see adjusted season file - sets max time - -# and also data from August is suspect (see above) - -n_mon <- nrow(relevantMetDataDT) -# add monthly sequence-id. For example sl.no 1 for 1995 January. -relevantMetDataDT$slno <- seq(1,n_mon) - -toDelete <- c("time.x", - "time.y", - "time", - "id", - "id.y") - -relevantMetDataDT <- relevantMetDataDT[, (toDelete) := NULL] - -kable(caption = "First few rows", - head(relevantMetDataDT) -) -kable(caption = "Last few rows", - tail(relevantMetDataDT) -) -``` - -As a result we have `r n_mon` momths of historical met office data with which to work. - -## Import multivariate linear regression coefficients - -Next we import the regression coefficients from Parker's thesis [@parkerThesis2014] Table A.3 & Table A.4 (p221-222) - we use these to update the water demand according to occupancy and climate variables. Note that non-statistically significant values are set to zero and we do not use all of these coefficients in the models that follow. - -```{r importMlmCoefs} -mlmDataUnmeteredDT <- data.table(read.csv(paste0(iPath,"Parker-2014-Thesis-Micro-Component-Golden-100_tabula_ouput_mlm_unmetered.csv"))) - -mlmDataMeteredDT <- data.table(read.csv(paste0(iPath,"Parker-2014-Thesis-Micro-Component-Golden-100_tabula_ouput_mlm_metered.csv"))) - -# combine them -mlmDataMeteredDT <- mlmDataMeteredDT[, metered := "Metered"] -mlmDataUnmeteredDT <- mlmDataUnmeteredDT[, metered := "Not metered"] -mlmDataDT <- rbind(mlmDataMeteredDT, mlmDataUnmeteredDT) - -kable(caption = "Regression coefficients for use in adjusting mcm values (first 15 rows, metered data)", - mlmDataDT -) -``` - -> NB: how could we use the SMD coefficient in drought response modelling? Can we convert the CEH drought histories to SMD in some way? Table 5.8 (p137) in Parker's these susggests an affect for SMD beyond just temp & rainfall? - -```{r processMlmCoeffs} -# The next step is to set up the occupancy and other adjustment tables based on Parker's regression coefficiencts. - -# climate adjustments ---- - -climAdjCoeffDT <- ba_IMPETUSgetClimateAdj(mlmDataDT) - -# monthly adjustments ---- - -monthAdjCoeffDT <- ba_IMPETUSgetMonthlyAdj(mlmDataDT) - -# yoyAdjCoeffDT - coefficient for adjusting year or year adjustment ---- -# This is changed to monthly basis yearly/12 to avoid lumping end of the year (e.g. Decemeber) - -yoyAdjCoeffDT <- ba_IMPETUSgetYoyAdj(mlmDataDT) - -# occupancyadjcoeff - coefficient for adjusting HH daily consumption to change based on HH occupancy ---- - -occupancyAdjCoeffDT <- ba_IMPETUSgetOccAdj(mlmDataDT) - -``` - -## EST data - -For comparison purposes. - -```{r Import EST data} -est2013dataFig1DT <- data.table(read.csv(paste0(iPath,"est2013dataFig1_microcomp.csv"))) -kable(caption = "Summary of mean daily litres per micro-component (EST, 2013, imputed data using assumptions and survey of unknown bias)", - est2013dataFig1DT -) - -est2013dataFig2DT <- data.table(read.csv(paste0(iPath,"est2013dataFig2.csv"))) - -kable(caption = "Summary of mean daily litres per household with different occupancy levels (EST, 2013, imputed dta using assumptions and survey of unknown bias)", - est2013dataFig2DT -) - - -``` - -```{r Run import generic data} -``` \ No newline at end of file