Learn R Programming

synoptReg (version 0.2.2)

raster_ct2env: Raster conversion of environmental data based on CT

Description

This function converts the dataframe of the environmental data based on the synoptic classification into a Raster Stack format.

Usage

raster_ct2env(longitude, latitude, clas, grid_data, option = 1,
  na.rm = TRUE)

Arguments

longitude

Numeric vector containing longitudes

latitude

Numeric vector containing latitudes

clas

Integer containing the results of the synoptic classification.

grid_data

Data frame containing the environmental data (i.e. precipitation, temperature, PM10, etc.)

option

Integer (1 or 2), to manage latitude and longitude data when convert to raster. Try 2 if 1 is wrong and viceversa. Default is 1.

na.rm

Logical. If TRUE, all the grid points are used to calculate the daily mean although NA exists. If FALSE, only grid points with the complete serie are used to compute the daily mean. Default is TRUE.

Value

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

Examples

Run this code
# NOT RUN {
# Load data (precp_grid)
data(precp_grid)
# Converting our data, but without modifying time period
smode_mslp <- tidy_cuttime_nc(mslp)
precp_data <- tidy_cuttime_nc(precp_grid)
# classification performance
smode_clas <- synoptclas(smode_mslp$smode_data, ncomp = 6)
# convert all the precipitation maps based on CT to a raster stack
raster_precp <- raster_ct2env(longitude = precp_grid$lon,
                latitude = precp_grid$lat, clas = smode_clas$clas,
                grid_data = precp_data$smode_data, option = 2)

# }

Run the code above in your browser using DataLab