Skip to content

Commit

Permalink
refactor(utils.assign_layers): warn if more than 1% of reaches land i…
Browse files Browse the repository at this point in the history
…n inactive cells
  • Loading branch information
aleaf committed Aug 14, 2023
1 parent dfa6519 commit e4e60b8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sfrmaker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ def assign_layers(reach_data, botm_array,
i, j = reach_data.i.values, reach_data.j.values
streambed_botm = reach_data[strtop_col].values - reach_data[strthick_col].values
layers = get_layer(botm_array, i, j, streambed_botm - pad)
if idomain is not None:
active_frac = np.sum(idomain[layers, i, j] > 0)/len(i)
if active_frac < 0.99:
warnings.warn(f'{1-active_frac:.2%}of SFR reaches are in inactive cells. '
'Check the model idomain array and possibly the SFR '
'elevation and model length units for consistency.')


# check against model bottom
model_botm = botm_array[-1, i, j]
Expand Down

0 comments on commit e4e60b8

Please sign in to comment.