View source: R/loadStationPredictions.R
loadStationPredictions | R Documentation |
Load predictions data, either deterministic (one single txt file) or stochastic (several realizations stored in sepparate txt files, bundled in a single zip file).
loadStationPredictions(
stationObj,
predictions.file,
tz = "",
na.strings = "NA",
n.mem = NULL
)
stationObj |
A station data object returned by |
predictions.file |
Path to the file (either text or zip) containing the predictions. |
tz |
Optional. A time zone specification to be used for the conversion of dates. See more details in
|
na.strings |
Optional. A character vector of strings which are to be interpreted as |
n.mem |
Optional An integer value greater than zero indicating the number of members to be loaded. Default to |
The idea of this function is to rely on the previously loaded observations data, so all the information required to define the predictions subset (time and station codes) is retrieved from the observations data subset.
A predictions object. This is equivalent to the stations object (see loadValueStations
),
but the data element may vary its shape to include the "member"
dimension in case of stochastic
predictions with several realizations. Also, a global attribute "datatype"
is set, and assigned
the value "predictions"
to differentiate it from observations data.
Other loading:
loadValueStations()
## Not run:
#Example predictions
obs.dataset <- file.path(find.package("VALUE"), "example_datasets", "VALUE_ECA_86_v2.zip")
obs <- loadStationData(obs.dataset, "tmin", season = 6:8, years = 2001)
# Loading deterministic predictions
pred.file1 <- file.path(find.package("VALUE"),
"example_datasets",
"example_predictions_tmin_portal_exp1a_deterministic.zip")
pred <- loadStationPredictions(obs, pred.file1)
str(pred$Data) # 2D array
# Loading stochastic predictions (several realizations)
pred.file2 <- file.path(find.package("VALUE"),
"example_datasets",
"example_predictions_tmin_portal_exp1a_stochastic.zip")
pred2 <- loadStationPredictions(obs, pred.file2)
str(pred2$Data) # 3D array with 'member' dimension
# Selecting the first 2 members using 'n.mem':
pred3 <- loadStationPredictions(obs, pred.file2, n.mem=2)
str(pred3$Data) # 3D array with 'member' dimension of length 2
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.