Skip to content

Add support for reduction using dimension values in split-apply-combine pattern #399

Description

@ph-kev

In the split-apply-combine, reductions are supported by Reduction. It would be useful to also pass information about the dimension values to the reduction. The syntax might looks like

time_averaged_var =
    var |>
    ClimaAnalysis.GroupAll("time") |>
    ClimaAnalysis.ReduceWithDims(integrate) |>
    ClimaAnalysis.combine

and the signature of the reduction could be function integrate(data, dim_name, dims_values; dims) end where data is being reduced over, dim_name is the name of the dimension, dims_values are all the dimension values (in the form of a dictionary mapping dimension name to dimension values), and dims is the index to do the reduction on.

The use case for this is to support operations like finding the argmax/argmin or integrating time series data.

One concern I have is whether it makes sense to pass in more information like the attributes and dimension attributes. Although, there are work around for this by defining a functor for the reduction that store the attributes and dimension attributes in the OutputVars.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions