Description Usage Arguments Examples
The method as.smet
coerces an object or a charachter string to a SMET. If the object is
as.smet
as.smet
as.smet
as.smet
as.smet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | as.smet(object, ...)
as.smet(object, ...)
## S4 method for signature 'character'
as.smet(object, ...)
## S4 method for signature 'data.frame'
as.smet(object, mult = NA, offset = NA,
date.field = "timestamp", station.field = "station_id",
header.fields = c("longitude", "latitude", "station_id", "altitude",
"location"), variables = NULL, force.multistation = FALSE,
metaparam = attr(object, "metaparam"), file = NA, ...)
## S4 method for signature 'list'
as.smet(object, ...)
## S4 method for signature 'smet'
as.smet(object, ...)
|
object |
the object to be coerced |
... |
further arguments |
mult, offset |
numeric vectors of unit multiplier and offset respectivaly |
date.field |
field name used for date and time. Default is |
station.field |
field name used for station ID. Default is |
header.fields |
names used for the SMET header. Defaults are |
variables |
(optional) selection of variables hich can be exported to SMET formats. It is used only in case of two or more stations. |
force.multistation |
logical value. If it is |
metaparam |
metedata optional data frame containig meta info on variables. It can be entered as an attribute of |
file |
full filename of the reference SMET filename (not considered when |
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 34 35 36 37 38 39 | data(meteofrance)
## Choose a particular station
station_id <- unique(meteofrance$station_id)[3]
variables <- c("timestamp","DW","VW","TA","TD","RH","MFR_rr24",
"MFR_tn12","MFR_tn24","MFR_tx12","MFR_tx24","HS","HS_fresh")
header <- c("longitude","latitude","station_id" ,"altitude","location")
names(header) <- header
data <- meteofrance[meteofrance$station_id==station_id,c(header,variables)]
metaparam <- attr(meteofrance,"metaparam")
metaparam <- metaparam[metaparam$SMET_ID %in% names(data),]
header <- lapply(X=header,FUN=function(x,data) {data[1,x]},data=data)
data <- data[,variables]
attr(data,"header") <- header
attr(data,"metaparam") <- metaparam
sm <- as.smet(data)
# In case of multiple station, it return a list of SMET-class objects:
## This opton works for more than one station,
#in case of one station this works too only if it is FORCED!
sm_multi <- as.smet(meteofrance,variables=variables)
onestation <- meteofrance[meteofrance$station_id=="07499",]
sm_o <- as.smet(onestation,variables=variables,force.multistation=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.