Skip to content

Commit c2fd03a

Browse files
Added Benchmarking functions for scaling.py module (#1445)
* Added Benchmarking functions for * Solved more Stickler CI issues * Updated v0.9.2.rst * Made changes in code formatting Co-authored-by: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>
1 parent 91986b9 commit c2fd03a

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

benchmarks/benchmarks/scaling.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
ASV benchmarks for scaling.py
3+
"""
4+
5+
import pandas as pd
6+
from pvlib import scaling
7+
import numpy as np
8+
9+
10+
class Scaling:
11+
12+
def setup(self):
13+
self.n = 1000
14+
lat = np.array((9.99, 10, 10.01))
15+
lon = np.array((4.99, 5, 5.01))
16+
self.coordinates = np.array([(lati, loni) for
17+
(lati, loni) in zip(lat, lon)])
18+
self.times = pd.date_range('2019-01-01', freq='1T', periods=self.n)
19+
self.positions = np.array([[0, 0], [100, 0], [100, 100], [0, 100]])
20+
self.clearsky_index = pd.Series(np.random.rand(self.n),
21+
index=self.times)
22+
self.cloud_speed = 5
23+
self.tmscales = np.array((1, 2, 4, 8, 16, 32, 64,
24+
128, 256, 512, 1024, 2048, 4096))
25+
26+
def time_latlon_to_xy(self):
27+
scaling.latlon_to_xy(self.coordinates)
28+
29+
def time__compute_wavelet(self):
30+
scaling._compute_wavelet(self.clearsky_index, dt=1)
31+
32+
def time__compute_vr(self):
33+
scaling._compute_vr(self.positions, self.cloud_speed, self.tmscales)
34+
35+
def time_wvm(self):
36+
scaling.wvm(self.clearsky_index, self.positions,
37+
self.cloud_speed, dt=1)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Documentation
2929
Benchmarking
3030
~~~~~~~~~~~~~
3131
* Updated version of numba in asv.conf from 0.36.1 to 0.40.0 to solve numba/numpy conflict. (:issue:`1439`, :pull:`1440`)
32+
* Added benchmarks for the `pvlib.scaling` module (:pull:`1445`)
3233
* Added a basic CI asv check (:issue:`1446`, :pull:`1454`)
3334

3435
Requirements

0 commit comments

Comments
 (0)