CST_BindDim: Bind two objects of class s2dv_cube

View source: R/CST_BindDim.R

CST_BindDimR Documentation

Bind two objects of class s2dv_cube

Description

This function combines the data inside two or more objects of class s2dv_cube along the specified along dimension, and modifies the dimensions, coordinates and attributes accordingly, producing a result that contains the complete metadata for all variables, time steps and spatial coordinates that are bound in the process. It ensures that the information inside the s2dv_cube remains coherent with the data it contains.

If the dimension specified in along is among the time dimensions in attrs$Dates, the dates arrays are also bound along this dimension. The load_parameters and when attributes of the first cube are preserved. The source_files attribute is bound along the var_dim and dat_dim dimensions.

Usage

CST_BindDim(x, along, var_dim = NULL, dat_dim = NULL)

Arguments

x

Two or more objects of class s2dv_cube to be bound together.

along

A character string indicating the name of the binding dimension.

var_dim

A character string indicating the name of the variable dimension. The default value is NULL. Specifying this dimension ensures

dat_dim

A character string indicating the name of dataset dimension. The default value is NULL. Specifying this dimension ensures the dataset metadata is correctly preserved.

Value

An object of class s2dv_cube with the combined data, dimensions, coordinates and attributes of the elements in x.

Author(s)

Agudetse Roures Victoria, victoria.agudetse@bsc.es

See Also

abind

Examples

 # Example with sample data:
 # Check original dimensions and coordinates
 lonlat_temp$exp$dims
 lonlat_temp$obs$dims
 # Bind both datasets along the member dimension
 res <- CST_BindDim(x = list(lonlat_temp$exp, lonlat_temp$obs),
                    along = "member",
                    var_dim = NULL,
                    dat_dim = "dat")
 # Check new dimensions and coordinates
 res$dims
 names(res$coords)


CSTools documentation built on Nov. 14, 2025, 5:07 p.m.