File: CoordinateSystems.Rd

package info (click to toggle)
r-cran-randomfields 3.3.14-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,916 kB
  • sloc: cpp: 52,159; ansic: 3,015; makefile: 2; sh: 1
file content (297 lines) | stat: -rw-r--r-- 10,077 bytes parent folder | download
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
\name{Coordinate systems}
\alias{zenit}
\alias{Coordinate systems}
\alias{coordinate systems}
\alias{coordinate system}
\alias{coordinates}
\title{Coordinate systems}
\description{
  Implemented Coordinate Systems.
}
\section{Implemented coordinate systems}{
  \itemize{
    \item Cartesian coordinate system
    \item Earth coordinate systems\cr
    The earth is considered as an ellipsoid;
    The first angle takes values in \eqn{[0, 360)},
    the second angle takes values in \eqn{[-90, 90]}.
    \item Spherical coordinate systems\cr
    The earth is considered as an ellipsoid;
    The first angle takes values in \eqn{[0, 2\pi)},
    the second angle takes values in \eqn{[-\pi/2, \pi/2]}.
  }
}

\section{Transformations between the system}{
  \itemize{
    \item Earth to cartesian\cr
    The 3-dimensional resulting coordinates
    are either given in \sQuote{km} or in \sQuote{miles}.
    \item Gnomonic and orthographic projections\cr
    The 2-dimensional resulting coordinates
    are either given in \sQuote{km} or in \sQuote{miles}.
    The projection direction is given by the \code{zenit}.
    \item Earth to spherical\cr
    In this case the Earth is considered as a ball.    
  }
  Cartesian systems cannot be transformed to earth or spherical
  coordinate systems, nor a spherical system to earth coordinates.
}

\section{Options}{
  \describe{
    \item{\code{coord_system}}{character.
      One of the values \code{"auto"}, \code{"cartesian"}, \code{"earth"}
      %   \code{"polar"}, \code{"cylindric"}, \code{"spherical"},
      
      If \code{"auto"}, then the coordinates are considered as
      \code{"cartesian"} except the names of the given coordinates
      indicate a
      different system. Currently, only \code{"longitude"} and
      \code{"latidute"} (or abbreviations of them) are excepted
      as names for given coordinates
      and indicate an earth coordinate systems. See the examples below.
      
      Default: \code{"auto"}
    }

    
    \item{\code{coordidx}}{integer vector of column numbers of the variables in
      the data frame. \code{varidx} can be set alternatively to
      \code{coordnames}.
      This parameter gives the coordinate columns in a data frame
      by starting column and ending column or the sequence.
      An \code{NA} in the second component  means
      \sQuote{until the end}.    
    }
    
    \item{\code{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 \code{"NA"}, then, depending on the context, either
      an error message is returned or it is assumed that the first
      columns give the coordinates.    
    }
    
    \item{\code{coordunits}}{any string.     
      If \code{coordinate_system = "earth"} and longitude and latitude
      are transformed to 3d cartesian coordinates, \code{coordunits}
      determines 
      whether the radius is given in kilometers (\code{"km"}) or miles
      (\code{"miles"}).
      If empty, then \code{"km"} is chosen.
      
      Default: \code{""}
    }
    
  
    \item{\code{new_coord_system}}{
      One of the values \code{"keep"}, \code{"cartesian"}, \code{"earth"},
      \code{"plane"}.
      %   \code{"polar"}, \code{"cylindric"}, \code{"spherical"},
      
      \enumerate{
	\item \code{"keep"}\cr
	The \code{coord_system} is kept (except an explicit transformation
	is given, see \command{\link{RMtrafo}}.

	Note that some classes of models, e.g. completely monotone
	functions and compactly supported covariance models with
	range less than \eqn{\pi} are valid models on a sphere.
	In this case the models are considered as models on the sphere.
	See \link{spherical models} for lists.
      
      \item \code{"cartesian"}\cr
      If \code{coord_system} is \code{"earth"} the coordinates are transformed
      to cartesian coordinates before any model is considered.
      
      \item \code{"orthographic"}, \code{"genomic"} \cr
      If \code{coord_system} is \code{"earth"} the locations are projected
      to a plane before any
      model is considered.
    }
   
    Default: \code{"keep"}
  }

  \item{\code{new_coordunits}}{internal and should not be set by the user.
    
    Default: \code{""}
  }
  
  \item{\code{polar_coord}}{logical.
    If \code{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 \code{TRUE} the spherical coordinates signify polar coordinates.

    Default : \code{FALSE}
  }

  
  \item{\code{varidx}}{integer vector of length 2.
    \code{varidx} can be set alternatively to
    \code{varnames}.
    This parameter gives the data columns in a data frame, either
    by starting column and ending column.
    An \code{NA} in the second component  means
    \sQuote{until the end}.    
  }
 
  \item{\code{varnames}}{vector of characters that can be set
    alternatively to \code{varidx}.  This parameter gives
  the data columns in a data frame by names.

  if \code{varnames} equals \code{"NA"}
  then for keywords \sQuote{data},
    \sQuote{value} and \sQuote{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.    
  }
     
  \item{\code{varunits}}{vector of characters.
    The default units of the variables.
    
    Default: \code{""}
  }


  \item{\code{xyz_notation}}{logical or \code{NA}. Used by
    \code{\link{RMuser}} only.  

    \code{NA} : automatic choice (if possible)
   
    \code{FALSE} : notation (x, y) should not be understood as kernel definition, not as xyz notation
    
    \code{TRUE}: xyz notation used

    % \code{2}:this value is only used by calls of RFcov and should not
    % be used by a user
  }

 \item{\code{zenit}}{two angles of the central
   projection direction for the gnomonic projection
   (\url{https://en.wikipedia.org/wiki/Gnomonic_projection},
    \url{https://de.wikipedia.org/wiki/Gnomonische_Projektion})
    and the orthographic projection,
  (\url{https://en.wikipedia.org/wiki/Orthographic_projection_in_cartography},
   \url{https://de.wikipedia.org/wiki/Orthografische_Azimutalprojektion}).

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

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

    Default: \code{c(1, NA)}
  }
  
}

}

\references{
  Covariance models in a cartesian system
  \itemize{
    \item Schlather, M. (2011) Construction of covariance functions and
    unconditional simulation of random fields. In Porcu, E., Montero, J.M.
    and Schlather, M., \emph{Space-Time Processes and Challenges Related
      to Environmental Problems.} New York: Springer.
  }

  Covariance models on a sphere
  \itemize{
    \item Gneiting, T. (2013) Strictly and non-strictly positive definite
    functions on spheres.
    \emph{Bernoulli}, \bold{19}, 1327-1349.
  }

  Tail correlation function
  \itemize{
    \item Strokorb, K., Ballani, F., and  Schlather, M. (2014)
    Tail correlation functions of max-stable processes: Construction
    principles, recovery and diversity of some mixing max-stable
    processes with identical TCF. 
    \emph{Extremes}, \bold{} Submitted.
  }
 }


\seealso{
  \command{\link{RMtrafo}},
  \command{\link{RFearth2cartesian}},
  \command{\link{RPdirect}},
  \command{\link[=spherical models]{models valid on a sphere}},
  \command{\link{RFoptions}}.
}
\examples{\dontshow{StartExample()}
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))




\dontshow{FinalizeExample()}}


\keyword{spatial}