Skip to content

"It has similar goals to pythons xarray" #1157

@cake-duke

Description

@cake-duke

Hi, I wonder if someone could help me understand the scope of this project.

It says that it has similar goals to python's xarray. Great, that's what I'm looking for.

One of the things that python's xarrays is great at is downsampling and automatically aligning axes.

For example, schematically

data = [
    (t = 1, type=:a, value=1.),
    (t = 2, type=:b, value=10.),
    (t = 9, type=:a, value=2.),
    (t = 11, type=:b, value=20.),
]

In xarray I could ask it to align time to multiples-of-10 buckets, and then specifiy a methodology for downsampling, for example in this case could be take last value in the bucket. It would return something which is equivalent to

t = 10, type=:a, value=9.
t = 10, type=:b, value=2.
t = 20, type=:a, value=9.
t = 20, type=:b, value=20..

Note for example that the first record gets completly ignored because it's not the last type=:a in the time bucket, and furthermore type=:a doesn't have any record in the second bucket but xarray knows to use the value from the previous bucket. And you could specify methodologies other than "last", you could say "sum" (which has a default of 0 etc). These can be viewed as aggregation operations which you could implementat in DataFrames.jl or even by hand, but xarrays makes it easier to get what you want and harder to make mistakes.

Does DimensionalData.jl do this, or not? And if not, is there a Julia lib that does?

If I search the docs for the word sample, I do get results, e.g. https://rafaqz.github.io/DimensionalData.jl/stable/api/lookuparrays#Sampling
So I think that DimensionalData.jl does do this, but I can't tell how to actually use it. Is there an example of how to do the above in the docs?

Best regards

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