CoordinateSystems: Coordinate systems

Description Implemented coordinate systems Transformations between the system Options References See Also Examples

Description

Implemented Coordinate Systems.

Implemented coordinate systems

Transformations between the system

Cartesian systems cannot be transformed to earth or spherical coordinate systems, nor a spherical system to earth coordinates.

Options

coord_system

character. One of the values "auto", "cartesian", "earth"

If "auto", then the coordinates are considered as "cartesian" except the names of the given coordinates indicate a different system. Currently, only "longitude" and "latidute" (or abbreviations of them) are excepted as names for given coordinates and indicate an earth coordinate systems. See the examples below.

Default: "auto"

coordidx

integer vector of column numbers of the variables in the data frame. varidx can be set alternatively to coordnames. This parameter gives the coordinate columns in a data frame by starting column and ending column or the sequence. An NA in the second component means ‘until the end’.

coordnames

vector of characters that can be set alternatively to coordidx. This parameter gives the coordinate columns in a data frame by names. If it is "NA", then, depending on the context, either an error message is returned or it is assumed that the first columns give the coordinates.

coordunits

any string. If coordinate_system = "earth" and longitude and latitude are transformed to 3d cartesian coordinates, coordunits determines whether the radius is given in kilometers ("km") or miles ("miles"). If empty, then "km" is chosen.

Default: ""

new_coord_system

One of the values "keep", "cartesian", "earth", "plane".

  1. "keep"
    The coord_system is kept (except an explicit transformation is given, see RMtrafo.

    Note that some classes of models, e.g. completely monotone functions and compactly supported covariance models with range less than π are valid models on a sphere. In this case the models are considered as models on the sphere. See spherical models for lists.

  2. "cartesian"
    If coord_system is "earth" the coordinates are transformed to cartesian coordinates before any model is considered.

  3. "orthographic", "genomic"
    If coord_system is "earth" the locations are projected to a plane before any model is considered.

Default: "keep"

new_coordunits

internal and should not be set by the user.

Default: ""

polar_coord

logical. If FALSE the spherical coordinates agree with the earth coordinate parametrization, except that radians are used for spherical coordinates instead of degrees for the earth coordinates.

If TRUE the spherical coordinates signify polar coordinates.

Default : FALSE

varidx

integer vector of length 2. varidx can be set alternatively to varnames. This parameter gives the data columns in a data frame, either by starting column and ending column. An NA in the second component means ‘until the end’.

varnames

vector of characters that can be set alternatively to varidx. This parameter gives the data columns in a data frame by names.

if varnames equals "NA" then for keywords ‘data’, ‘value’ and ‘variable’ will be searched for keywords. If none of them are found, depending on the context, either an error message is returned or it is assumed that the last columns give the data.

varunits

vector of characters. The default units of the variables.

Default: ""

xyz_notation

logical or NA. Used by RMuser only.

NA : automatic choice (if possible)

FALSE : notation (x, y) should not be understood as kernel definition, not as xyz notation

TRUE: xyz notation used

zenit

two angles of the central projection direction for the gnomonic projection (https://en.wikipedia.org/wiki/Gnomonic_projection, https://de.wikipedia.org/wiki/Gnomonische_Projektion) and the orthographic projection, (https://en.wikipedia.org/wiki/Orthographic_projection_in_cartography, https://de.wikipedia.org/wiki/Orthografische_Azimutalprojektion).

If any(is.na(zenit)) then either the value of either of the components may not be NA, whose value will be denoted by p.

If p=1 then the mean of the locations is calculated; if p=Inf then the mean of the range is calculated.

Default: c(1, NA)

References

Covariance models in a cartesian system

Covariance models on a sphere

Tail correlation function

See Also

RMtrafo, RFearth2cartesian, RPdirect, models valid on a sphere, RFoptions.

Examples

 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
##                   RFoptions(seed=NA) to make them all random again

z <- 1:4
x <- cbind(z, 0)
y <- cbind(0, z)
model <- RMwhittle(nu=0.5)
RFcov(model, x, y, grid=FALSE) ##  standard is (cartesian) model


## same as above, but explicit:
RFcov(model, x, y, grid=FALSE, coord_sys="cartesian") 


## model is not valid on a sphere; x,y coordinates are
## transformed from earth coordinates to spherical coordinates
RFcov(model, x, y, grid=FALSE, coord_sys="earth")


## now the scale is chosen such that the covariance
## values are comparable to those in the cartesian case
RFcov(RMS(model, s= 1 / 180 * pi), x, y, grid=FALSE,
      coord_sys="earth")


## projection onto a plane first. Then the scale is interpreted
## in the usual, i.e. cartesian, sense, i.e. the model does not
## really make sense
RFoptions(zenit = c(2.5, 2.5))
RFcov(model, x, y, grid=FALSE,
      coord_sys="earth", new_coord_sys="orthographic")


## again, here the scale is chosen to be comparable to the cartesian case
## here the (standard) units are [km]
(z1 <- RFcov(RMS(model, s= 6350 / 180 * pi), x, y, grid=FALSE,
             coord_sys="earth", new_coord_sys="orthographic"))


## as above, but in miles
(z2 <- RFcov(RMS(model, s= 6350 / 1.609344 / 180 * pi), x, y, grid=FALSE,
             coord_sys="earth", new_coord_sys="orthographic",
             new_coordunits="miles"))
stopifnot(all.equal(z1, z2))


## again, projection onto a plane first, but now using the
## gnomonic projection
## here the (standard) units are [km]
(z1 <- RFcov(RMS(model, s= 6350 / 180 * pi), x, y, grid=FALSE,
             coord_sys="earth", new_coord_sys="gnomonic"))

## as above, but in miles
(z2 <- RFcov(RMS(model, s= 6350 / 1.609344 / 180 * pi), x, y, grid=FALSE,
             coord_sys="earth", new_coord_sys="gnomonic",
             new_coordunits="miles"))
stopifnot(all.equal(z1, z2, tol=1e-5))

RandomFields documentation built on Jan. 19, 2022, 1:06 a.m.