Skip to content

Ability to "Interleave" or "insert" cubesΒ #6842

@acchamber

Description

@acchamber

✨ Feature Request

I often encounter situations where I am constructing a cube from smaller cubes (such as hourly .nc files). When I do so sometimes I find there's missing values (common in observational data) that I want to infill. However, you cannot concatenate data into the middle of a cube, even if it doesn't overlap. For example:

I have a cube main with the following dim_coord

[0,1,2,3...7799,7800]

But there's missing values at [56] and [3567]. The cube just goes [... 55, 57 ...] and [... 3566, 3568 ... ].

I have cubes with the [56] and [3567] coord that I want to insert into the cube but I cannot

the current workaround is to define new cubes of main[:55],main[56:], then concatenate the cubelist of the three( main[:55],main[56:], [56]) , but this approach is brittle and does not scale well (when you have a 100 missing values this scales poorly)

Ideally, the solution would also allow for more complex interleaving - eg

cube A [0,3,6,9,12]
Cube B [1,2,4,5,7,8,10,11]

cube c = interleave([Cube A, Cube b])

Additional context

This would only need to function in one dimension - obviously all other dimensions would have to match. Discussed with @bjlittle at surgery.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions