Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve data for the residential sector #6

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cjest-data

.snakemake/
data
01-energy-utility.ipynb
02-census.ipynb
puma_maps.ipynb
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
77 changes: 77 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
configfile: "config.yml"

from pathlib import Path
env_file = Path("./.env").resolve()
from dotenv import load_dotenv
load_dotenv(str(env_file))

rule targets:
input:
sfa = "data/timeseries/residential_load.csv",
res_structures = "data/residential_buildings.csv",
rates = "data/usrdb_rates.csv",
project_sunroof = f"data/spatial_data/project-sunroof-census_tract.csv",
dag = "dag.png"

rule retrieve_spatial_lut:
output:
spatial_lut = "data/spatial_data/spatial_lut.csv"
script: "scripts/retrieve_lut.py"

rule retrieve_census_data:
output:
census_data = "data/spatial_data/county_census_data.gpkg",
state_blockgroups = f"data/spatial_data/{config['state'].lower()}_blockgroups.gpkg",
county_blockgroups = f"data/spatial_data/{config['county'].lower()}_blockgroups.gpkg"
script: "scripts/retrieve_census_data.py"

rule retrieve_project_sunroof:
input:
blockgroups = f"data/spatial_data/{config['state'].lower()}_blockgroups.gpkg"
output:
project_sunroof = "data/spatial_data/project-sunroof-census_tract.csv",
local_potential = f"data/spatial_data/{config['state'].lower()}_rooftop_potential.gpkg"
script: "scripts/retrieve_project_sunroof.py"

# a bespoke step to make this analysis specific to armourdale
rule retrieve_armourdale_shape:
output:
armourdale = "data/spatial_data/armourdale_shape.gpkg"
script: "scripts/retrieve_armourdale.py"

rule retrieve_electric_utility:
input:
cutout="data/spatial_data/armourdale_shape.gpkg"
output:
utility="data/spatial_data/electric_utility.gpkg"
script: "scripts/retrieve_electric_utility.py"

rule retrieve_usrdb:
input:
utility="data/spatial_data/electric_utility.gpkg"
output:
rates="data/usrdb_rates.csv"
script: "scripts/retrieve_usrdb.py"

rule calculate_res_structures:
input:
census_data = "data/spatial_data/county_census_data.gpkg",
armourdale = "data/spatial_data/armourdale_shape.gpkg"
output:
res_structures = "data/residential_buildings.csv"
script: "scripts/calculate_res_structures.py"

rule retrieve_res_load:
input:
spatial_lut = "data/spatial_data/spatial_lut.csv",
res_structures = "data/residential_buildings.csv"
output:
sfa = "data/timeseries/residential_load.csv"
script: "scripts/retrieve_res_load.py"

rule build_dag:
input: "Snakefile"
output:
"dag.png"
shell:
"snakemake --dag | dot -Tpng > {output}"
33 changes: 33 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# geographic data
state: 'Kansas'
county: 'Wyandotte'

# historical data
census_year: 2020
census_level: 'tract'
usrdb_start_date: "2024-07-23" # today?
usrdb_future_date: "2099-01-01" # some date in the future, replaces NaT values

# building data options
building_data_options:
resstock_year: 2021 # DO NOT CHANGE
comstock_year: 2021 # DO NOT CHANGE
weather_version: "tmy3" # or "amy2018"
release_version: 1
building_types:
residential:
- multi-family_with_2_-_4_units
- multi-family_with_5plus_units
- single-family_attached
- single-family_detached
- mobile_home

energy_sectors:
- residential
# - commercial # pending implementation
# - industrial # pending data availability
samgdotson marked this conversation as resolved.
Show resolved Hide resolved
samgdotson marked this conversation as resolved.
Show resolved Hide resolved


# geographic options
geographic_crs: 4326 # for using lat/lon; EPSG code
projected_crs: 5070 # for doing calculations; EPSG code
Binary file added dag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
348 changes: 346 additions & 2 deletions notebooks/01-energy-utility.ipynb

Large diffs are not rendered by default.

Loading