Created
February 28, 2017 02:53
-
-
Save jsta/41d89d8f9173fce0deedf41ef437eafd to your computer and use it in GitHub Desktop.
Calculate day length
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#'@references \url{http://aa.usno.navy.mil/data/docs/RS_OneYear.php} | |
#'@return A 3 x 365 data.frame of sunrise, sunset, date where times are in GMT | |
#'@examples \dontrun{ | |
#' sunsetrise_yr(year = 2015, lon_deg = 80, lon_min = 26, lat_deg = 25, lat_min = 5, tz = 5) | |
#' } | |
sunsetrise_yr <- function(year, lon_sign = -1, lon_deg, lon_min, lat_sign = 1, lat_deg, lat_min, tz, tz_sign = 1){ | |
url <- "http://aa.usno.navy.mil" | |
query <- list( | |
ID = "JS", | |
year = year, | |
task = 0, | |
lon_sign = lon_sign, | |
lon_deg = lon_deg, | |
lon_min = lon_min, | |
lat_sign = lat_sign, | |
lat_deg = lat_deg, | |
lat_min = lat_min, | |
tz = tz, | |
tz_sign = tz_sign) | |
rs <- httr::GET(url, path = "cgi-bin/aa_rstablew.pl", query = query) | |
strsplit(httr::content(rs, "text"), "\n")[[1]][19:62] | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This function and associated functions moved to a package at: https://github.com/jsta/twilight