Learn R Programming

s2dv (version 2.2.0)

LoadSampleData: Load Sample Data for Package Examples

Description

Loads and subsets sample data stored in the internal datasets sampleMap and sampleTimeSeries, included with the package. Intended for use in documentation examples instead of Load(), in order to avoid reliance on external system dependencies like 'nco' and 'cdo' and to reduce computation time during CRAN checks.

Usage

LoadSampleData(sdates, leadtimemin = 1, leadtimemax = NULL, output = "areave")

Value

A named list with the following elements:

mod

Array of model data with the selected start dates and lead times.

obs

Array of observational data with the selected start dates and lead times.

lat

Vector of latitudes.

lon

Vector of longitudes.

Arguments

sdates

Character vector of start dates to include (e.g., c("19851101", "19901101")). Must match one or more of the available dates in the internal sample datasets: "19851101", "19901101", "19951101", "20001101" or "20051101".

leadtimemin

Integer specifying the first lead time to include. Default is 1.

leadtimemax

Integer specifying the last lead time to include. If NULL, the full lead time range is included. Default is NULL.

output

Character string indicating the type of output: "areave" for area-averaged time series data, or "lonlat" for gridded spatial data. Default is "areave".

Details

This function is designed for use in examples and tests within the 's2dv' package. It provides quick access to precomputed datasets, helping to avoid slow or system-dependent operations during automated checks.

Examples

Run this code
startDates <- c("19851101", "19901101", "19951101", "20001101", "20051101")
sampleData <- LoadSampleData(sdates = startDates, output = "areave")

Run the code above in your browser using DataLab