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

Fix numpy deprecation #133

Closed mborsetti closed 3 years ago

mborsetti commented 3 years ago

When running tests I saw repeated warnings from numpy (current version):

DeprecationWarning: parsing timezone aware datetimes is deprecated; this will raise an error in the future

The documentation at https://numpy.org/devdocs/reference/arrays.datetime.html#basic-datetimes warns:

Deprecated since version 1.11.0: NumPy does not store timezone information. For backwards compatibility, datetime64 still parses timezone offsets, which it handles by converting to UTC. This behaviour is deprecated and will raise an error in the future

This patch converts datetimes to UTC and strips them of the timezone information before they're fed into numpy. All unit tests pass.