File tree 1 file changed +3
-2
lines changed
message_ix_models/model/water/data
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -229,12 +229,13 @@ def relax_growth_constraint(
229
229
230
230
# In max_year_hist add the next year from years matching the hist_year columns
231
231
max_year_hist ["next_year" ] = max_year_hist ["hist_year" ].apply (
232
- lambda x : years [years > x ][0 ]
232
+ lambda x : years [years > x ][0 ] if any ( years > x ) else None
233
233
)
234
234
235
235
# Merge the max_year_hist with bound_up_pare
236
236
bound_up = pd .merge (bound_up_pare , max_year_hist , how = "left" )
237
- # Look at years just after the historical year
237
+ # subset of first year after the historical
238
+ # if next_year = None (single year test case) bound_up1 is simply empty
238
239
bound_up1 = bound_up [bound_up [year_type ] == bound_up ["next_year" ]]
239
240
# Categories that might break the growth constraints
240
241
bound_up1 = bound_up1 [bound_up1 ["value" ] < 0.9 * bound_up1 ["hist_value" ]]
You can’t perform that action at this time.
0 commit comments