Learn R Programming

GeoLight (version 2.0.0)

coord: Simple Threshold Geolocation Estimates

Description

Estimate location from consecutive twilights

Usage

coord(tFirst, tSecond, type, twl, degElevation = -6, tol = 0, method = "NOAA", note = TRUE)

Arguments

tFirst
vector of sunrise/sunset times (e.g. 2008-12-01 08:30).
tSecond
vector of of sunrise/sunset times (e.g. 2008-12-01 17:30).
type
vector of either 1 or 2, defining tFirst as sunrise or sunset respectively.
twl
data.frame containing twilights and at least tFirst, tSecond and type (alternatively give each parameter separately).
degElevation
the sun elevation angle (in degrees) that defines twilight (e.g. -6 for "civil twilight"). Either a single value, a vector with the same length as tFirst or nrow(x).
tol
tolerance on the sine of the solar declination (only implemented in method 'NOAA').
method
Defines the method for the location estimates. 'NOAA' is based on code and the excel spreadsheet from the NOAA site (http://www.esrl.noaa.gov/gmd/grad/solcalc/), 'Montenbruck' is based on Montenbruck, O. & Pfleger, T. (2000) Astronomy on the Personal Computer. Springer, Berlin.
note
logical, if TRUE a notation of how many positions could be calculated in proportion to the number of failures will be printed at the end.

Value

A matrix of coordinates in decimal degrees. First column are longitudes, expressed in degrees east of Greenwich. Second column contains the latitudes in degrees north the equator.

Details

This function estimates the location given the times at which the observer sees two successive twilights.

Longitude is estimated by computing apparent time of local noon from sunrise and sunset, and determining the longitude for which this is noon. Latitude is estimated from the required zenith and the sun's hour angle for both sunrise and sunset, and averaged.

When the solar declination is near zero (at the equinoxes) latitude estimates are extremely sensitive to errors. Where the sine of the solar declination is less than tol, the latitude estimates are returned as NA.

The format (date and time) of tFirst and tSecond has to be "yyyy-mm-dd hh:mm" corresponding to Universal Time Zone UTC (see: as.POSIXct, time zones)

Examples

Run this code
data(hoopoe2)
  hoopoe2$tFirst <- as.POSIXct(hoopoe2$tFirst, tz = "GMT")
  hoopoe2$tSecond <- as.POSIXct(hoopoe2$tSecond, tz = "GMT")
crds <- coord(hoopoe2, degElevation=-6, tol = 0.2)
## tripMap(crds, xlim=c(-20,20), ylim=c(5,50), main="hoopoe2")

Run the code above in your browser using DataLab