subsetStations: RAnEnExtra::subsetStations

Description Usage Arguments Details Value Examples

View source: R/subsetStations.R

Description

RAnEnExtra::subsetStations is a convevient function to subset stations from forecast and observation lists. Given an index vector, presumably from the ID.R column from RAnEnExtra::subsetCoordinates, this function can subset the desired stations from a forecast or observation list.

Usage

1
subsetStations(index, l, verbose = T)

Arguments

index

An index vector for stations to extract

l

A forecast or observation list. For how to create such a list, please see this tutorial. For what members to include in the list, see this doc.

verbose

Whether to print progress information.

Details

RAnEnExtra::subsetStations will select the stations based on the input index from the following members of the input list (if they exist):

Value

A forecast or observation list depending on your input list type with the subset stations.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Subset a forecast list
forecasts <- list(
	StationNames = paste0('Station', 1:10),
	Xs = 1:10, Ys = 10:1,
	Data = array(1:200, dim = c(2, 10, 5, 2))
)

index <- c(1, 5)

forecasts.sub <- subsetStations(index, forecasts)

forecasts.sub$StationNames

dim(forecasts$Data)

dim(forecasts.sub$Data)

# Subset an observation list
observations <- list(
	StationNames = paste0('Station', 1:10),
	Xs = 1:10, Ys = 10:1,
	Data = array(1:100, dim = c(2, 10, 5))
)

index <- 6

observations.sub <- subsetStations(index, observations)

observations.sub$StationNames

dim(observations$Data)

dim(observations.sub$Data)

Weiming-Hu/RAnEnExtra documentation built on Sept. 26, 2021, 6:44 a.m.