Learn R Programming

synoptReg (version 0.2.0)

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, only_convert = TRUE, season, initial_year,
  end_year)

Arguments

datalist

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

only_convert

Logical. If TRUE the function only format data, if FALSE data is formatted and subsetted by specific time and/or season period.

season

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

initial_year

Integer. Start year wanted to subset the data.

end_year

Integer. End 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 (if only_convert = FALSE).

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, only_convert = TRUE)
# matrix conversion and setting time period for winters between 2001 and 2010
smode_mslp <- tidy_cuttime_nc(mslp, only_convert = FALSE, season = "winter",
                             initial_year = 2001, end_year = 2010)

# }

Run the code above in your browser using DataLab