Skip to content

Commit 07a5aa8

Browse files
authored
Fix: make sure that precip_models variable has the correct length (#368)
* 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
1 parent a915843 commit 07a5aa8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pysteps/blending/steps.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
blend_means_sigmas
4444
"""
4545

46+
import math
4647
import time
4748

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

0 commit comments

Comments
 (0)