Skip to content

How to get leaves of a DimTree as Arrays? #1021

@felixcremer

Description

@felixcremer

What is the best way to get the leaves of a DimTree as Arrays?

I tried accessing them via a chain of getproperty but this gives a DimTree back.
I would have expected that the dt.a below would be a DimArray.

SentinelDataSource) julia> dt = DimTree()
┌ DimTree ┐
└─────────┘

(SentinelDataSource) julia> dt.a = Raster(rand(X(10), Y(10)))
┌ 10×10 Raster{Float64, 2} ┐
├──────────────────────────┴─────────────────────────────── dims ┐
   X,  Y
├──────────────────────────────────────────────────────── raster ┤
  extent: Extent(X = (1, 10), Y = (1, 10))
└────────────────────────────────────────────────────────────────┘
 0.798084  0.012007   0.101746  0.0386888  0.219548  0.180471   0.592661  0.167466   0.0989479  0.485384
 0.693583  0.214522   0.356487  0.216324   0.578934  0.532685   0.260759  0.430287   0.635727   0.261476
 0.677591  0.834083   0.41838   0.243101   0.851232  0.0981079  0.555391  0.91657    0.128602   0.551603
 0.540059  0.60779    0.601538  0.34241    0.157743  0.207561   0.757983  0.0286865  0.664151   0.107299
 0.359283  0.82841    0.27799   0.188408   0.64323   0.820273   0.634096  0.815824   0.799481   0.481395
 0.120837  0.756756   0.466793  0.336066   0.23359   0.323954   0.776945  0.634174   0.297968   0.513677
 0.965575  0.743997   0.568772  0.533866   0.117957  0.149039   0.934118  0.682216   0.83197    0.185443
 0.761152  0.0826554  0.531716  0.202272   0.567258  0.21206    0.599275  0.272485   0.879204   0.929255
 0.630716  0.355725   0.895791  0.405817   0.768937  0.97429    0.48412   0.0633981  0.233817   0.180433
 0.960082  0.779803   0.182127  0.420531   0.631697  0.421737   0.412217  0.882733   0.184448   0.247966

(SentinelDataSource) julia> dt.a
┌ DimTree ┐
├─────────┴──────────────────────────────────────────────── dims ┐
   X,  Y
├──────────────────────────────────────────────────────── layers ┤
  : eltype: Float64 dims: X, Y size: 10×10
└────────────────────────────────────────────────────────────────┘

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