[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-02-10 16:22:36 +00:00
parent 6de08bd523
commit e838b63ded
9 changed files with 67 additions and 44 deletions

View File

@ -401,18 +401,22 @@ rule add_electricity:
if str(fn).startswith("data/")
},
base_network=resources("networks/base.nc"),
line_rating=resources("networks/line_rating.nc")
line_rating=(
resources("networks/line_rating.nc")
if config["lines"]["dynamic_line_rating"]["activate"]
else resources("networks/base.nc"),
else resources("networks/base.nc")
),
tech_costs=COSTS,
regions=resources("regions_onshore.geojson"),
powerplants=resources("powerplants.csv"),
hydro_capacities=ancient("data/bundle/hydro_capacities.csv"),
geth_hydro_capacities="data/geth2015_hydro_capacities.csv",
unit_commitment="data/unit_commitment.csv",
fuel_price=resources("monthly_fuel_price.csv")
fuel_price=(
resources("monthly_fuel_price.csv")
if config["conventional"]["dynamic_fuel_price"]
else [],
else []
),
load=resources("load.csv"),
nuts3_shapes=resources("nuts3_shapes.geojson"),
ua_md_gdp="data/GDP_PPP_30arcsec_v3_mapped_default.csv",
@ -540,7 +544,8 @@ rule prepare_network:
snapshots={
"resolution": config["snapshots"].get("resolution", False),
"segmentation": config["snapshots"].get("segmentation", False),
}, # TODO: use config provider
},
# TODO: use config provider
links=config_provider("links"),
lines=config_provider("lines"),
co2base=config_provider("electricity", "co2base"),

View File

