[Python] The highest position of the sun at the equinox [closed]

Discussão em 'Python' iniciado por Stack, Maio 20, 2025.

  1. Stack

    Stack Membro Participativo

    I'm oviously not allowed to ask about Skyfield specifically, because it's a library. I have no objections if someone explains the direct calculation to me. I hereby explicitly declare that I am also satisfied with a solution without a library, because I am lost.

    Is there an easy way to determine the highest position of the sun in a calendar year at one of the two equinoxes? Perhaps with almanac computation? Unfortunately, 12:00 is not always noon... (Should be around YYYY-03-20.)

    I found this, but am not sure if this is the right approach, since it gives the time and not the angle?

    import datetime as dt
    from pytz import timezone
    from skyfield import almanac
    from skyfield.api import N, W, wgs84, load

    zone = timezone('US/Eastern')
    now = zone.localize(dt.datetime.now())
    midnight = now.replace(hour=0, minute=0, second=0, microsecond=0)
    next_midnight = midnight + dt.timedelta(days=1)

    ts = load.timescale()
    t0 = ts.from_datetime(midnight)
    t1 = ts.from_datetime(next_midnight)
    eph = load('de421.bsp')
    bluffton = wgs84.latlon(40.8939 * N, 83.8917 * W)

    f = almanac.meridian_transits(eph, eph['Sun'], bluffton)
    times, events = almanac.find_discrete(t0, t1, f)

    # Select transits instead of antitransits.
    times = times[events == 1]

    t = times[0]
    tstr = str(t.astimezone(zone))[:19]
    print('Solar noon:', tstr)


    Additionally I am looking for highest position of the sun in one calendar year. (Should be around YYYY-06-21.)

    I am decent with the Skyfield library, which usually gives me the results I am looking for (and I love it very much), but I can't solve this maximum question.

    (It doesn't have to be ultra extra precise.)

    Continue reading...

Compartilhe esta Página