Skip to content

Commit

Permalink
fix reshape of 2D out
Browse files Browse the repository at this point in the history
  • Loading branch information
jdebacker committed Jan 30, 2024
1 parent bdb2734 commit 0dbd0f6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ogcore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,20 +932,19 @@ def extrapolate_arrays(param_in, dims=None, item="Parameter Name"):
param_out = np.ones((dims)) * param_in[0]
# case where user enters just one year for all types in 2nd dim
if param_in.shape[0] == dims[1]:
param_in = np.tile(param_in.reshape(1, dims[1]), (dims[0], 1))
param_out = np.tile(param_in.reshape(1, dims[1]), (dims[0], 1))
else:
# case where user enters multiple years, but not full time
# path
# will assume they implied values the same across 2nd dim
# and will fill in all periods
param_in = np.concatenate(
param_out = np.concatenate(
(
param_in,
np.ones((dims[0] - param_in.size)) * param_in[-1],
)
)
param_in = np.tile(param_in.reshape(dims[0], 1), (1, dims[1]))
param_out = np.squeeze(param_in, axis=2)
param_out = np.tile(param_out.reshape(dims[0], 1), (1, dims[1]))
elif param_in.ndim == 2:
# case where enter values along 2 dimensions, but those aren't
# complete
Expand Down

0 comments on commit 0dbd0f6

Please sign in to comment.