Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reporting of Operation Life #37

Merged
merged 7 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/osemosys2iamc/resultify.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def make_plots(df: pyam.IamDataFrame, model: str, scenario: str, regions: List[s
if se:
locator = mdates.AutoDateLocator(minticks=10)
# locator.intervald['YEARLY'] = [10]
pe.plot.bar(ax=ax, stacked=True, title="Power generation mix %s" % region)
se.plot.bar(ax=ax, stacked=True, title="Power generation mix %s" % region)
plt.legend(bbox_to_anchor=(0.0, -0.5), loc="upper left")
plt.tight_layout()
ax.xaxis.set_major_locator(locator)
Expand Down Expand Up @@ -408,15 +408,26 @@ def main(config: Dict, inputs_path: str, results_path: str) -> pyam.IamDataFrame
Path to a folder of CSV files (OSeMOSYS results)
"""
blob = []
filename = os.path.join(inputs_path, "YEAR.csv")
years = pd.read_csv(filename)

try:
for input in config["inputs"]:

inputs = read_file(inputs_path, input["osemosys_param"], config["region"])

unit = input["unit"]

technologies = input["variable_cost"]
data = filter_capacity(inputs, technologies)
if "variable_cost" in input.keys():
technologies = input["variable_cost"]
data = filter_capacity(inputs, technologies)
elif "reg_tech_param" in input.keys():
technologies = input["reg_tech_param"]
data = filter_technologies(inputs, technologies)
list_years = years["VALUE"]
data["YEAR"] = [list_years] * len(data)
data = data.explode("YEAR").reset_index(drop=True)
data = data.drop(["TECHNOLOGY"], axis=1)

if not data.empty:
data = data.rename(
Expand Down Expand Up @@ -522,6 +533,7 @@ def main(config: Dict, inputs_path: str, results_path: str) -> pyam.IamDataFrame
all_data = all_data.convert_unit("PJ/yr", to="EJ/yr")
all_data = all_data.convert_unit("ktCO2/yr", to="Mt CO2/yr", factor=0.001)
all_data = all_data.convert_unit("MEUR_2015/PJ", to="EUR_2020/GJ", factor=1.05)
all_data = all_data.convert_unit("MEUR_2015/GW", to="EUR_2020/kW", factor=1.05)
all_data = all_data.convert_unit("kt CO2/yr", to="Mt CO2/yr")

all_data = pyam.IamDataFrame(all_data)
Expand Down
24 changes: 24 additions & 0 deletions tests/fixtures/YEAR.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
VALUE
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
24 changes: 24 additions & 0 deletions tests/fixtures/trade/YEAR.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
VALUE
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
Loading