Skip to content

Commit ec2440c

Browse files
Joost DelsmanJoerivanEngelen
Joost Delsman
authored andcommitted
fix for quasi 3d layering
1 parent 8ddbfb3 commit ec2440c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

imod/visualize/cross_sections.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def _meshcoords(da, continuous=True):
8080
C = np.full((nrow - 1, ncol - 1), np.nan)
8181
C[:, 0::2] = data
8282
else:
83-
_, ncol = Y.shape
84-
C = np.full((nrow, ncol - 1), np.nan)
85-
C[:, 0::2] = data
83+
nrow, ncol = Y.shape
84+
C = np.full((nrow - 1, ncol - 1), np.nan)
85+
C[0::2, 0::2] = data
8686

8787
return X, Y, C, nodata
8888

@@ -106,7 +106,7 @@ def _plot_aquitards(aquitards, ax, kwargs_aquitards):
106106
C_aq = C_aq.astype(np.float64)
107107
for j, i in enumerate(range(0, X_aq.shape[0] - 1, 2)):
108108
Y_i = Y_aq[i : i + 2]
109-
C_i = C_aq[j]
109+
C_i = C_aq[i]
110110
C_i[C_i == 0.0] = np.nan
111111
nodata = np.repeat(np.isnan(C_i[0::2]), 2)
112112
Y_i[:, nodata] = np.nan
@@ -246,7 +246,10 @@ def cross_section(
246246
fig, ax = plt.subplots()
247247

248248
# Plot raster
249-
X, Y, C, nodata = _meshcoords(da, continuous=True)
249+
continuous = not (
250+
da["top"].shape == da["bottom"].shape
251+
) # allow quasi-3d schematisations
252+
X, Y, C, nodata = _meshcoords(da, continuous=continuous)
250253
ax1 = ax.pcolormesh(X, Y, C, **settings_pcmesh)
251254
# Plot aquitards if applicable
252255
if aquitards is not None:

0 commit comments

Comments
 (0)