JuliaDataCubes / JuliaDataCubes/YAXArrays.jl

How to make a moving Window with axis to one full axis additionally

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

Nobody has claimed this yet.

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

Description

I want to do a moving window on longitude and latitude but have an additional axis that would take the full axis along. This is needed for either time series comparisons or for spectral diversity.

Basically it is about replacing these indims definitions with the new MovingIntervals definition.

    indims = InDims("Time",MovingWindow(latax,windowstep,windowstep),MovingWindow(lonax,windowstep,windowstep))
    outdims=OutDims(CategoricalAxis("Distfuns", string.(distfuns)), backend=:zarr, path=path, overwrite=true)
    vhcomp = mapCube(innerneighbors!, cube, distfuns, aggfun, normfun, timebuffer; indims, outdims)

I tried to define a MovingIntervals that would capture the whole dimension but I didn't succeed.
I also trying to make an xmap with the result of windows but that failed with the following error:

julia> xmap(mean, meanwindows ⊘ :band)
ERROR: MethodError: no method matching windows(::YAXArrays.Xmap.DimWindowArray{YAXArray{…}, Tuple{…}, Tuple{…}, Tuple{…}}, ::Pair{Symbol, Whole})
The function `windows` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  windows(::Union{AbstractDimArray, AbstractDimStack}, ::Pair{<:Any, <:Union{Function, Type}}, Pair{<:Any, <:Union{Function, Type}}...)
   @ YAXArrays ~/.julia/packages/YAXArrays/nQ22T/src/DAT/xmap.jl:25
  windows(::Union{AbstractDimArray, AbstractDimStack}, ::Any)
   @ YAXArrays ~/.julia/packages/YAXArrays/nQ22T/src/DAT/xmap.jl:23
  windows(::Union{AbstractDimArray, AbstractDimStack}, ::Tuple{DimensionalData.Dimensions.Dimension, Vararg{DimensionalData.Dimensions.Dimension}})
   @ YAXArrays ~/.julia/packages/YAXArrays/nQ22T/src/DAT/xmap.jl:33
  ...

Stacktrace:
 [1] ⊘(a::YAXArrays.Xmap.DimWindowArray{YAXArray{…}, Tuple{…}, Tuple{…}, Tuple{…}}, b::Tuple{Symbol})
   @ YAXArrays.Xmap ~/.julia/packages/YAXArrays/nQ22T/src/DAT/xmap.jl:20
 [2] ⊘(a::YAXArrays.Xmap.DimWindowArray{YAXArray{…}, Tuple{…}, Tuple{…}, Tuple{…}}, b::Symbol)
   @ YAXArrays.Xmap ~/.julia/packages/YAXArrays/nQ22T/src/DAT/xmap.jl:21
 [3] top-level scope
   @ REPL[78]:1
Some type information was truncated. Use `show(err)` to see complete types.

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.

Research direction

Start with the MovingWindow and MovingIntervals definitions and the windows/xmap entry points referenced in YAXArrays.Xmap and DAT/xmap.jl. Trace how a full-axis window should be represented for the shown mapCube call and xmap expression; done means the additional full dimension works and the reported method error is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.