Description Usage Arguments Value Author(s) Examples
View source: R/small-methods.R
Convert a static "pField"
or "pTs"
object, i.e. including only
one time step, to a data frame with data, latitude and longitude columns,
with the possibility to cut out a specified latitude-longitude region.
1 |
data |
a |
lat.min |
set the minimum latitude for the output; per default the
minimum in |
lat.max |
set the maximum latitude for the output; per default the
maximum in |
lon.min |
set the minimum longitude for the output; per default the
minimum in |
lon.max |
set the maximum longitude for the output; per default the
maximum in |
A data frame with the three columns lat
(latitudes),
lon
(longitudes) and dat
(the values of data
at the
coordinate positions).
Thomas Münch
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 | # Create a pfield object covering two latitudes, three longitudes and
# four time steps, let data values increase with latitude and time only:
lat <- seq(-75, -80, -5)
lon <- c(0, 135, 215)
time <- 1 : 4
space <- c(1, 1, 1, 2, 2, 2)
spacetime <- c(space, 10 * space, 100 * space, 1000 * space)
x <- pField(data = spacetime, lat = lat, lon = lon, time = time)
# Average across time
x.avg <- ApplyTime(x, mean)
# Convert to data frame
x.df <- pField2df(x.avg)
x.df
# Cut out some region
x.df <- pField2df(x.avg, lat.min = -75, lon.min = 0, lon.max = 200)
x.df
# Subset incompletely to create a pTs object
x.pts <- x[, 1 : 4]
x.avg <- ApplyTime(x.pts, mean)
# Convert to data frame
x.df <- pField2df(x.avg)
x.df # the same as x.df[1 : 4,] from above
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.