Skip to content

Commit b8bb5ae

Browse files
author
Ellen Webborn
committed
Couple of little changes, now works with new smart meter data.
1 parent 443c2cf commit b8bb5ae

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

scripts/SERL_smart_meter_data_preparation_v2020_08.R

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ library(stringr)
1414

1515
# Define Input Variables --------------------------------------------------
1616
save_data <- TRUE
17+
remove_orig <- TRUE
1718

1819
hh_file_location <- "S:/ENERGINST_EaB_Project_17_SMRP/Data/Researcher data/Observatory2020_08/Original/"
1920
daily_file_location <- "S:/ENERGINST_EaB_Project_17_SMRP/Data/Researcher data/Observatory2020_08/Original/"
@@ -23,7 +24,7 @@ daily_file_format_removed <- "SERL_smart_meter_daily_v2020_08"
2324
hh_file_format_removed <- "SERL_smart_meter_hh_v2020_08"
2425
rt_file_format_removed <- "SERL_smart_meter_rt_summary_v2020_08"
2526
pp_summary_file_format_removed <- "SERL_participant_summary_v2020_08"
26-
saving_location <- "S:/ENERGINST_EaB_Project_17_SMRP/Data/Researcher data/Observatory2020_08/"
27+
saving_location <- "S:/ENERGINST_EaB_Project_17_SMRP/Data/Researcher data/Observatory2020_08/Processed/"
2728

2829
## Smart meter data
2930

@@ -35,14 +36,14 @@ raw_daily <- "Daily Readings Aug2018-Jul2020.csv"
3536

3637

3738
## Auxilliary files
38-
theoretical_dates_file <- "S:/ENERGINST_EaB_Project_17_SMRP/Data/Researcher data/Observatory2020_08/actualStart_20_08_10.csv"
39+
theoretical_dates_file <- "S:/ENERGINST_EaB_Project_17_SMRP/Data/Researcher data/Observatory2020_08/Original/actualStart_20_08_10.csv"
3940

4041
collection_end_date <- ymd("2020-07-31")
4142

4243
survey_file <- "S:/ENERGINST_EaB_Project_17_SMRP/Data/Pilot_survey/pilot_survey_data_1675.RData"
4344
participant_details_file <- "S:/ENERGINST_EaB_Project_17_SMRP/Data/Researcher data/SERL Participants Data 2020-07-09.csv"
4445
EPC_file <- "S:/ENERGINST_EaB_Project_17_SMRP/Data/Researcher data/SERL EPC Data.csv"
45-
inventory_file <- "S:/ENERGINST_EaB_Project_17_SMRP/Data/Inventory/Inventory Data 2020-06-01.csv"
46+
inventory_file <- "S:/ENERGINST_EaB_Project_17_SMRP/Data/Inventory/Monthly Inventory Data 2020-08-03.csv"
4647

4748

4849
# Error codes -------------------------------------------------------------
@@ -951,12 +952,12 @@ readDates <- determine.theoretical.read.dates(theoretical_dates_file,
951952

952953
ptm <- proc.time()
953954
hh_orig <- import.and.rbind(raw_hh, hh_file_location)
954-
proc.time() - ptm # 78.06 seconds elapsed
955+
proc.time() - ptm # 91 seconds elapsed
955956

956957

957958
ptm <- proc.time()
958959
daily_orig <- import.and.rbind(raw_daily, daily_file_location)
959-
proc.time() - ptm # 1.36 seconds elapsed
960+
proc.time() - ptm # 4 seconds elapsed
960961

961962
# deal with integer-64 in hh data (replace 64-bit equivalent of 16777215 with 32-bit version)
962963
hh <- copy(hh_orig)
@@ -985,15 +986,15 @@ daily <- get.meter.existence(daily, readDates, resolution = "daily")
985986
ptm <- proc.time()
986987
hh <- format.date.times(hh, resolution = "hh")
987988
daily <- format.date.times(daily, resolution = "daily")
988-
proc.time() - ptm # 42.02 seconds elapsed
989+
proc.time() - ptm # 53 seconds elapsed
989990

990991
hh[, Valid_read_time := HH %in% seq(1:48)]
991992
daily <- validate.daily.read.time(daily)
992993

993994
ptm <- proc.time()
994995
hh <- code.errors(hh, error_codes_hh)
995996
daily <- code.errors(daily, error_codes_daily)
996-
proc.time() - ptm # 26.94 seconds elapsed
997+
proc.time() - ptm # 23 seconds elapsed
997998

998999
hh <- convert.gas.hh(hh)
9991000
daily <- convert.gas.daily(daily)
@@ -1003,12 +1004,12 @@ daily <- convert.elec.daily(daily)
10031004

10041005
ptm <- proc.time()
10051006
daily <- calc.hh.sums.flag.mismatch(daily, hh)
1006-
proc.time() - ptm # 16.66 seconds elapsed
1007+
proc.time() - ptm # 20 seconds elapsed
10071008

10081009
ptm <- proc.time()
10091010
daily <- flag.daily.sum.match(daily, elec_match_limit, elec_similar_limit,
10101011
gas_match_limit, gas_similar_limit)
1011-
proc.time() - ptm # 0.47 seconds elapsed
1012+
proc.time() - ptm # .4 seconds elapsed
10121013

10131014
hh <- reorder.sm.cols(hh)
10141015
daily <- reorder.sm.cols(daily, "daily")

0 commit comments

Comments
 (0)