Learn R Programming

synoptReg (version 1.2.1)

ct2env: Establishing the relationship between CT and a environmental variable

Description

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 "raster" 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

Run this code
# NOT RUN {
# Load data (mslp or precp_grid)
data(mslp)
data(z500)
# Tidying our atmospheric variables (500 hPa geopotential height
# and mean sea level pressure) together.

# Time subset between two dates
atm_data1 <- tidy_nc(x = list(mslp,z500),
             name_vars = c("mslp","z500"))

# S-mode classification
smode_clas <- synoptclas(atm_data1, ncomp = 6)

# ct2env (precipitation example)
ct2env(x = pcp, clas = smode_clas$clas, fun = mean, out = "data.frame")


# }

Run the code above in your browser using DataLab