Skip to content

Commit

Permalink
Merge branch 'dev' into feature/#131-download-and-store-flow-foreign-…
Browse files Browse the repository at this point in the history
…countries
  • Loading branch information
CarlosEpia committed Oct 20, 2023
2 parents ee5e926 + 197cd7b commit 3044e43
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 25 deletions.
7 changes: 5 additions & 2 deletions src/egon/data/datasets/district_heating_areas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, dependencies):
super().__init__(
name="district-heating-areas",
# version=self.target_files + "_0.0",
version="0.0.3", # maybe rethink the naming
version="0.0.4", # maybe rethink the naming
dependencies=dependencies,
tasks=(create_tables, demarcation),
)
Expand Down Expand Up @@ -427,6 +427,7 @@ def area_grouping(
join,
join_2[
[
"zensus_population_id",
"residential_and_service_demand",
"geom_polygon",
"area_id",
Expand Down Expand Up @@ -672,7 +673,9 @@ def district_heating_areas(scenario_name, plotting=False):
f"""DELETE FROM demand.egon_district_heating_areas
WHERE scenario = '{scenario_name}'"""
)
areas_dissolved.reset_index().to_postgis(
areas_dissolved.reset_index().drop(
"zensus_population_id", axis="columns"
).to_postgis(
"egon_district_heating_areas",
schema="demand",
con=db.engine(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def generate_model_data_tasks(scenario_name):

super().__init__(
name="MotorizedIndividualTravel",
version="0.0.7",
version="0.0.8",
dependencies=dependencies,
tasks=tasks,
)
Original file line number Diff line number Diff line change
Expand Up @@ -734,33 +734,37 @@ def write_load(
# * load timeseries:
# * regular (flex): use driving load
# * lowflex: use dumb charging load
if write_lowflex_model is False:
emob_bus_id = write_bus(scenario_name=scenario_name)
write_link(scenario_name=scenario_name)
write_store(scenario_name=scenario_name)
write_load(
scenario_name=scenario_name,
connection_bus_id=emob_bus_id,
load_ts=(
hourly_load_time_series_df.driving_load_time_series.to_list() # noqa: E501
),
)
elif scenario_name=='status2019':
# * status2019: also dumb charging

if scenario_name=='status2019':
write_load(
scenario_name=scenario_name,
connection_bus_id=etrago_bus.bus_id,
load_ts=hourly_load_time_series_df.load_time_series.to_list(),
)
)
else:
# Get lowflex scenario name
lowflex_scenario_name = DATASET_CFG["scenario"]["lowflex"][
"names"
][scenario_name]
write_load(
scenario_name=lowflex_scenario_name,
connection_bus_id=etrago_bus.bus_id,
load_ts=hourly_load_time_series_df.load_time_series.to_list(),
)
if write_lowflex_model is False:
emob_bus_id = write_bus(scenario_name=scenario_name)
write_link(scenario_name=scenario_name)
write_store(scenario_name=scenario_name)
write_load(
scenario_name=scenario_name,
connection_bus_id=emob_bus_id,
load_ts=(
hourly_load_time_series_df.driving_load_time_series.to_list() # noqa: E501
),
)

else:
# Get lowflex scenario name
lowflex_scenario_name = DATASET_CFG["scenario"]["lowflex"][
"names"
][scenario_name]
write_load(
scenario_name=lowflex_scenario_name,
connection_bus_id=etrago_bus.bus_id,
load_ts=hourly_load_time_series_df.load_time_series.to_list(),
)

def write_to_file():
"""Write model data to file (for debugging purposes)"""
Expand Down

0 comments on commit 3044e43

Please sign in to comment.