[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pysolar-discuss] Definition of horizon


Hi Jonas,

I think the elevation value is used in just two places:
https://github.com/pingswept/pysolar/blob/master/pysolar/solar.py#L295 and a few lines later at https://github.com/pingswept/pysolar/blob/master/pysolar/solar.py#L300

I would not be surprised to learn that the approximations used in those two functions were only reliable near the surface of the earth. On the other hand, I'm not convinced that they're unreliable either.

I guess I would start solving the problem by trying to figure out how much the sunrise should change based on some basic geometry, imagining a spherical earth and a 100 km mountain on the equator. Then I'd try to understand the functions linked above in more detail.

Good luck,
Brandon


On 3/12/2018 10:17:03 AM, Jonas Hagen <jonas.hagen@xxxxxxxxxxxx> wrote:
Hi

Is it right that pysolar uses the astronomical horizon definition (https://en.wikipedia.org/wiki/Horizon#/media/File:Horizons.svg [https://en.wikipedia.org/wiki/Horizon#/media/File:Horizons.svg])?
I got confused, because the documentation states "The altitude is positive when the sun is above the horizon." and I immediately associated this with sunrise.

Background:

(I am using the master branch version.)
I am trying to get sunrise and sunset times in high elevations (up to 100 km above sea level). As the get_{altitude|position}() functions take an elevation argument, I would expect them to return a different value for sun altitude, based on the given elevation.
>>> import datetime >>> from pysolar import solar >>> sunrise_time = datetime.datetime(2018,3,12,6,55,0) >>> solar.get_position(46.95, 7.47, sunrise_time, elevation=100000) (95.03439124507312, 0.5961510806209467) >>> solar.get_position(46.95, 7.47, sunrise_time, elevation=0) (95.03439124029069, 0.596183960394498)
The difference between the two altitudes is in the order of 3e-5 and thus much less than expected. What is the elevation parameter and how could I get the sun altitude in arbitrary elevations?
If the astronomical horizon is used

Best regards,
Jonas

References:
[pysolar-discuss] Definition of horizonJonas Hagen <jonas.hagen@xxxxxxxxxxxx>