Skip to content

Commit f875e5f

Browse files
committed
update git_layer_function to take xarray
1 parent 8a15145 commit f875e5f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

mhkit/river/io/d3d.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,14 @@ def get_layer_data(
224224
if isinstance(var[0][0], np.ma.core.MaskedArray):
225225
max_layer = len(var[0][0])
226226

227+
if abs(layer_index) > max_layer:
228+
raise ValueError(f"layer_index must be less than the max layer {max_layer}")
229+
230+
v = np.ma.getdata(var[time_index, :, layer_index], False)
231+
dimensions = 3
232+
elif isinstance(var[0][0], xr.core.variable.Variable):
233+
max_layer = var[0][0].shape[0]
234+
227235
if abs(layer_index) > max_layer:
228236
raise ValueError(f"layer_index must be less than the max layer {max_layer}")
229237

0 commit comments

Comments
 (0)