8000 fix python 3.7 build on travis (#634) · shiyuning/pvlib-python@70032ab · GitHub
[go: up one dir, main page]

Skip to content

Commit 70032ab

Browse files
wholmgrencwhanse
authored andcommitted
fix python 3.7 build on travis (pvlib#634)
* update try python 3.7 * 3.7dev * new resize operation * whats new, comment
1 parent f821a73 commit 70032ab

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Bug fixes
7070
* Fix error in :func:`pvlib.clearsky.detect_clearsky` (:issue:`506`)
7171
* Fix documentation errors when using IPython >= 7.0.
7272
* Fix error in :func:`pvlib.modelchain.ModelChain.infer_spectral_model` (:issue:`619`)
73+
* Fix error in ``pvlib.spa`` when using Python 3.7 on some platforms.
7374

7475

7576
Testing

pvlib/spa.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -255,19 +255,16 @@ def nocompile(*args, **kwargs):
255255
[[4.0, 2.56, 6283.08]])
256256
}
257257

258-
259-
TABLE_1_DICT['L1'].resize((64, 3))
260-
TABLE_1_DICT['L2'].resize((64, 3))
261-
TABLE_1_DICT['L3'].resize((64, 3))
262-
TABLE_1_DICT['L4'].resize((64, 3))
263-
TABLE_1_DICT['L5'].resize((64, 3))
264-
265-
TABLE_1_DICT['B1'].resize((5, 3))
266-
267-
TABLE_1_DICT['R1'].resize((40, 3))
268-
TABLE_1_DICT['R2'].resize((40, 3))
269-
TABLE_1_DICT['R3'].resize((40, 3))
270-
TABLE_1_DICT['R4'].resize((40, 3))
258+
resize_mapping = {
259+
'L1': (64, 3), 'L2': (64, 3), 'L3': (64, 3), 'L4': (64, 3), 'L5': (64, 3),
260+
'B1': (5, 3), 'R1': (40, 3), 'R2': (40, 3), 'R3': (40, 3), 'R4': (40, 3)}
261+
262+
# make arrays uniform size for efficient broadcasting in numba, fill with 0s
263+
# np.resize does not work because it fills with repeated copies
264+
for key, dims in resize_mapping.items():
265+
new_rows = dims[0] - TABLE_1_DICT[key].shape[0]
266+
TABLE_1_DICT[key] = np.append(TABLE_1_DICT[key], np.zeros((new_rows, 3)),
267+
axis=0)
271268

272269

273270
HELIO_LONG_TABLE = np.array([TABLE_1_DICT['L0'],

0 commit comments

Comments
 (0)
0