Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions imod/msw/coupler_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ def _create_mod_id_rch(
"""
mod_id = xr.full_like(svat, fill_value=0, dtype=np.int64)
n_subunit = svat["subunit"].size

n_mod_top = idomain_top_active.sum()
# Sum active cells and convert to int for MyPy. This is the number of
# modflow cells in the top layer.
n_mod_top = int(idomain_top_active.sum().item())

# idomain does not have a subunit dimension, so tile for n_subunits
mod_id_1d: IntArray = np.tile(np.arange(1, n_mod_top + 1), (n_subunit, 1))
Expand Down Expand Up @@ -124,8 +125,9 @@ def _create_well_id(
well_layer = well_cellid.sel(dim_cellid="layer").data
well_row = well_cellid.sel(dim_cellid="row").data - 1
well_column = well_cellid.sel(dim_cellid="column").data - 1

n_mod = idomain_active.sum()
# Sum active cells and convert to int for MyPy. This is the number of
# modflow cells in the top layer.
n_mod = int(idomain_active.sum().item())
mod_id = xr.full_like(idomain_active, 0, dtype=np.int64)
mod_id.data[idomain_active.data] = np.arange(1, n_mod + 1)

Expand Down
32 changes: 16 additions & 16 deletions imod/select/cross_sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ def _cross_section(data, linecoords):
else:
ys[1:] += np.abs(dy_a).cumsum()

ixs = []
iys = []
sdxs = []
sdys = []
segments_list = []
ixs_ls = []
iys_ls = []
sdxs_ls = []
sdys_ls = []
segments_ls = []

bounding_box = _bounding_box(xmin, xmax, ymin, ymax)
for start, end in zip(linecoords[:-1], linecoords[1:]):
Expand All @@ -298,21 +298,21 @@ def _cross_section(data, linecoords):
sdy = np.array([-1])
segment_length = np.array([linestring.length])

ixs.append(i)
iys.append(j)
sdxs.append(sdx)
sdys.append(sdy)
segments_list.append(segment_length)
ixs_ls.append(i)
iys_ls.append(j)
sdxs_ls.append(sdx)
sdys_ls.append(sdy)
segments_ls.append(segment_length)

if len(ixs) == 0:
if len(ixs_ls) == 0:
raise ValueError("Linestring does not intersect data")

# Concatenate into a single array
ixs = np.concatenate(ixs)
iys = np.concatenate(iys)
sdxs = np.concatenate(sdxs)
sdys = np.concatenate(sdys)
segments = np.concatenate(segments_list)
ixs = np.concatenate(ixs_ls)
iys = np.concatenate(iys_ls)
sdxs = np.concatenate(sdxs_ls)
sdys = np.concatenate(sdys_ls)
segments = np.concatenate(segments_ls)

# Flip around indexes
if x_decreasing:
Expand Down
Loading