You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem here is relatively straightforward. At the moment the implementation of _create_indexfun simply writes the spectral indices formulas as julia functions as they are. This works fine, but the limitation is that only Float64 computation is possible. This is because some of the formulas contain constant parameters that default to Float64.
in order to navigate around the problem we would need a more specific implementation of _create_indexfun that does two things:
creates kwargs out of constant parameters like so INDEX(a::Number, b::Number, c::Number; const1::Number=1.0) = [formula]
additionally, we would have a type argument, that defaults to Float64, and wraps the kwargs constants. Building on the previous example it would be something like INDEX(::Type{T}, a::Number, b::Number, c::Number; const1::Number=T(1.0)) where {T <: Number} = [formula]
After this is done there should be some restructure of the existing codebase to adapt all user facing functions to add this as an argument: compute_index(index_name, params, ::Type{T}) where {T <: Number}
The text was updated successfully, but these errors were encountered:
The problem here is relatively straightforward. At the moment the implementation of
_create_indexfun
simply writes the spectral indices formulas as julia functions as they are. This works fine, but the limitation is that onlyFloat64
computation is possible. This is because some of the formulas contain constant parameters that default toFloat64
.in order to navigate around the problem we would need a more specific implementation of
_create_indexfun
that does two things:INDEX(a::Number, b::Number, c::Number; const1::Number=1.0) = [formula]
INDEX(::Type{T}, a::Number, b::Number, c::Number; const1::Number=T(1.0)) where {T <: Number} = [formula]
After this is done there should be some restructure of the existing codebase to adapt all user facing functions to add this as an argument:
compute_index(index_name, params, ::Type{T}) where {T <: Number}
The text was updated successfully, but these errors were encountered: