pingswept / pysolar

Pysolar is a collection of Python libraries for simulating the irradiation of any point on earth by the sun. It includes code for extremely precise ephemeris calculations.
http://pysolar.org
GNU General Public License v3.0
372 stars 125 forks source link

get_sunrise_sunset_transit referred to UTC not to local time #137

Closed Kuenlun closed 3 years ago

Kuenlun commented 3 years ago

Hi, I've been using the get_sunrise_sunset_transit function to calculate the sunrise, sunset and transit time in my current location, using my local timezone. The problem is that this function calculates the sunrise, sunset and transit time of the UTC day in local time, but would be more logic to calculate the sunrise, sunset and transit time of the current local day in local time. For example: I'm in Madrid timezone (+1), and when I calculate the sunrise time at local time 29/11/2020_00:30:00 (UTC 28/11/2020_23:30:00) it correctly gives me back the sunrise time in local time, but from the day 28 not from the 29.

I've removed 'utc' from 'utctimetuple()' which gets rid of that behavior. I don't really know if this behavior has been implemented on purpose but for the current program I'm making it makes no sense. Thanks

pingswept commented 3 years ago

Thanks for the patch, Juan Luis! Pysolar previously did everything in UTC. I suspect this was a remnant from that approach. Thanks for catching it.