Skip to content

Commit

Permalink
Fix: make sure that precip_models variable has the correct length (#368)
Browse files Browse the repository at this point in the history
* Fix: make sure that precip_models variable has the correct length

Fix to ensure that the `_check_inputs` function in `/blending/steps.py` looks for the correct `precip_models` length when a list of timesteps instead of an integer is provided.

* Add ceil for list of floating point timesteps
  • Loading branch information
RubenImhoff committed Jul 23, 2024
1 parent a915843 commit 07a5aa8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pysteps/blending/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
blend_means_sigmas
"""

import math
import time

import numpy as np
Expand Down Expand Up @@ -1887,7 +1888,7 @@ def _check_inputs(
if isinstance(timesteps, list) and not sorted(timesteps) == timesteps:
raise ValueError("timesteps is not in ascending order")
if isinstance(timesteps, list):
if precip_models.shape[1] != len(timesteps) + 1:
if precip_models.shape[1] != math.ceil(timesteps[-1]) + 1:
raise ValueError(
"precip_models does not contain sufficient lead times for this forecast"
)
Expand Down

0 comments on commit 07a5aa8

Please sign in to comment.