Skip to content

RuntimeWarning: invalid value encountered in arccos #13

@juliangilbey

Description

@juliangilbey

This seems a little strange; presumably some calculation is ending up trying to take arccos of a number greater than 1 (or less than -1), which might indicate a more significant issue.

from datetime import datetime
from suncalc import get_times

date = datetime(2023, 5, 24)
lon = 0
lat = 51.5
get_times(date, lon, lat)

Running this (with suncalc 0.1.3 from PyPI) gives:

/<PATH>/suncalc-env/lib/python3.11/site-packages/suncalc/suncalc.py:202: RuntimeWarning: invalid value encountered in arccos
  return acos((sin(h) - sin(phi) * sin(d)) / (cos(phi) * cos(d)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions