move snakemake object out of imap process functions
This commit is contained in:
parent
4e719b99a1
commit
ba6e0c2e4a
@ -102,6 +102,7 @@ def voronoi_partition_pts(points, outline):
|
||||
if not poly.is_valid:
|
||||
poly = poly.buffer(0)
|
||||
|
||||
with np.errstate(invalid="ignore"):
|
||||
poly = poly.intersection(outline)
|
||||
|
||||
polygons.append(poly)
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user