Skip to contents

This function applies the approach: "circulation types to environment".

Usage

ct2env(x, clas, fun = mean, out = "data.frame")

Arguments

x

data.frame. A data.frame containing the environmental data (i.e. precipitation, temperature, PM10, etc.) with the following variables: lon, lat, time, value, anom_value. See tidy_nc.

clas

data.frame. A data.frame of the synoptic classification (time and WT) obtained from the synoptclas function.

fun

function. A function to be applied to the environmental variable for each WT.

out

character. Choose between "data.frame" (default) or "SpatRaster" A function to be applied to the environmental variable for each WT.

Value

a data.frame or a Raster Stack containing the environmental grids based on the weather types.

Examples

if (FALSE) {
# Load atmospheric data
data(msl)
data(z500)

# Joining both variables
atmos_data <- dplyr::bind_rows(msl,z500)

# S-mode classification
smode_cl <- synoptclas(atmos_data, ncomp = 6, norm = T)

# Load precipitation data 
pcp_file <- system.file("inst/extdata", "pcp_spread.nc", package = "synoptReg")
# ct2env (precipitation example)
ct2env(x = pcp, clas = smode_cl$clas, fun = mean, out = "data.frame")
}