Skip to content

NA returned for night with some coordinates via getSunlightTimes #13

@mfidino

Description

@mfidino

Using suncalc 0.5.0

Some code that recreates the issue:

suncalc::getSunlightTimes(
  date = as.Date("2018-05-24"),
  lat = 53.53043,
  lon = -113.51,
  keep = c("dusk", "night", "dawn","nightEnd"),
  tz = "US/Mountain"
)

which returns

        date      lat     lon                dusk night                dawn nightEnd
1 2018-05-24 53.53043 -113.51 2018-05-24 22:30:49  <NA> 2018-05-24 04:33:53     <NA>

Working through the time calculations it looks as if it is tied to the .hourAngle() function. Essentially, the value that gets evaluated within acos() is < -1 and therefore returns NA. Warnings are suppressed here and does not return any type of recognition to the user that this is something that there is trouble to calculate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions