Learn R Programming

meteo (version 0.1-4)

meteo2STFDF: Create an object of STFDF class from two data frames (observation and stations)

Description

The function creates an object of STFDF 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.

Usage

meteo2STFDF(obs, stations, obs.staid.time = c(1, 2), 
            stations.staid.lon.lat = c(1, 2, 3), crs=CRS(as.character(NA)), delta=NULL )

Arguments

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) of stations coordinates
delta
time; time interval to end points in seconds

Value

See Also

tgeom2STFDF pred.strk

Examples

Run this code
# prepare data
# load observation - data.frame of mean temperatures
data(dtempc) 
str(dtempc)
data(stations)
#
str(stations)
lonmin=18 ;lonmax=22.5 ; latmin=40 ;latmax=46
library(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 STFDF
temp <- meteo2STFDF(dtempc,st, crs= CRS('+proj=longlat +datum=WGS84'))
str(temp)

Run the code above in your browser using DataLab