1 | resamp.bath(sstL, bathy)
|
sstL |
|
bathy |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (sstL, bathy)
{
require(raster)
xmin = min(sstL$lon)
xmax = max(sstL$lon)
ymin = min(sstL$lat)
ymax = max(sstL$lat)
b2 = crop.grid(xmin, xmax, ymin, ymax, bathy)
s = raster(nrow = nrow(sstL$sstL), ncol = ncol(sstL$sstL))
bath2 = raster(ncol = ncol(b2[[3]]), nrow = nrow(b2[[3]]))
bath2 = setValues(bath2, as.vector(t(b2[[3]])))
s <- resample(bath2, s, method = "bilinear")
extent(s) = extent(c(min(sstL$lon) - 360, max(sstL$lon) -
360, min(sstL$lat), max(sstL$lat)))
bath2 = list(lon = sstL$lon - 360, lat = sstL$lat, data = matrix(s@data@values,
nrow = nrow(sstL$sstL), ncol = ncol(sstL$sstL), byrow = T))
bath2
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.