Fix up add_nice_carrier_names for new pandas (#178)
* solve #174 * update release notes Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
This commit is contained in:
parent
2f4852347a
commit
1cde8d300a
@ -15,8 +15,11 @@ Upcoming Release
|
||||
|
||||
* Add compatibility for pyomo 5.7.0 in :mod:`cluster_network` and :mod:`simplify_network`.
|
||||
|
||||
* Raise a warning if `tech_colors` in the config are not defined for all carriers.
|
||||
|
||||
* Corrected HVDC link connections (a) between Norway and Denmark and (b) mainland Italy, Corsica (FR) and Sardinia (IT) (`#181 <https://github.com/PyPSA/pypsa-eur/pull/181>`_)
|
||||
|
||||
|
||||
PyPSA-Eur 0.2.0 (8th June 2020)
|
||||
==================================
|
||||
|
||||
|
@ -506,10 +506,16 @@ def estimate_renewable_capacities(n, tech_map=None):
|
||||
|
||||
def add_nice_carrier_names(n, config=None):
|
||||
if config is None: config = snakemake.config
|
||||
nice_names = pd.Series(config['plotting']['nice_names'])
|
||||
n.carriers['nice_name'] = nice_names[n.carriers.index]
|
||||
colors = pd.Series(config['plotting']['tech_colors'])
|
||||
n.carriers['color'] = colors[n.carriers.index]
|
||||
carrier_i = n.carriers.index
|
||||
nice_names = (pd.Series(config['plotting']['nice_names'])
|
||||
.reindex(carrier_i).fillna(carrier_i.to_series().str.title()))
|
||||
n.carriers['nice_name'] = nice_names
|
||||
colors = pd.Series(config['plotting']['tech_colors']).reindex(carrier_i)
|
||||
if colors.isna().any():
|
||||
missing_i = list(colors.index[colors.isna()])
|
||||
logger.warning(f'tech_colors for carriers {missing_i} not defined '
|
||||
'in config.')
|
||||
n.carriers['color'] = colors
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user