get_data_dims: XYZT or SZT data dimensions for interacting with netCDFs

View source: R/functions_netCDF.R

get_data_dimsR Documentation

XYZT or SZT data dimensions for interacting with netCDFs

Description

XYZT or SZT data dimensions for interacting with netCDFs

Usage

get_data_dims(
  data_str = c("xyzt", "xyt", "xyz", "xy", "szt", "st", "sz", "s"),
  dims = NULL
)

Arguments

data_str

A character string describing the dimensions of data where "xy" stands for x and y spatial dimensions if the spatial structure is gridded, while "s" stands for site if the spatial structure are discrete points; z stands for a vertical dimension; and t stands for a temporal dimension.

dims

An integer vector.

Value

A named integer vector with six elements for

ns

sites, for a spatial representation of data as sites

nx

x coordinate, for a gridded spatial representation

ny

y coordinate, for a gridded spatial representation

nz

vertical levels

nt

temporal units

Examples

x <- array(dim = c(17, 15, 12, 100))
get_data_dims("xyzt", dim(x))
get_data_dims("xyzt", c(17, 15, 12, 100))
get_data_dims("xyt", c(17, 15, 100))
get_data_dims("xyz", c(17, 15, 12))
get_data_dims("xy", c(17, 15))
get_data_dims("xy", c(17, 15, 3))

get_data_dims("szt", c(17 * 15, 12, 100))
get_data_dims("xy", c(17 * 15))
get_data_dims("xy", c(17 * 15, 3))


DrylandEcology/rSW2st documentation built on Jan. 10, 2024, 6:22 p.m.