Custom Struct as outtype in OutDims?

Open
#478 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
julia
Domain
data

Research direction

Start with YAXArrays.DAT registration.jl at the OutDims constructors shown in the stack trace, then compare the successful foo example with MaximumLikelihoodAbstractExtremeValueModel. Reproduce both OutDims calls and inspect the conversion failure. Done means determining whether the custom model type can be accepted consistently as outtype and documenting or testing the resulting behavior.

Written by the indexing model from the issue text.

Description

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!

Dominant language
Julia
Stars
132
Forks
25
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from JuliaDataCubes/YAXArrays.jl

All issues in JuliaDataCubes/YAXArrays.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.