Skip to content

Custom Struct as outtype in OutDims? #478

@Balinus

Description

@Balinus

Hello,

I am trying to do GEV estimation using mapCube, using the following logic. The objective is to get the timeseries for each gridpoints and return the GEV model associated with the timeserie, for each gridpoint, storing the following information into a YAXArray:

MaximumLikelihoodAbstractExtremeValueModel
model :
        ThresholdExceedance
        data :          Vector{Float64}[28]
        logscale :      ϕ ~ 1
        shape :         ξ ~ 1

θ̂  :    [2.0154230098844907, 0.09042541506171095]

Hence, when I try the following:

indims = InDims("Ti")
outdims = OutDims(outtype=MaximumLikelihoodAbstractExtremeValueModel)

I get the error:

ERROR: MethodError: Cannot `convert` an object of type
  Type{MaximumLikelihoodAbstractExtremeValueModel} to an object of type
  Union{Int64, DataType}

Closest candidates are:
  convert(::Type{T}, ::T) where T
   @ Base Base.jl:84

Stacktrace:
 [1] OutDims(axisdesc::Tuple{}, backend::Symbol, backendargs::@Kwargs{}, update::Bool, artype::Type, chunksize::Symbol, outtype::Type)
   @ YAXArrays.DAT ~/.julia/packages/YAXArrays/ppMtD/src/DAT/registration.jl:102
 [2] OutDims(; backend::Symbol, update::Bool, artype::Type, chunksize::Symbol, outtype::Type, backendargs::@Kwargs{})
   @ YAXArrays.DAT ~/.julia/packages/YAXArrays/ppMtD/src/DAT/registration.jl:134
 [3] top-level scope
   @ REPL[64]:1

It seems to be possible to assign a custom type to outtype, but I am unsure why it fails for MaximumLikelihoodAbstractExtremeValueModel:

struct foo
    a
end

outdims = OutDims(outtype=foo)
OutDims((), :auto, Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}(), false, Array, :input, foo)

Thanks for any intput!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions