adjust functions to new default lifetime np.inf instead of previous NaN
This commit is contained in:
parent
372473d76c
commit
953e1c883e
@ -8,6 +8,7 @@ idx = pd.IndexSlice
|
|||||||
|
|
||||||
import pypsa
|
import pypsa
|
||||||
import yaml
|
import yaml
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
from add_existing_baseyear import add_build_year_to_new_assets
|
from add_existing_baseyear import add_build_year_to_new_assets
|
||||||
from helper import override_component_attrs
|
from helper import override_component_attrs
|
||||||
@ -25,7 +26,7 @@ def add_brownfield(n, n_p, year):
|
|||||||
# CO2 or global EU values since these are already in n
|
# CO2 or global EU values since these are already in n
|
||||||
n_p.mremove(
|
n_p.mremove(
|
||||||
c.name,
|
c.name,
|
||||||
c.df.index[c.df.lifetime.isna()]
|
c.df.index[c.df.lifetime==np.inf]
|
||||||
)
|
)
|
||||||
|
|
||||||
# remove assets whose build_year + lifetime < year
|
# remove assets whose build_year + lifetime < year
|
||||||
|
@ -28,7 +28,7 @@ def add_build_year_to_new_assets(n, baseyear):
|
|||||||
# Give assets with lifetimes and no build year the build year baseyear
|
# Give assets with lifetimes and no build year the build year baseyear
|
||||||
for c in n.iterate_components(["Link", "Generator", "Store"]):
|
for c in n.iterate_components(["Link", "Generator", "Store"]):
|
||||||
|
|
||||||
assets = c.df.index[~c.df.lifetime.isna() & c.df.build_year==0]
|
assets = c.df.index[(c.df.lifetime!=np.inf) & (c.df.build_year==0)]
|
||||||
c.df.loc[assets, "build_year"] = baseyear
|
c.df.loc[assets, "build_year"] = baseyear
|
||||||
|
|
||||||
# add -baseyear to name
|
# add -baseyear to name
|
||||||
|
Loading…
Reference in New Issue
Block a user