convert param back to config for "logging" and "run", made "enable" more specific

This commit is contained in:
virio-andreyana 2023-05-17 18:43:30 +02:00 committed by GitHub
parent 61893c3c9b
commit 8208ac033b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 19 additions and 41 deletions

View File

@ -201,7 +201,6 @@ rule build_ship_raster:
rule build_renewable_profiles:
params:
run=config["run"],
renewable=config["renewable"],
input:
base_network=RESOURCES + "networks/base.nc",
@ -350,7 +349,7 @@ rule cluster_network:
lines=config["lines"],
renewable=config["renewable"],
clustering=config["clustering"],
enable=config["enable"],
enable=config["enable"].get("custom_busmap", False),
input:
network=RESOURCES + "networks/elec_s{simpl}.nc",
regions_onshore=RESOURCES + "regions_onshore_elec_s{simpl}.geojson",

View File

@ -4,8 +4,6 @@
rule build_population_layouts:
params:
logging=config["logging"],
input:
nuts3_shapes=RESOURCES + "nuts3_shapes.geojson",
urban_percent="data/urban_percent.csv",
@ -72,8 +70,6 @@ rule build_simplified_population_layouts:
if config["sector"]["gas_network"] or config["sector"]["H2_retrofit"]:
rule build_gas_network:
params:
logging=config["logging"],
input:
gas_network="data/gas_network/scigrid-gas/data/IGGIELGN_PipeSegments.geojson",
output:
@ -88,8 +84,6 @@ if config["sector"]["gas_network"] or config["sector"]["H2_retrofit"]:
"../scripts/build_gas_network.py"
rule build_gas_input_locations:
params:
logging=config["logging"],
input:
lng=HTTP.remote(
"https://globalenergymonitor.org/wp-content/uploads/2022/09/Europe-Gas-Tracker-August-2022.xlsx",
@ -116,8 +110,6 @@ if config["sector"]["gas_network"] or config["sector"]["H2_retrofit"]:
"../scripts/build_gas_input_locations.py"
rule cluster_gas_network:
params:
logging=config["logging"],
input:
cleaned_gas_network=RESOURCES + "gas_network.csv",
regions_onshore=RESOURCES
@ -246,10 +238,8 @@ rule build_solar_thermal_profiles:
rule build_energy_totals:
params:
run=config["run"],
countries=config["countries"],
energy=config["energy"],
logging=config["logging"],
input:
nuts3_shapes=RESOURCES + "nuts3_shapes.geojson",
co2="data/eea/UNFCCC_v23.csv",
@ -437,10 +427,8 @@ rule build_industry_sector_ratios:
rule build_industrial_production_per_country:
params:
run=config["run"],
industry=config["industry"],
countries=config["countries"],
logging=config["logging"],
input:
ammonia_production=RESOURCES + "ammonia_production.csv",
jrc="data/jrc-idees-2015",
@ -491,7 +479,6 @@ rule build_industrial_distribution_key:
params:
industry=config["industry"],
countries=config["countries"],
logging=config["logging"],
input:
regions_onshore=RESOURCES + "regions_onshore_elec_s{simpl}_{clusters}.geojson",
clustered_pop_layout=RESOURCES + "pop_layout_elec_s{simpl}_{clusters}.csv",
@ -567,7 +554,6 @@ rule build_industrial_energy_demand_per_node:
rule build_industrial_energy_demand_per_country_today:
params:
run=config["run"],
countries=config["countries"],
industry=config["industry"],
input:
@ -723,7 +709,6 @@ rule prepare_sector_network:
existing_capacities=config["existing_capacities"],
foresight=config["foresight"],
costs=config["costs"],
logging=config["logging"],
sector=config["sector"],
industry=config["industry"],
pypsa_eur=config["pypsa_eur"],

View File

@ -10,7 +10,6 @@ localrules:
rule plot_network:
params:
logging=config["logging"],
foresight=config["foresight"],
plotting=config["plotting"],
input:
@ -74,7 +73,6 @@ rule make_summary:
foresight=config["foresight"],
costs=config["costs"],
snapshots=config["snapshots"],
logging=config["logging"],
scenario=config["scenario"],
RDIR=RDIR,
input:
@ -123,7 +121,6 @@ rule make_summary:
rule plot_summary:
params:
logging=config["logging"],
countries=config["countries"],
scenario=config["scenario"],
plotting=config["plotting"],

View File

@ -20,7 +20,6 @@ if config["enable"].get("retrieve_databundle", True):
rule retrieve_databundle:
params:
run=config["run"],
tutorial=config["tutorial"],
output:
expand("data/bundle/{file}", file=datafiles),

View File

@ -7,7 +7,6 @@ rule add_existing_baseyear:
params:
scenario=config["scenario"],
sector=config["sector"],
logging=config["logging"],
existing_capacities=config["existing_capacities"],
costs=config["costs"],
input:
@ -49,7 +48,6 @@ rule add_existing_baseyear:
rule add_brownfield:
params:
logging=config["logging"],
sector=config["sector"],
existing_capacities=config["existing_capacities"],
input:

View File

@ -139,7 +139,7 @@ if __name__ == "__main__":
planning_horizons=2030,
)
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
update_config_with_sector_opts(snakemake.config, snakemake.wildcards.sector_opts)

