Skip to contents
  • TimeRastLayerVariable is a data class that is based on a 3D array. It has two "macro" dimensions, time and spatial. But due to the raster spatial has two dimension and the vertical layer, the data class actually has four data-dimensions: (time, x, y, layer).

  • TimeRastLayerArray is a data class that is based on a 4D array. It has three "macro" dimensions: time, spatial, and variable. But due to the raster spatial has two dimension and the vertical layer, the data class actually has five data-dimensions: (time, x, y, layer, variable).

Usage

new_TimeRastLayerVariable(data_, Name_, Unit_, Time_, ...)

# S3 method for SpatRaster
new_TimeRastLayerVariable(
  data_,
  Name_,
  Unit_,
  Time_,
  n_Layer,
  dim_Time_Layer = c(1, 2),
  ...
)

# S3 method for array
new_TimeRastLayerVariable(
  data_,
  Name_,
  Unit_,
  Time_,
  Spat_EPSG,
  Spat_extent,
  n_Layer,
  ...
)

new_TimeRastLayerArray(data_, Name_, Unit_, Time_, ...)

# S3 method for SpatRaster
new_TimeRastLayerArray(
  data_,
  Name_,
  Unit_,
  Time_,
  n_Layer,
  dim_Time_Layer_Vari = c(1, 2, 3),
  ...
)

# S3 method for array
new_TimeRastLayerArray(
  data_,
  Name_,
  Unit_,
  Time_,
  Spat_EPSG,
  Spat_extent,
  n_Layer,
  ...
)

Arguments

data_

(num-array or terra::SpatRaster)

  • 4D (array) for new_TimeRastLayerVariable.array(), it must in the (time, x, y, layer) dimension-order, use the function aperm() to adjust the dimension-order

  • 5D (array) for new_TimeRastLayerArray.array(), it must in the (time, x, y, layer, variable) dimension-order, use the function aperm() to adjust the dimension-order

  • (terra::SpatRaster) (multilayer) for new_TimeRastVariable.SpatRaster(), created by terra::rast()

Name_, Unit_

(char) name and unit of Variable, Unit_ should be units::as_units()

Time_

(vector of lubridate::timepoint) time dimension, created by lubridate::as_date() or lubridate::as_datetime()

...

other parameters

n_Layer

(integer) number of the data layers

dim_Time_Layer

the order of time- and variable-dimenion in the layer of terra::rast, it must be

  • c(1, 2): first time then layer or

  • c(2, 1): first layer then time,

  • default is c(1, 2)

Spat_EPSG

(integer) EPSG code of the CRS (Coordinate Reference System)

Spat_extent

(vector of numric), extension of the Raster in c(xmin, xmax, ymin, ymax), it can be projected east- and north-meter or global longitude- and latitude-degree

dim_Time_Layer_Vari

the order of time- and variable-dimenion in the layer of terra::rast, it must be

  • c(1, 2, 3), c(1, 3, 2): first time then layer or variable,

  • c(2, 1, 3), c(2, 3, 1): first layer then time or variable,

  • c(3, 1, 2), c(3, 2, 1): first variable then time or layer,

  • default is c(1, 2, 3)

Value

TimeRastLayerVariable and TimeRastLayerArray data