From 65e6837368fda248005ab2df4616c95373140464 Mon Sep 17 00:00:00 2001 From: pvlib-benchmarker <77211855+Naman-Priyadarshi@users.noreply.github.com> Date: Mon, 18 Apr 2022 15:13:34 +0530 Subject: [PATCH 1/4] Added Benchmarking functions for --- benchmarks/benchmarks/scaling.py | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 benchmarks/benchmarks/scaling.py diff --git a/benchmarks/benchmarks/scaling.py b/benchmarks/benchmarks/scaling.py new file mode 100644 index 0000000000..e6192f7748 --- /dev/null +++ b/benchmarks/benchmarks/scaling.py @@ -0,0 +1,33 @@ +""" +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) From 5cd58c58066d86b4d9b70c166d4dcdde365cab48 Mon Sep 17 00:00:00 2001 From: Naman Priyadarshi <77211855+Naman-Priyadarshi@users.noreply.github.com> Date: Mon, 18 Apr 2022 20:44:58 +0530 Subject: [PATCH 2/4] Updated v0.9.2.rst --- docs/sphinx/source/whatsnew/v0.9.2.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/sphinx/source/whatsnew/v0.9.2.rst b/docs/sphinx/source/whatsnew/v0.9.2.rst index 1982759bf5..75595a72dc 100644 --- a/docs/sphinx/source/whatsnew/v0.9.2.rst +++ b/docs/sphinx/source/whatsnew/v0.9.2.rst @@ -23,6 +23,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 Benchmarking for :py:func:`pvlib.scaling.latlon_to_xy`, :py:func:`pvlib.scaling._compute_wavelet`, :py:func:`pvlib.scaling._compute_vr`, and :py:func:`pvlib.scaling.wvm` functions for the module `scaling` Requirements ~~~~~~~~~~~~ From 816093b83ac1c265ea919bf4559daaaca0adf586 Mon Sep 17 00:00:00 2001 From: pvlib-benchmarker <77211855+Naman-Priyadarshi@users.noreply.github.com> Date: Mon, 18 Apr 2022 15:25:29 +0530 Subject: [PATCH 3/4] Made changes in code formatting --- benchmarks/benchmarks/scaling.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/benchmarks/benchmarks/scaling.py b/benchmarks/benchmarks/scaling.py index e6192f7748..452c76c42b 100644 --- a/benchmarks/benchmarks/scaling.py +++ b/benchmarks/benchmarks/scaling.py @@ -13,12 +13,14 @@ 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.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)) + 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) @@ -30,4 +32,5 @@ 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) + scaling.wvm(self.clearsky_index, self.positions, + self.cloud_speed, dt=1) From 3fe33a8da5aaf479db0bd9d0690c3bd191310388 Mon Sep 17 00:00:00 2001 From: pvlib-benchmarker <77211855+Naman-Priyadarshi@users.noreply.github.com> Date: Mon, 18 Apr 2022 15:31:19 +0530 Subject: [PATCH 4/4] Solved more Stickler CI issues --- benchmarks/benchmarks/scaling.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/benchmarks/benchmarks/scaling.py b/benchmarks/benchmarks/scaling.py index 452c76c42b..8c2ed1471b 100644 --- a/benchmarks/benchmarks/scaling.py +++ b/benchmarks/benchmarks/scaling.py @@ -13,13 +13,14 @@ 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 + 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.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, + self.tmscales = np.array((1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096)) def time_latlon_to_xy(self):