Skip to content

Commit 5a14156

Browse files
authored
Corrected future warning in solarposition.py (#1256)
* Corrected future warning in solarposition.py - corrected code to avoid: casting datetime64[ns, Europe/Berlin] values to int64 with .astype(...) is deprecated and will raise in a future version. Use .view(...) instead. * Update v0.9.0.rst
1 parent 699f591 commit 5a14156

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/sphinx/source/whatsnew/v0.9.0.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ Bug fixes
175175
* Corrected an error affecting :py:func:`~pvlib.clearsky.detect_clearsky`
176176
when data time step is not one minute. Error was introduced in v0.8.1.
177177
(:issue:`1241`, :pull:`1242`)
178+
* Corrected :py:func:`~pvlib.solarposition.spa_python` to avoid a future warning. (:pull:`1256`)
178179

179180
Testing
180181
~~~~~~~
@@ -212,3 +213,4 @@ Contributors
212213
* Miguel Sánchez de León Peque (:ghuser:`Peque`)
213214
* Joe Ranalli (:ghuser:`jranalli`)
214215
* Chas Schweizer (:ghuser:`cpr-chas`)
216+
* Yoann Louvet (:ghuser:`YoannUniKS`)

pvlib/solarposition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def spa_python(time, latitude, longitude,
365365
except (TypeError, ValueError):
366366
time = pd.DatetimeIndex([time, ])
367367

368-
unixtime = np.array(time.astype(np.int64)/10**9)
368+
unixtime = np.array(time.view(np.int64)/10**9)
369369

370370
spa = _spa_python_import(how)
371371

0 commit comments

Comments
 (0)