diff --git a/Project.toml b/Project.toml index 9a739b9..22ddb54 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StateSpaceLearning" uuid = "971c4b7c-2c4e-4bac-8525-e842df3cde7b" authors = ["andreramosfc "] -version = "2.0.10" +version = "2.0.11" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" diff --git a/src/utils.jl b/src/utils.jl index 02c8602..5750b60 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -153,9 +153,13 @@ function get_stochastic_values( valid_indices = filter(idx -> start_idx <= idx <= final_idx, seasonal_indices) # Sample with randomness and sign flip - stochastic_term[t, :] = - rand(estimated_stochastic[valid_indices], N_scenarios) .* - rand([1, -1], N_scenarios) + if !isempty(estimated_stochastic[valid_indices]) + stochastic_term[t, :] = + rand(estimated_stochastic[valid_indices], N_scenarios) .* + rand([1, -1], N_scenarios) + else + stochastic_term[t, :] .= 0.0 + end end else stochastic_term =