@ -94,7 +94,9 @@ rule build_gas_input_locations:
regions_offshore=resources("regions_offshore_elec_s{simpl}_{clusters}.geojson"),
output:
gas_input_nodes=resources("gas_input_locations_s{simpl}_{clusters}.geojson"),
gas_input_nodes_simplified=resources("gas_input_locations_s{simpl}_{clusters}_simplified.csv"),
gas_input_nodes_simplified=resources(
"gas_input_locations_s{simpl}_{clusters}_simplified.csv"
),
resources:
mem_mb=2000,
log:
@ -287,7 +289,9 @@ rule build_biomass_potentials:
biomass_potentials_all=resources(
"biomass_potentials_all_s{simpl}_{clusters}_{planning_horizons}.csv"
),
biomass_potentials=resources("biomass_potentials_s{simpl}_{clusters}_{planning_horizons}.csv"),
biomass_potentials=resources(
"biomass_potentials_s{simpl}_{clusters}_{planning_horizons}.csv"
),
threads: 1
resources:
mem_mb=1000,
@ -814,7 +818,9 @@ rule prepare_sector_network:
network=resources("networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"),
energy_totals_name=resources("energy_totals.csv"),
eurostat=input_eurostat,
pop_weighted_energy_totals=resources("pop_weighted_energy_totals_s{simpl}_{clusters}.csv"),
pop_weighted_energy_totals=resources(
"pop_weighted_energy_totals_s{simpl}_{clusters}.csv"
),
shipping_demand=resources("shipping_demand_s{simpl}_{clusters}.csv"),
transport_demand=resources("transport_demand_s{simpl}_{clusters}.csv"),
transport_data=resources("transport_data_s{simpl}_{clusters}.csv"),
@ -823,10 +829,14 @@ rule prepare_sector_network:
co2_totals_name=resources("co2_totals.csv"),
co2="data/bundle-sector/eea/UNFCCC_v23.csv",
biomass_potentials=(
resources("biomass_potentials_s{simpl}_{clusters}_"
+ "{}.csv".format(config["biomass"]["year"]))
resources(
"biomass_potentials_s{simpl}_{clusters}_"
+ "{}.csv".format(config["biomass"]["year"])
)
if config["foresight"] == "overnight"
else resources("biomass_potentials_s{simpl}_{clusters}_{planning_horizons}.csv")
else resources(
"biomass_potentials_s{simpl}_{clusters}_{planning_horizons}.csv"
)
),
costs=(
"data/costs_{}.csv".format(config["costs"]["year"])
@ -840,9 +850,15 @@ rule prepare_sector_network:
busmap=resources("busmap_elec_s{simpl}_{clusters}.csv"),
clustered_pop_layout=resources("pop_layout_elec_s{simpl}_{clusters}.csv"),
simplified_pop_layout=resources("pop_layout_elec_s{simpl}.csv"),
industrial_demand=resources("industrial_energy_demand_elec_s{simpl}_{clusters}_{planning_horizons}.csv"),
hourly_heat_demand_total=resources("hourly_heat_demand_total_elec_s{simpl}_{clusters}.nc"),
district_heat_share=resources("district_heat_share_elec_s{simpl}_{clusters}_{planning_horizons}.csv"),
industrial_demand=resources(
"industrial_energy_demand_elec_s{simpl}_{clusters}_{planning_horizons}.csv"
),
hourly_heat_demand_total=resources(
"hourly_heat_demand_total_elec_s{simpl}_{clusters}.nc"
),
district_heat_share=resources(
"district_heat_share_elec_s{simpl}_{clusters}_{planning_horizons}.csv"
),
temp_soil_total=resources("temp_soil_total_elec_s{simpl}_{clusters}.nc"),
temp_soil_rural=resources("temp_soil_rural_elec_s{simpl}_{clusters}.nc"),
temp_soil_urban=resources("temp_soil_urban_elec_s{simpl}_{clusters}.nc"),

View File

@ -24,7 +24,7 @@ rule cluster_networks:
expand(
resources("networks/elec_s{simpl}_{clusters}.nc"),
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
@ -33,7 +33,7 @@ rule extra_components_networks:
expand(
resources("networks/elec_s{simpl}_{clusters}_ec.nc"),
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
@ -42,7 +42,7 @@ rule prepare_elec_networks:
expand(
resources("networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"),
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
@ -52,7 +52,7 @@ rule prepare_sector_networks:
RESULTS
+ "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
@ -61,7 +61,7 @@ rule solve_elec_networks:
expand(
RESULTS + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
@ -71,7 +71,7 @@ rule solve_sector_networks:
RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
@ -81,7 +81,7 @@ rule solve_sector_networks_perfect:
RESULTS
+ "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-costs-all_{planning_horizons}.pdf",
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
@ -91,12 +91,12 @@ rule validate_elec_networks:
RESULTS
+ "figures/.statistics_plots_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}",
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
expand(
RESULTS
+ "figures/.validation_{kind}_plots_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}",
**config["scenario"],
run=config["run"]["name"],
kind=["production", "prices", "cross_border"]
kind=["production", "prices", "cross_border"],
),

View File

@ -174,7 +174,7 @@ rule make_summary:
RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
costs=(
"data/costs_{}.csv".format(config["costs"]["year"])
@ -189,7 +189,7 @@ rule make_summary:
RESULTS
+ "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-costs-all_{planning_horizons}.pdf",
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
h2_plot=expand(
(
@ -199,7 +199,7 @@ rule make_summary:
else []
),
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
ch4_plot=expand(
(
@ -209,7 +209,7 @@ rule make_summary:
else []
),
**config["scenario"],
run=config["run"]["name"]
run=config["run"]["name"],
),
output:
nodal_costs=RESULTS + "csvs/nodal_costs.csv",

View File

@ -21,7 +21,9 @@ rule add_existing_baseyear:
),
cop_soil_total=resources("cop_soil_total_elec_s{simpl}_{clusters}.nc"),
cop_air_total=resources("cop_air_total_elec_s{simpl}_{clusters}.nc"),
existing_heating_distribution=resources("existing_heating_distribution_elec_s{simpl}_{clusters}_{planning_horizons}.csv"),
existing_heating_distribution=resources(
"existing_heating_distribution_elec_s{simpl}_{clusters}_{planning_horizons}.csv"
),
existing_solar="data/existing_infrastructure/solar_capacity_IRENA.csv",
existing_onwind="data/existing_infrastructure/onwind_capacity_IRENA.csv",
existing_offwind="data/existing_infrastructure/offwind_capacity_IRENA.csv",

View File

@ -133,7 +133,7 @@ import numpy as np
import pandas as pd
import pypsa
import seaborn as sns
from _helpers import configure_logging, update_p_nom_max, set_scenario_config
from _helpers import configure_logging, set_scenario_config, update_p_nom_max
from add_electricity import load_costs
from packaging.version import Version, parse
from pypsa.clustering.spatial import (

View File

@ -18,7 +18,7 @@ import numpy as np
import pandas as pd
import pypsa
import xarray as xr
from _helpers import update_config_with_sector_opts, set_scenario_config
from _helpers import set_scenario_config, update_config_with_sector_opts
from add_electricity import calculate_annuity, sanitize_carriers, sanitize_locations
from build_energy_totals import build_co2_totals, build_eea_co2, build_eurostat_co2
from networkx.algorithms import complement

View File

@ -13,8 +13,8 @@ from pathlib import Path
from _helpers import (
configure_logging,
progress_retrieve,
validate_checksum,
set_scenario_config,
validate_checksum,
)
logger = logging.getLogger(__name__)

View File

@ -40,8 +40,8 @@ from _benchmark import memory_logger
from _helpers import (
configure_logging,
get_opt,
update_config_with_sector_opts,
set_scenario_config,
update_config_with_sector_opts,
)
from pypsa.descriptors import get_activity_mask
from pypsa.descriptors import get_switchable_as_dense as get_as_dense