Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d30838b
calibration multiplier file type fix: csv to tsv
Nov 21, 2025
12772fc
explicit type conversion needed
Nov 21, 2025
0266339
scout_json folder path fix
Nov 21, 2025
8c0e1b4
Update md with pre-requisite, add combine_countydata cmd arg
Nov 21, 2025
73d40d2
more readme fix, R working dir fix
Nov 21, 2025
bf4dca0
Merge branch 'main' into fix_workflow
mcpigman Dec 22, 2025
050d77d
(C) Ref. Case Electric Other &TS use (C) Ref. Case Misc. Electric map
Jan 14, 2026
24fbe58
fix calibration_multiplier type, BLDSTOCK_TABLES mis comma
Jan 14, 2026
be41baf
add function to generate state_monthly_for_cal.csv
Jan 14, 2026
8fda9a8
Add county2tz2state.tsv
Jan 22, 2026
90450ec
remove reference to char.version sql script
Jan 22, 2026
421eb6d
rename disaggregation multiplier tables helper
Jan 28, 2026
b4b51b5
change sql to use mult table name defined in bss_workflow.py
Jan 28, 2026
4092de0
remove unused reference to enduse variable eu
Jan 28, 2026
cc00acb
fix sql file name error
Jan 28, 2026
debd090
disaggregation multipliers table name fix cont
Jan 28, 2026
c7d86c9
fix sql syntax error
Jan 28, 2026
ac87f1f
parameterize table names in test_multipliers sql
Jan 28, 2026
a4385db
package calibration in a separate workflow
Jan 28, 2026
3d39ab6
Revert "(C) Ref. Case Electric Other &TS use (C) Ref. Case Misc. Elec…
Jan 28, 2026
e41fe4a
change mapping only on ts shape
Jan 28, 2026
54c6941
for calibration, state_monthly.sql doesn't need baseyear
Jan 28, 2026
f29a28c
Need to restore the previous working dir in R code
Jan 29, 2026
4758d8e
move redundant sort by turnover to outside loop
Jan 29, 2026
6e1350e
drop conflicting tables from calibration runs
Jan 29, 2026
2af2831
more removing "version" in tests
Jan 29, 2026
0a73fb6
regenerated multipliers
Jan 29, 2026
b89fbd1
Revert "change mapping only on ts shape"
Jan 29, 2026
433ccfe
change mapping original and measure ann and ts
Jan 29, 2026
a2e7942
resolve missing day_type and dup parameterizing baseyear
Feb 20, 2026
d9d2dbd
add missing day_type check, move example_labels into the loop
Feb 20, 2026
c82d039
comercial residential separate test shape_ts files
Feb 20, 2026
129e46d
add in.weather_file_longitude to residential sql files
Feb 20, 2026
35c27fb
more fix with new column in.weather_file_longitude
Mar 3, 2026
ea6748f
add pycache and diagnostics to gitignore
Mar 6, 2026
1d19f57
fix example_peak_days plot date label
Mar 6, 2026
6c25dfd
multiplier tsv from rerun
Mar 6, 2026
af0708f
change output folder for bss-workflow bucket
Mar 6, 2026
07690b1
separate ief and bss parquetmerge, uncomment code to gen annual
Mar 6, 2026
e89b13a
use res and com version of test_missing_shape_ts
Mar 6, 2026
3ee8cfa
update gen mults, remove table before rerun, add create_table_from_tsv
Mar 6, 2026
edb9110
change calibration year to every year 2020-2024
Mar 6, 2026
a68a258
update readme on changes of command line args
Mar 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ R/.Rhistory
# Ignore helper and scout folders
helper/
scout/

# temp cache
__pycache__/
diagnostics/
3 changes: 3 additions & 0 deletions R/EIA comparison.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ eia_comp<-eia_ratios_sector %>% filter(year<2024) %>%
facet_wrap(~sector,nrow=2,labeller = labeller(sector=s_label))+
ggtitle("Ratio of max monthly electricity consumption in the winter max to max monthly electricity consumption in the summer",subtitle = "EIA 861 2001-2023 (boxplot) vs. BSS 2024 baseline (red dot)")
save_plot(paste0(graph_dir,"/",filename_prefix,"/eia_seasonal_ratio_comp.jpg"),eia_comp,base_height = 6,base_width = 12,bg="white")

# restore previous working directory, otherwise will mess up python script calls
setwd("../")
5 changes: 4 additions & 1 deletion R/annual_graphs.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ scenarios <- c("brk", "fossil", "accel", "aeo", "ref", "state",
scenario_for_baseline <- "aeo"

# I/O locations (unchanged names)
input_dir <- "../scout_tsv" # where TSVs live
input_dir <- "../scout/scout_tsv" # where TSVs live
filename_prefix <- ""
graph_dir <- "graphs/annual_results" # where graphs are written

Expand Down Expand Up @@ -300,3 +300,6 @@ wide_all <- .make_factor(wide, setall_codes)
.make_split_plots_for(wide_S1, "_S1", mm_long, states, to, sec, eu, colors)
.make_split_plots_for(wide_S2, "_S2", mm_long, states, to, sec, eu, colors)
.make_split_plots_for(wide_all, "", mm_long, states, to, sec, eu, colors)

# restore previous working directory, otherwise will mess up python script calls
setwd("../")
15 changes: 11 additions & 4 deletions R/calibration.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

setwd("R")
if (basename(getwd()) != "R") {
setwd("R")
}
#install the packages if they're not already installed
packages <- c("tidyverse", "scales", "cowplot", "maps", "mapdata", "colorspace")
install.packages(setdiff(packages, rownames(installed.packages())))
Expand All @@ -22,14 +23,17 @@ eia_gross<-read_csv("../map_meas/eia_gross_consumption_by_state_sector_year_mont
state_monthly<-read_csv("../diagnostics/state_monthly_for_cal.csv")

# if you have TMY
state_monthly_tmy<-read_csv("../diagnostics/state_monthly_for_cal_tmy.csv") %>%
mutate(type="state_monthly_tmy_kwh") %>% rename("kwh"="state_monthly_tmy_kwh")
if (file.exists("../diagnostics/state_monthly_for_cal_tmy.csv")) {
state_monthly_tmy<-read_csv("../diagnostics/state_monthly_for_cal_tmy.csv") %>%
mutate(type="state_monthly_tmy_kwh") %>% rename("kwh"="state_monthly_tmy_kwh")
}

type_label<-c(state_monthly_uncal_kwh="BSS uncalibrated",state_monthly_cal_kwh="BSS calibrated",state_monthly_tmy_kwh="BSS uncalibrated, TMY weather")
s_label<-c(com="Commercial",res="Residential",all="Buildings")

# calculate monthly state-level calibration ratios ------------------------
monthly_ratios<-state_monthly %>%
dplyr::mutate_at(vars(month, year), as.numeric) %>%
inner_join(eia_gross,by=c("in.state","month","sector","year")) %>%
mutate(gross_over_bss=gross.kWh/state_monthly_uncal_kwh,
net_over_bss=sales.kWh/state_monthly_uncal_kwh) %>%
Expand Down Expand Up @@ -133,3 +137,6 @@ ggplot(aes(x=x,y=y))+


save_plot(plot_grid(quadgraph,leg,nrow = 1,rel_widths = c(4,1)),filename = "graphs/fig_max_ratios.jpg",base_height = 7,bg = "white")

# restore previous base directory
setwd("../")
Loading