Skip to content

Commit 8cb5b3f

Browse files
committed
Fix outputs - save data for investment year
1 parent 64b088e commit 8cb5b3f

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/muse/mca.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,9 @@ def run(self) -> None:
325325
)
326326

327327
# Global outputs
328-
self.outputs(self.market, self.sectors, year=self.time_framework[year_idx]) # type: ignore
329-
self.outputs_cache.consolidate_cache(year=self.time_framework[year_idx])
328+
investment_year = years[1]
329+
self.outputs(self.market, self.sectors, year=investment_year)
330+
self.outputs_cache.consolidate_cache(year=investment_year)
330331

331332
getLogger(__name__).info(
332333
f"Finished simulation period {years[0]} to {years[1]} "

src/muse/outputs/sector.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ def _factory(
102102
quantities = [_quantity_factory(param, registry) for param in params]
103103
sinks = [sink_factory(param, sector_name=sector_name) for param in params]
104104

105-
def save_multiple_outputs(market, *args, year: int | None = None) -> list[Any]:
106-
if year is None:
107-
year = int(market.year.min())
108-
105+
def save_multiple_outputs(market, *args, year: int) -> list[Any]:
109106
return [
110107
sink(quantity(market, *args), year=year)
111108
for quantity, sink in zip(quantities, sinks)

src/muse/sectors/sector.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ def group_assets(x: xr.DataArray) -> xr.DataArray:
277277

278278
def save_outputs(self) -> None:
279279
"""Calls the outputs function with the current output data."""
280-
self.outputs(self.output_data, self.capacity)
280+
investment_year = self.output_data.year.values[1]
281+
self.outputs(self.output_data, self.capacity, year=investment_year)
281282

282283
def market_variables(self, market: xr.Dataset, technologies: xr.Dataset) -> Any:
283284
"""Computes resulting market: production, consumption, and costs."""

0 commit comments

Comments
 (0)