Tract-methods: Methods for "Tract" Object Construction in package 'sampSurf'

Description Methods

Description

There are several methods available for the Tract generic function, which will generate valid objects of class "Tract". These constructors are the preferred method for generating such objects instead of using new. Other constructors could be added by extention to these method as required.

Methods

signature(object = "missing")

Several of the constructors listed below end up calling this one for final object construction, so it could be considered the base constructor. It is patterned after the construction of a "GridTopology" object in the ‘sp’ package. Please note that it is best to either explicitly name the arguments when using this constructor, or to include an initial missing argument (see examples in the generic) to invoke it, since supplying an unnamed numeric scalar as the first argument will instead, invoke the second constructor below (with an error).

usage...

Tract(cellSize,
      cellDims = c(x=100, y=100), 
      cellCenter = NULL,
      units = 'metric',
      data = 0,
      spUnits = CRS(projargs=as.character(NA)),
      description = 'object of class Tract',
      runQuiet = FALSE,
      ... )
  • cellSize: The size of the individual grid cells in the appropriate units. Note particularly that the restriction has been made that grid cells must be square, so this is expecting a numeric scalar.

  • cellDims: The dimensions in terms of number of cells in the x and y directions. The to match a desired extent in terms of the units of x and y, one must take the cellSize into account when determining these limits. For example, if the extent in the x and y directions are to be 10 units, and the cellSize is 0.5 units, then the specify this argument as c(x=20,y=20).

  • cellCenter: This is the center point for the grid cell at the origin of the tract. If the cellSize is 0.5 units and the minimum in x and y is (0,0), then this would be c(x=0.25, y=0.25). Note that we can specify lower limts other than zero for the tract using this method.

  • units: Either “English” or “metric”. These must be conformable with the projection in spUnits.

  • data: The default is to set all grid cells to zero. One can either specify a numeric scalar which will be replicated for all cells, or a numeric vector the same length as the number of grid cells; these will be assigned in sequence to the grid.

  • spUnits: A valid CRS object specifying the Coordinate Reference System. This defaults to NA, which means you want to use your own user-defined system, say for a sample plot located in the field.

  • description: A character vector description of the tract.

  • runQuiet: TRUE: suppress any messages; FALSE: echo messages.

  • ...: Other arguments to be passed along (not used currently).

signature(object = "numeric")

In this second constructor, the object argument should be a numeric vector specifying the maximum extents of the tract. The tract minimum is always assumed to be at (0,0) for this method. If some other minima is desired, use one of the other constructors.

usage...

Tract(object = c(x=10, y=10),
      cellSize,
      units = 'metric',
      data = 0,
      spUnits = CRS(projargs=as.character(NA)),
      description = 'object of class Tract',
      runQuiet = FALSE,
      ... )
  • object: A length two vector with names c("x", "y") specifying the maximal extents of the tract in these coordinates.

  • runQuiet: TRUE: suppress any messages; FALSE: echo messages.

  • ...: Other arguments to be passed along.

  • All other arguments as defined for the other constructors above.

signature(object = "matrix")

This construtor allows creation of a “Tract” object using a bounding box specification.

usage...

Tract(object, 
      cellSize,
      units = 'metric',
      data = 0,
      spUnits = CRS(projargs=as.character(NA)),
      description = 'object of class Tract',
      runQuiet = FALSE,
      ... )
  • object: A 2x2 matrix with rownames c("x","y") and column names c("min","max"). The matrix therefore specifies the bounding box extents in the plane. The origin can be anywhere.

  • All other arguments as defined for the other constructors above.

signature(object = "RasterLayer")

Finally this constructor takes an object of class “RasterLayer”.

usage...

Tract(object, 
      units = 'metric',
      description = 'object of class Tract',
      runQuiet = FALSE,
      ... )
  • object: A valid object of type "RasterLayer".

  • All other arguments as defined for the other constructors above.


sampSurf documentation built on March 5, 2021, 3:01 p.m.