Skip to content

Commit

Permalink
fix reshape of 3d arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
jdebacker committed Jan 21, 2024
1 parent 88ef9f8 commit 5fa18cb
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions ogcore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,16 +999,6 @@ def extrapolate_arrays(param_in, dims=None, item="Parameter Name"):
param_in.reshape(1, dims[1], dims[2]),
(dims[0], 1, 1),
)
# param_out = np.concatenate(
# (
# param_in,
# np.tile(
# param_in[-1, :, :].reshape(1, dims[1], dims[2]),
# (dims[1], 1, 1),
# ),
# ),
# axis=0,
# )
# case if T by S input
elif param_in.shape[0] == dims[0] - dims[1]:
param_in = (
Expand All @@ -1034,15 +1024,18 @@ def extrapolate_arrays(param_in, dims=None, item="Parameter Name"):
assert False
elif param_in.ndim == 3:
# this is the case where input varies by T, S, J
param_out = np.concatenate(
(
param_in,
np.tile(
param_in[-1, :, :].reshape(1, dims[1], dims[2]),
(dims[1], 1, 1),
if param_in.shape[0] > dims[0]:
param_out = param_in[: dims[0], :, :]
else:
param_out = np.concatenate(
(
param_in,
np.tile(
param_in[-1, :, :].reshape(1, dims[1], dims[2]),
(dims[0] - param_in.shape[0], 1, 1),
),
),
),
axis=0,
)
axis=0,
)

return param_out

0 comments on commit 5fa18cb

Please sign in to comment.