Giter VIP home page Giter VIP logo

Comments (2)

jh-12345 avatar jh-12345 commented on June 3, 2024

Hi again. I'm sure not if it's helpful or even a problem but I've noticed that the Location.solar_elevation function returns values that are not entirely consistent with the dusk/dawn functions.

For example, the following program prints the solar elevation at each minute of the day, for the same date and location as above:

import astral
import datetime
import pytz

location = astral.Location(("Test name", "Test region", 56.1629, 0, "Europe/Berlin", 0))
tz = pytz.timezone(location.timezone)

beginning_of_day = tz.localize(datetime.datetime(2017, 5, 3))
for i in range(24*60):
    time = beginning_of_day + datetime.timedelta(minutes=i)
    elev = location.solar_elevation(time)

    print(str(time) + ": " + str(elev))

The following is a sample of the output:

[output omitted]
2017-05-03 01:32:00+02:00: -17.969160095
2017-05-03 01:33:00+02:00: -17.9839581501
2017-05-03 01:34:00+02:00: -17.9981449878
2017-05-03 01:35:00+02:00: -18.0117201924
2017-05-03 01:36:00+02:00: -18.0246833656
2017-05-03 01:37:00+02:00: -18.0370341267
[output omitted]
2017-05-03 02:17:00+02:00: -18.0267245776
2017-05-03 02:18:00+02:00: -18.0138599232
2017-05-03 02:19:00+02:00: -18.0003830874
2017-05-03 02:20:00+02:00: -17.9862944615
2017-05-03 02:21:00+02:00: -17.9715944546
2017-05-03 02:22:00+02:00: -17.956283493
[output omitted]

This shows that, according toLocation.solar_elevation, the sun goes below 18 degrees approximately at 1:34 AM while the dusk time reported by Location.dusk is 1:29:52 AM.
And according toLocation.solar_elevation the astronomical dawn should be around 2:19 AM.

I hope this is helpful somehow. :)

from astral.

Swamp-Ig avatar Swamp-Ig commented on June 3, 2024

I've come across the same issue as above. The forward and reverse calculations don't quite match up.

I had a look at the maths but I don't know enough about it to figure it out.

from astral.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.