get_sunrise_sunset: Get sunrise and sunset times by day, latitude, and longitude

View source: R/functions.R

get_sunrise_sunsetR Documentation

Get sunrise and sunset times by day, latitude, and longitude

Description

Get sunrise and sunset times by day, latitude, and longitude

Usage

get_sunrise_sunset(
  chosen_date,
  latitude = NULL,
  longitude = NULL,
  survey = NULL,
  station = NULL,
  verbose = FALSE,
  timezone = "US/Alaska"
)

Arguments

chosen_date

Date or charater. Formatted as "YYYY-MM-DD"

latitude

Numeric. Fill in only if survey and station are not entered. latitude in either decimal degrees or a character latitude in degrees and decimal minutes

longitude

Numeric. Fill in only if survey and station are not entered. Longitude in either decimal degrees or a character longitude in degrees and decimal minutes

survey

Character. Fill in only if latitude and longitude are not entered. A character string of the survey you are interested in reivewing. Options are those from public_data$survey, which are "AI", "GOA", "EBS", "NBS", "BSS".

station

Character. Fill in only if latitude and longitude are not entered. A character string of the current station name (as a grid cell; e.g., "264-85"). Stations defined in the station_coords dataset.

verbose

Logical. Default = FALSE. If you would like a readout of what the file looks like in the console, set to TRUE.

timezone

Character. Default = "US/Alaska." Other options include: "US/Aleutian"

Value

Time of sunrise and sunset in text. Also shows a pop-up with sunrise and sunset times.

Examples

# Find times based on lat/lon for today's date, where date is a date object
get_sunrise_sunset(chosen_date = Sys.Date(),
                   latitude = 63.3,
                   longitude = -170.5)

# Find times based on lat/lon for today's date, where date is a character
# and lat/lon in degree decimal-minutes
get_sunrise_sunset(chosen_date = "2023-06-05",
                   latitude = "63 18.0",
                   longitude = "-170 30.0")

# Find times based on a survey (AI) station's recorded lat/lon for today's date
get_sunrise_sunset(chosen_date = "2025-06-10",
                   survey = "AI",
                   station = "8-55")

# Find times based on a survey (GOA) station's recorded lat/lon for today's date
get_sunrise_sunset(chosen_date = Sys.Date(),
                   survey = "GOA",
                   station = "264-18-511") 

# Find times based on a survey (EBS) station's recorded lat/lon for today's date
get_sunrise_sunset(chosen_date = "2025-08-04",
                   survey = "EBS",
                   station = "P-31")

# Find times based on a survey (NBS) station's recorded lat/lon for today's date
get_sunrise_sunset(chosen_date = "2025-06-04",
                   survey = "NBS",
                   station = "ZZ-01")

EmilyMarkowitz-NOAA/GAPsurvey documentation built on April 14, 2025, 9:26 a.m.