Skip to content

Handle PermutedDimsArray #240

@tiemvanderdeure

Description

@tiemvanderdeure

The chunks of a PermutedDimsArray of a chunked array is not chunked - this is really annoying for Rasters in particular, because the @d macro internally uses PermutedDimsArray

using Rasters, NCDatasets
import Rasters.DiskArrays: eachchunk
A = Rasters.create(
    "myraster.nc", Float64, (X(1:1000), Y(1:1000)); 
    force = true, chunks = (128, 128)
)

Aperm = @d A (Y, X)
eachchunk(Aperm) # 1×1 DiskArrays.GridChunks
eachchunk(A) # 8x8 DiskArrays.GridChunks

Or a more minimal example

using DiskArrays
chunkedA = DiskArrays.TestTypes.ChunkedDiskArray(rand(100,100), (10, 10))
PermutedDimsArray(chunkedA, (2,1)) |> eachchunk
1×1 DiskArrays.GridChunks{2, Tuple{DiskArrays.RegularChunks, DiskArrays.RegularChunks}}:
 (1:100, 1:100)

I'm not entirely sure how this should work - probably we need to get the chunks of the parent and then apply the same permutation, right?

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