meteo2STFDF {meteo} | R Documentation |
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.
meteo2STFDF(obs, stations, obs.staid.time = c(1, 2), stations.staid.lon.lat = c(1, 2, 3), crs=CRS(as.character(NA)), delta=NULL )
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 |
stations.staid.lon.lat |
numeric; records the column positions where in |
crs |
CRS; coordinate reference system (see CRS) of |
delta |
time; time interval to end points in seconds |
STFDF object
The function is intended for conversion of meteorological data to STFDF object, but can be used for similar spatio temporal data stored in two separated tables.
Milan Kilibarda kili@grf.bg.ac.rs, ALeksandar Sekulic asekulic@grf.bg.ac.rs
# 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)