Skip to content

Added Benchmarking functions for scaling.py module #1445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions benchmarks/benchmarks/scaling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""
ASV benchmarks for scaling.py
"""

import pandas as pd
from pvlib import scaling
import numpy as np


class Scaling:

def setup(self):
self.n = 1000
lat = np.array((9.99, 10, 10.01))
lon = np.array((4.99, 5, 5.01))
self.coordinates = np.array([(lati, loni) for
(lati, loni) in zip(lat, lon)])
self.times = pd.date_range('2019-01-01', freq='1T', periods=self.n)
self.positions = np.array([[0, 0], [100, 0], [100, 100], [0, 100]])
self.clearsky_index = pd.Series(np.random.rand(self.n),
index=self.times)
self.cloud_speed = 5
self.tmscales = np.array((1, 2, 4, 8, 16, 32, 64,
128, 256, 512, 1024, 2048, 4096))

def time_latlon_to_xy(self):
scaling.latlon_to_xy(self.coordinates)

def time__compute_wavelet(self):
scaling._compute_wavelet(self.clearsky_index, dt=1)

def time__compute_vr(self):
scaling._compute_vr(self.positions, self.cloud_speed, self.tmscales)

def time_wvm(self):
scaling.wvm(self.clearsky_index, self.positions,
self.cloud_speed, dt=1)
1 change: 1 addition & 0 deletions docs/sphinx/source/whatsnew/v0.9.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Documentation
Benchmarking
~~~~~~~~~~~~~
* Updated version of numba in asv.conf from 0.36.1 to 0.40.0 to solve numba/numpy conflict. (:issue:`1439`, :pull:`1440`)
* Added benchmarks for the `pvlib.scaling` module (:pull:`1445`)
* Added a basic CI asv check (:issue:`1446`, :pull:`1454`)

Requirements
Expand Down