axis_transform: Abstract axis transform.

Description Usage Arguments Details

View source: R/discrete.R

Description

An axis transform may be rectlinear or affine. The shear affine (3 parameters per axis) case is rarely needed in this context, we leave it for later. Rectilinear is wasteful for the 2 parameter affine but it's so worthwhile because of the extra simplicity that we accept the inefficiency for now.

Usage

1
2
3
4
5
6
7
axis_transform(x, ...)

## Default S3 method:
axis_transform(x, coord = NULL, affine = NULL, ...)

## S3 method for class 'd_axis'
axis_transform(x, coord = NULL, affine = NULL, ...)

Arguments

x

a discretizable-axis input

Details

In the context of an axis being recitlinar or affine (2 parameters), it may in fact be "degenerate", in different ways. Any discretization axis has two possible (and sensible) default affine transforms, one is "scaled", to exist within the interval \[0,1\]. The second is to exist within the interval \[0,n\] where 'n' is the number of discrete steps within the axis. If the transform is not specified, we must choose one or the other. 'graphics::image' and 'raster::raster' choose the first, as can be seen when called on a ‘matrix'. it’s not like those packages are in agreement, however - the first interprets the interval as being a half-cell offset, but the latter fits literally within the range. A rectlinear axis is a bit simpler, in that it is degenerate if its index is identical to its coordinate. To get real work done we choose to proceed within the interval \[0,n\] which has the advantage of the degenerate case still being simply informative about the structure of the original data, with a straightforward correspondence between structural position and "coordinate". The angstroms package takes this approach for dealing with curvlinear rasters that fit neither an affine or "non-degenerate" rectilinear transform. The raster package only deals with the affine case (support for 3-parameters per axis is present, but rarely used). Raster is terribly powerful though, as an I/O and "abstract discretization" engine, and can be coaxed into service for rectlinear and curvlinear cases relatively easily (see angstroms).

Rectilinear that isn't degenerate also has the problem of explicit bounds on the interval, which it usually won't specify in NetCDF as it has "centre coordinates". That's not always true but it's wild enough to be a problem.

Affine is not supported yet, the primary motivation for this is to have sets of rectlinear axes (even if they are degenerate affine) as this is completely absent from anywhere in the R ecosystem as far as I can tell.

If you are looking for affine transformation I suggest the spatstat or sf packages as starting points, but there are many other packages that implement these basic tools in various ways.


hypertidy/discrete documentation built on April 7, 2018, 11:11 p.m.