Skip to content

Commit

Permalink
set static crop prices for all regions if set
Browse files Browse the repository at this point in the history
  • Loading branch information
jensdebruijn committed Nov 13, 2024
1 parent e1e0059 commit 9a4d2d7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions geb/agents/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,18 @@ def crop_prices(self) -> np.ndarray:
):
return self.get_modelled_crop_prices()
else:
index = self._crop_prices[0].get(self.model.current_time)
return self._crop_prices[1][index]
if self._crop_prices[0] is None:
print("WARNING: Using static crop prices")
return np.full(
(
len(self.cumulative_inflation_per_region),
len(self.agents.crop_farmers.crop_ids),
),
self._crop_prices[1],
)
else:
index = self._crop_prices[0].get(self.model.current_time)
return self._crop_prices[1][index]

@property
def year_index(self) -> int:
Expand Down

0 comments on commit 9a4d2d7

Please sign in to comment.