View File

@ -608,7 +608,7 @@ if __name__ == "__main__":
planning_horizons=2020,
)
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
update_config_with_sector_opts(snakemake.config, snakemake.wildcards.sector_opts)

View File

@ -373,7 +373,7 @@ def idees_per_country(ct, year, base_dir):
def build_idees(countries, year):
nprocesses = snakemake.threads
disable_progress = snakemake.params["run"].get("disable_progressbar", False)
disable_progress = snakemake.config["run"].get("disable_progressbar", False)
func = partial(idees_per_country, year=year, base_dir=snakemake.input.idees)
tqdm_kwargs = dict(
@ -735,7 +735,7 @@ if __name__ == "__main__":
snakemake = mock_snakemake("build_energy_totals")
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
config = snakemake.params["energy"]

View File

@ -86,7 +86,7 @@ if __name__ == "__main__":
clusters="37",
)
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
regions = load_bus_regions(
snakemake.input.regions_onshore, snakemake.input.regions_offshore

View File

@ -147,7 +147,7 @@ if __name__ == "__main__":
snakemake = mock_snakemake("build_gas_network")
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
gas_network = load_dataset(snakemake.input.gas_network)

View File

@ -141,7 +141,7 @@ if __name__ == "__main__":
clusters=48,
)
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
countries = snakemake.params["countries"]

View File

@ -153,7 +153,7 @@ def add_non_eu28_industrial_energy_demand(countries, demand):
def industrial_energy_demand(countries, year):
nprocesses = snakemake.threads
disable_progress = snakemake.params["run"].get("disable_progressbar", False)
disable_progress = snakemake.config["run"].get("disable_progressbar", False)
func = partial(
industrial_energy_demand_per_country, year=year, jrc_dir=snakemake.input.jrc
)

View File

@ -217,7 +217,7 @@ def industry_production_per_country(country, year, eurostat_dir, jrc_dir):
def industry_production(countries, year, eurostat_dir, jrc_dir):
nprocesses = snakemake.threads
disable_progress = snakemake.params["run"].get("disable_progressbar", False)
disable_progress = snakemake.config["run"].get("disable_progressbar", False)
func = partial(
industry_production_per_country,
@ -277,7 +277,7 @@ if __name__ == "__main__":
snakemake = mock_snakemake("build_industrial_production_per_country")
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
countries = snakemake.params["countries"]

View File

@ -23,7 +23,7 @@ if __name__ == "__main__":
snakemake = mock_snakemake("build_population_layouts")
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
cutout = atlite.Cutout(snakemake.input.cutout)

View File

@ -203,7 +203,7 @@ if __name__ == "__main__":
configure_logging(snakemake)
nprocesses = int(snakemake.threads)
noprogress = snakemake.params["run"].get("disable_progressbar", True)
noprogress = snakemake.config["run"].get("disable_progressbar", True)
config = snakemake.params["renewable"][snakemake.wildcards.technology]
resource = config["resource"] # pv panel config / wind turbine config
correction_factor = config.get("correction_factor", 1.0)

View File

@ -110,7 +110,7 @@ if __name__ == "__main__":
snakemake = mock_snakemake("cluster_gas_network", simpl="", clusters="37")
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
fn = snakemake.input.cleaned_gas_network
df = pd.read_csv(fn, index_col=0)

View File

@ -682,7 +682,7 @@ if __name__ == "__main__":
snakemake = mock_snakemake("make_summary")
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
networks_dict = {
(cluster, ll, opt + sector_opt, planning_horizon): "results/"

View File

@ -930,7 +930,7 @@ if __name__ == "__main__":
planning_horizons="2030",
)
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
overrides = override_component_attrs(snakemake.input.overrides)
n = pypsa.Network(snakemake.input.network, override_component_attrs=overrides)

View File

@ -545,7 +545,7 @@ if __name__ == "__main__":
snakemake = mock_snakemake("plot_summary")
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
n_header = 4

View File

@ -3266,7 +3266,7 @@ if __name__ == "__main__":
planning_horizons="2030",
)
logging.basicConfig(level=snakemake.params["logging"]["level"])
logging.basicConfig(level=snakemake.config["logging"]["level"])
update_config_with_sector_opts(snakemake.config, snakemake.wildcards.sector_opts)

View File

@ -63,7 +63,7 @@ if __name__ == "__main__":
to_fn = Path(f"{rootpath}/data")
logger.info(f"Downloading databundle from '{url}'.")
disable_progress = snakemake.params["run"].get("disable_progressbar", False)
disable_progress = snakemake.config["run"].get("disable_progressbar", False)
progress_retrieve(url, tarball_fn, disable=disable_progress)
logger.info("Extracting databundle.")