make.3Dgrid {GSIF}R Documentation

Methods to prepare 3D prediction locations

Description

Generates a list of objects of type "SpatialPixelsDataFrame" with longitude, latitude and altitude coordinates (these names are used by default for compatibility with the geosamples-class).

Usage

## S4 method for signature 'SpatialPixelsDataFrame'
make.3Dgrid(obj, 
      proj4s = get("ref_CRS", envir = GSIF.opts), 
      pixsize = get("cellsize", envir = GSIF.opts)[2], 
      resampling_method = "bilinear", 
      NAflag = get("NAflag", envir = GSIF.opts), 
      stdepths = get("stdepths", envir = GSIF.opts), 
      tmp.file = TRUE, show.output.on.console = TRUE, ...)
## S4 method for signature 'RasterBrick'
make.3Dgrid(obj, 
      proj4s = get("ref_CRS", envir = GSIF.opts), 
      pixsize = get("cellsize", envir = GSIF.opts)[2], 
      resampling_method = "bilinear", 
      NAflag = get("NAflag", envir = GSIF.opts), 
      stdepths = get("stdepths", envir = GSIF.opts), 
      tmp.file = TRUE, show.output.on.console = TRUE, ...)

Arguments

obj

object of class "SpatialPixelsDataFrame" or "RasterBrick"

proj4s

character; proj4string describing the target coordinate system

pixsize

grid cell size in decimal degrees (set by default at 1/1200 (0.0008333333 or 100 m around equator)

resampling_method

character; resampling method to be passed the reprojection algorithm

NAflag

character; missing value flag

stdepths

numeric; list of standard depths

tmp.file

logical; specifies whether a temporary file name should be generated

show.output.on.console

logical; specifies whether to print out the progress

...

optional arguments that can be passed to the reprojetion algorithm

Value

The output is list of objects of class "SpatialPixelsDataFrame" where the number of elements in the list corresponds to the number of standard depths.

Note

If the input object is of class "SpatialPixelsDataFrame", the method by default uses FWTools (warp command) to resample grids, otherwise the raster::projectRaster command is passed. FWTools must be installed separately.
Note: this operation can be time consuming for large areas (e.g. >> 1e6 pixels).

Author(s)

Tomislav Hengl

References

See Also

spc, geosamples-class, plotKML::reproject

Examples

## grids Ebergotzen:
library(plotKML)
library(rgdal)
library(raster)

data(eberg_grid)
gridded(eberg_grid) <- ~x+y
proj4string(eberg_grid) <- CRS("+init=epsg:31467")
##  convert to spatial components:
formulaString <- ~ PRMGEO6+DEMSRT6+TWISRT6+TIRAST6
eberg_spc <- spc(eberg_grid, formulaString)
## create 3D locations in the original coordinate system:
eberg_3Dxy <- sp3D(eberg_spc@predicted)
## Not run: ## wrapper function to create 3D locations in the default WGS84 system:
eberg_3D <- make.3Dgrid(eberg_spc@predicted)
image(eberg_3D[[1]]["PC1"])
## downscale 100 m resolution imagery to 25 m:
data(eberg_grid25)
gridded(eberg_grid25) <- ~x+y
proj4string(eberg_grid25) <- CRS("+init=epsg:31467")
eberg_grid25@data <- cbind(eberg_grid25@data, 
    warp(eberg_grid, pixsize=eberg_grid25@grid@cellsize[1], 
    GridTopology=eberg_grid25@grid, resampling_method="cubicspline")@data)
## this function requires FWTools!

## End(Not run)

[Package GSIF version 0.5-5 Index]