MazamaScience / MazamaSatelliteUtils

Satellite Data Download and Utility Functions
http://mazamascience.github.io/MazamaSatelliteUtils
GNU Lesser General Public License v3.0
0 stars 0 forks source link

getDaylightHours() #57

Closed jonathancallahan closed 5 years ago

jonathancallahan commented 5 years ago

I think we still want a getDaylightHours() function that will work like this:


getDaylightHours <- function(
  datetime = NULL,
  bbox = CONUS
) {
  # validate, etc.
  # figure out timezone from bbox 

  # Calculate single day, hourly time axis
  datetime <- MazamaCoreUtils::parseDatetime(datetime, timezone = timezone)
  start <- lubridate::floor_date(datetime, unit = "day")
  end <- start + lubridate::dhours(23)
  hours <- seq(start, end, by = "hour")

  # Subset to only daylight hours
  daylightMask <- isDaylight(hours, box)
  hours <- hours[daylightMask]

  return(hours)

}
lagerratrobe commented 5 years ago

Per conversation, we agreed this won't be needed.