handle absent ammonia config flag

This commit is contained in:
Fabian Neumann 2022-06-22 15:50:32 +02:00
parent 4ecfccea6c
commit 37c052667a

View File

@ -96,7 +96,7 @@ def define_spatial(nodes, options):
# ammonia # ammonia
spatial.ammonia = SimpleNamespace() spatial.ammonia = SimpleNamespace()
if options["ammonia"] == "regional": if options.get("ammonia") == "regional":
spatial.ammonia.nodes = nodes + " NH3" spatial.ammonia.nodes = nodes + " NH3"
spatial.ammonia.locations = nodes spatial.ammonia.locations = nodes
else: else:
@ -2215,7 +2215,7 @@ def add_industry(n, costs):
lifetime=costs.at['cement capture', 'lifetime'] lifetime=costs.at['cement capture', 'lifetime']
) )
if options["ammonia"]: if options.get("ammonia"):
if options["ammonia"] == 'regional': if options["ammonia"] == 'regional':
p_set = industrial_demand.loc[spatial.ammonia.locations, "ammonia"].rename(index=lambda x: x + " NH3") / 8760 p_set = industrial_demand.loc[spatial.ammonia.locations, "ammonia"].rename(index=lambda x: x + " NH3") / 8760