Skip to content

Commit

Permalink
removed unused import statement; fixed return bug and added exception…
Browse files Browse the repository at this point in the history
… case for fill_cells~_vertically()
  • Loading branch information
maxlin50 committed Feb 14, 2025
1 parent cf49f06 commit 2b9d29c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mfsetup/discretization.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ def fill_cells_vertically(top, botm):
-------
top, botm : filled top and botm arrays
"""
# check for nans in "top" array, if any nans exist, raise an error
# nans in top array could have unexpected effects
if np.isnan(top).any():
raise ValueError("Error: The top array contains NaN values. Ensure these are defined to prevent unintended results.")

thickness = get_layer_thicknesses(top, botm)
assert np.all(np.isnan(thickness[np.isnan(thickness)]))
thickness[np.isnan(thickness)] = 0
Expand All @@ -271,7 +276,7 @@ def fill_cells_vertically(top, botm):
filled += np.nanmin(all_surfaces, axis=0) # botm[-1]
# append the model bottom elevations
filled = np.append(filled, [np.nanmin(all_surfaces, axis=0)], axis=0)
return filled[1:].copy()
return top, filled[1:].copy()


def fix_model_layer_conflicts(top_array, botm_array,
Expand Down

0 comments on commit 2b9d29c

Please sign in to comment.