Skip to content

What is the recommended approach for storing and plotting complicated layers and stacks of data? #826

Closed
@kapple19

Description

@kapple19

Sorry to tag you again @jkrumbiegel but we may need your insights on this as well, particularly question 3.

I have datasets that are structured over varied dimension values in a layered nature.

Here's some code that demonstrates the structure.
Basically each bearing θ is for a different set of range r values,
and each range r has a different set of depth z values.

using Base: range as linrange
using DimensionalData

function rands_sorted_dim(dim::Symbol; N::Int = rand(5:12))
    return [0; rand(N)] |> sort! |> unique! |> Dim{dim}
end

"Set of depth-sound speed value pairs."
function rand_1D_profile()
    z = rands_sorted_dim(:z)
    return rebuild(
        rand(z);
        name = "1D Profile"
    )
end

"One 1D profile per range."
function rand_2D_profile()
    r = rands_sorted_dim(:r)
    return DimArray(
        [
            rand_1D_profile()
            for r_ in r
        ],
        r;
        name = "2D Profile"
    )
end

"One 2D profile per bearing."
function rand_3D_profile()
    θ = Dim{:θ}(linrange(0, step = 45, length = 8))
    return DimArray(
        [
            rand_2D_profile()
            for θ_ in θ
        ],
        θ;
        name = "3D Profile"
    )
end

prof3D = rand_3D_profile()

I'm opening this issue to ask the following questions:

  1. Inspection: Running prof3D in the REPL to take a look at its structure prints out a lot of information, is there a better way to view a nice summary of its structure? Even typeof(prof3D) still prints a lot. I currently do keys(prof3D). Maybe an AbstractTrees.jl interface?

  2. Structure: Some of my data (not demonstrated above) would be like DimStack but not share the same values over the same dimensions, e.g. sound speed could be for depths 0 : 100 : 200, but density could be for depths 0 : 50 : 200. What's the best way to store such?

  3. Visualisation: Do I have to use AlgebraOfGraphics.pregrouped for all this data? Or will there be supported syntax conveniences for such layers and stacks of data? I've found DimArrays and DimStacks work nicely with AlgebraOfGraphics.data so I don't have to use pregrouped. So it's just the semantics for nested DimArrays and DimStacks that I suppose I'm asking about. Especially for syntax like mapping(layout = :θ, color = :r).

I'm happy to try and contribute. Primarily asking to know if any thoughts on this already exist, and if so, what direction, and if I can help.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions