Create an object of STFDF-class class from two data frames (observation and stations)
Create an object of STFDF-class class from two data frames (observation and stations)
The function creates an object of STFDF-class class, spatio-temporal data with full space-time grid, from two data frames (observation and stations). Observations data frame minimum contains station ID column, time column (day of observation) and measured variable column. Stations data frame contains at least station ID column, longitude (or x) and latitude (or y) column.
obs: data.frame; observations data frame minimum contains station ID column, time column (day of observation) and measured variable column. It can contain additional variables (columns).
stations: data.frame; Stations data frame contains at least station ID column, longitude (or x) and latitude (or y) column.It can contain additional variables (columns).
obs.staid.time: numeric; records the column positions where in obs (observation) data frame the station ID and time values are stored.
stations.staid.lon.lat: numeric; records the column positions where in stations data frame the station ID, longitude (x) and latitude (y) values are stored.
crs: CRS; coordinate reference system (see CRS-class ) of stations coordinates
delta: time; time interval to end points in seconds
The function is intended for conversion of meteorological data to STFDF-class object, but can be used for similar spatio temporal data stored in two separated tables.
See Also
tgeom2STFDF, pred.strk
Examples
# prepare data# load observation - data.frame of mean temperaturesdata(dtempc)str(dtempc)data(stations)str(stations)lonmin=18;lonmax=22.5; latmin=40;latmax=46library(sp)library(spacetime)serbia = point.in.polygon(stations$lon, stations$lat, c(lonmin,lonmax,lonmax,lonmin), c(latmin,latmin,latmax,latmax))st= stations[ serbia!=0,]# stations in Serbia approx.# create STFDFtemp <- meteo2STFDF(dtempc,st, crs= CRS('+proj=longlat +datum=WGS84'))str(temp)