diff --git a/scripts/build_bus_regions.py b/scripts/build_bus_regions.py index 47bc9d4d..bbff2bc6 100644 --- a/scripts/build_bus_regions.py +++ b/scripts/build_bus_regions.py @@ -102,7 +102,8 @@ def voronoi_partition_pts(points, outline): if not poly.is_valid: poly = poly.buffer(0) - poly = poly.intersection(outline) + with np.errstate(invalid="ignore"): + poly = poly.intersection(outline) polygons.append(poly) diff --git a/scripts/build_energy_totals.py b/scripts/build_energy_totals.py index 949dbc30..72e268f9 100644 --- a/scripts/build_energy_totals.py +++ b/scripts/build_energy_totals.py @@ -196,9 +196,7 @@ def build_swiss(year): return df -def idees_per_country(ct, year): - base_dir = snakemake.input.idees - +def idees_per_country(ct, year, base_dir): ct_totals = {} ct_idees = idees_rename.get(ct, ct) @@ -401,7 +399,7 @@ def idees_per_country(ct, year): def build_idees(countries, year): nprocesses = snakemake.threads - func = partial(idees_per_country, year=year) + func = partial(idees_per_country, year=year, base_dir=snakemake.input.idees) tqdm_kwargs = dict( ascii=False, unit=" country", diff --git a/scripts/build_industrial_energy_demand_per_country_today.py b/scripts/build_industrial_energy_demand_per_country_today.py index 1f1cb474..e04dad1f 100644 --- a/scripts/build_industrial_energy_demand_per_country_today.py +++ b/scripts/build_industrial_energy_demand_per_country_today.py @@ -8,6 +8,7 @@ Build industrial energy demand per country. """ import multiprocessing as mp +from functools import partial import pandas as pd from tqdm import tqdm @@ -89,8 +90,7 @@ eu28 = [ jrc_names = {"GR": "EL", "GB": "UK"} -def industrial_energy_demand_per_country(country): - jrc_dir = snakemake.input.jrc +def industrial_energy_demand_per_country(country, jrc_dir): jrc_country = jrc_names.get(country, country) fn = f"{jrc_dir}/JRC-IDEES-2015_EnergyBalance_{jrc_country}.xlsx" @@ -179,7 +179,7 @@ def add_non_eu28_industrial_energy_demand(demand): def industrial_energy_demand(countries): nprocesses = snakemake.threads - func = industrial_energy_demand_per_country + func = partial(industrial_energy_demand_per_country, jrc_dir=snakemake.input.jrc) tqdm_kwargs = dict( ascii=False, unit=" country",