Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use eltype instead of promote_type #420

Merged
merged 1 commit into from
Nov 20, 2024
Merged

Use eltype instead of promote_type #420

merged 1 commit into from
Nov 20, 2024

Conversation

glwagner
Copy link
Member

@glwagner glwagner commented Nov 19, 2024

Otherwise we can get a StackOverflow error with large samples, eg

ERROR: LoadError: StackOverflowError:
Stacktrace:
 [1] promote_type(::Type, ::Type, ::Type, ::Type, ::Vararg{Type}) (repeats 600 times)
   @ Base ./promotion.jl:299
 [2] Observation(obs_dict::Dict{String, Any})
   @ EnsembleKalmanProcesses ~/.julia/packages/EnsembleKalmanProcesses/hifDM/src/Observations.jl:125
 [3] include(fname::String)
   @ Base.MainInclude ./client.jl:489

(And this may only be an issue on mac!)

Otherwise we can get a StackOverflow error with large `samples`, eg

```julia
ERROR: LoadError: StackOverflowError:
Stacktrace:
 [1] promote_type(::Type, ::Type, ::Type, ::Type, ::Vararg{Type}) (repeats 600 times)
   @ Base ./promotion.jl:299
 [2] Observation(obs_dict::Dict{String, Any})
   @ EnsembleKalmanProcesses ~/.julia/packages/EnsembleKalmanProcesses/hifDM/src/Observations.jl:125
 [3] include(fname::String)
   @ Base.MainInclude ./client.jl:489
```
@glwagner
Copy link
Member Author

Reproducer

julia> metadata = Dict("samples" => rand(2000),
                       "covariances" => EKP.I,
                       "names" => "surface temperature" )
Dict{String, Any} with 3 entries:
  "names"       => "surface temperature"
  "samples"     => [0.72443, 0.237406, 0.353835, 0.315662, 0.282328, 0.111403, 0.515477, 0.769607, 0.226976, 0.579689    0.497924, 0.55258, 0.730444, 0.775595, 0.58
  "covariances" => UniformScaling{Bool}(true)

julia> y = Observation(metadata)
ERROR: StackOverflowError:

Copy link
Collaborator

@odunbar odunbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - and this fixes the MacOS LTS test failures on Julia v1.10.5

@glwagner glwagner merged commit 0c742b0 into main Nov 20, 2024
12 checks passed
@glwagner glwagner deleted the glwagner-patch-2 branch November 20, 2024 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants