Description Usage Arguments Details Value Examples
Add or change coordinates in a HPDataFrame
.
This does not affect the argument object hpdf
.
Instead it returns a new HPDataFrame
with the desired coordinates. To change hpdf
directly see coords<-.HPDataFrame
.
1 2 | ## S3 method for class 'HPDataFrame'
coords(x, new.coords, healpixCentered = FALSE, ...)
|
x |
a HPDataFrame, |
new.coords |
specifies the new coordinate system ("spherical" or "cartesian") |
healpixCentered |
boolean. If TRUE then columns x,y,z
or theta, phi will be ignored and removed if present.
This forces the coordinates to be found from HEALPix
pixel indices only. Then the HEALPixCentered
attribute of |
... |
Unused arguments. |
If columns exist labelled x,y,z (cartesian) or theta, phi
(colatitude and longitude respectively), then these will be
treated as the coordinates of hpdf
and converted
accordingly.
If columns x,y,z or theta,phi are not present then the healpix
pixel indices as given by pix(hpdf)
are used for
assigning coordinates.
A HPDataFrame
with columns x,y,z (cartesian)
or theta, phi (colatitude and longitude respectively)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | df <- HPDataFrame(I = rep(0,12), nside = 1)
coords(df, new.coords = "cartesian")
# Notice that df is unchanged
df
# Instead, change df directly
coords(df) <- "spherical"
## specify cartesian coordinates then convert to spherical
hp1 <- HPDataFrame(x = c(1,0,0), y = c(0,1,0), z = c(0,0,1),
nside = 1, auto.spix = TRUE)
hp1 <- coords(hp1, new.coords = "spherical")
## Instead, ignore/drop existing coordinates and use HEALPix only
hp2 <- HPDataFrame(x = c(1,0,0), y = c(0,1,0), z = c(0,0,1),
nside = 1, auto.spix = TRUE)
hp2 <- coords(hp1, new.coords = "spherical", healpixCentered = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.