Learn R Programming

synoptReg (version 0.2.2)

tidy_cuttime_nc: Format a 3D-array to a S-mode data frame and set the time period

Description

This function format the 3D-array output from read_nc function to a S-mode dataframe (variables = grid points, observations = days). Optionally, you can set the time period between specific years and/or specify if you want work with the full year or only with 3-month season.

Usage

tidy_cuttime_nc(datalist, season = NULL, year_range = NULL)

Arguments

datalist

List. 3D-array of atmospheric or environmental variable, longitudes, latitudes and time. I.e. the list returned by read_nc.

season

Character. Name of the season wanted (i.g. "winter", "spring", "summer", "fall").

year_range

vector. Starting and ending year wanted to subset the data.

Value

A list with:

  • A vector of dates.

  • A dataframe of the variable in S-mode.

  • A character with the name of the season

See Also

read_nc

Examples

Run this code
# NOT RUN {
# Load data (mslp or precp_grid)
data(mslp)
# Converting our data into a S-mode, but without modifying time period
smode_mslp <- tidy_cuttime_nc(mslp)
# matrix conversion and setting time period for winters between 2001 and 2010
smode_mslp <- tidy_cuttime_nc(mslp, season = "winter",
                             year_range = c(2001,2010))

# }

Run the code above in your browser using DataLab