From fa51231c4fc3a54aafaab8d1430cbf787827a6fa Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Fri, 23 Dec 2022 16:17:10 -0700 Subject: [PATCH 1/7] slight changes to min asv config --- benchmarks/asv.conf.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmarks/asv.conf.json b/benchmarks/asv.conf.json index c3340f4e15..9bc019bd8e 100644 --- a/benchmarks/asv.conf.json +++ b/benchmarks/asv.conf.json @@ -115,13 +115,13 @@ { "python": "3.7", "build": "", - "numpy": "1.16.0", + "numpy": "1.16.5", "pandas": "0.25.0", "scipy": "1.4.0", // Note: these don't have a minimum in setup.py - "h5py": "2.10.0", + "h5py": "3.1.0", "ephem": "3.7.6.0", - "numba": "0.40.0", + "numba": "0.40.0" }, // latest versions available { From 4b83c8fceaf5fad3f3e1288f085d5f089de9c5eb Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Fri, 23 Dec 2022 16:17:41 -0700 Subject: [PATCH 2/7] infite sheds benchmark --- benchmarks/benchmarks/infinite_sheds.py | 68 +++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 benchmarks/benchmarks/infinite_sheds.py diff --git a/benchmarks/benchmarks/infinite_sheds.py b/benchmarks/benchmarks/infinite_sheds.py new file mode 100644 index 0000000000..19d20c1bd2 --- /dev/null +++ b/benchmarks/benchmarks/infinite_sheds.py @@ -0,0 +1,68 @@ +""" +ASV benchmarks for infinite_sheds.py +""" + +import numpy as np +import pandas as pd +from pvlib.bifacial import infinite_sheds +from pvlib import location, tracking + + +class InfiniteSheds: + + def setup(self): + self.times = pd.date_range(start='20180601', freq='1min', + periods=14400) + self.location = location.Location(40, -80) + self.solar_position = self.location.get_solarposition(self.times) + self.clearsky_irradiance = self.location.get_clearsky(self.times) + self.surface_tilt = 20 + self.surface_azimuth = 180 + self.gcr = 0.35 + self.height = 2.5 + self.pitch = 5. + self.albedo = 0.2 + self.npoints = 100 + + with np.errstate(invalid='ignore'): + self.tracking = tracking.singleaxis( + self.solar_position['apparent_zenith'], + self.solar_position['azimuth'], + axis_tilt=0, + axis_azimuth=0, + max_angle=60, + backtrack=True, + gcr=self.gcr + ) + + def time_get_irradiance_poa_fixed(self): + infinite_sheds.get_irradiance_poa( + surface_tilt=self.surface_tilt, + surface_azimuth=self.surface_azimuth, + solar_zenith=self.solar_position['apparent_zenith'], + solar_azimuth=self.solar_position['azimuth'], + gcr=self.gcr, + height=self.height, + pitch=self.pitch, + ghi=self.clearsky_irradiance['ghi'], + dhi=self.clearsky_irradiance['dhi'], + dni=self.clearsky_irradiance['dni'], + albedo=self.albedo, + npoints=self.npoints + ) + + def time_get_irradiance_poa_tracking(self): + infinite_sheds.get_irradiance_poa( + surface_tilt=self.tracking['surface_tilt'], + surface_azimuth=self.tracking['surface_azimuth'], + solar_zenith=self.solar_position['apparent_zenith'], + solar_azimuth=self.solar_position['azimuth'], + gcr=self.gcr, + height=self.height, + pitch=self.pitch, + ghi=self.clearsky_irradiance['ghi'], + dhi=self.clearsky_irradiance['dhi'], + dni=self.clearsky_irradiance['dni'], + albedo=self.albedo, + npoints=self.npoints + ) \ No newline at end of file From 3ff475fbb8249312b4691082342d311de3a031c8 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Fri, 23 Dec 2022 18:47:49 -0700 Subject: [PATCH 3/7] get_irradiance benchmarks --- benchmarks/benchmarks/infinite_sheds.py | 36 +++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/benchmarks/benchmarks/infinite_sheds.py b/benchmarks/benchmarks/infinite_sheds.py index 19d20c1bd2..334666904e 100644 --- a/benchmarks/benchmarks/infinite_sheds.py +++ b/benchmarks/benchmarks/infinite_sheds.py @@ -12,7 +12,7 @@ class InfiniteSheds: def setup(self): self.times = pd.date_range(start='20180601', freq='1min', - periods=14400) + periods=8760*25) self.location = location.Location(40, -80) self.solar_position = self.location.get_solarposition(self.times) self.clearsky_irradiance = self.location.get_clearsky(self.times) @@ -65,4 +65,36 @@ def time_get_irradiance_poa_tracking(self): dni=self.clearsky_irradiance['dni'], albedo=self.albedo, npoints=self.npoints - ) \ No newline at end of file + ) + + def time_get_irradiance_fixed(self): + infinite_sheds.get_irradiance( + surface_tilt=self.surface_tilt, + surface_azimuth=self.surface_azimuth, + solar_zenith=self.solar_position['apparent_zenith'], + solar_azimuth=self.solar_position['azimuth'], + gcr=self.gcr, + height=self.height, + pitch=self.pitch, + ghi=self.clearsky_irradiance['ghi'], + dhi=self.clearsky_irradiance['dhi'], + dni=self.clearsky_irradiance['dni'], + albedo=self.albedo, + npoints=self.npoints + ) + + def time_get_irradiance_tracking(self): + infinite_sheds.get_irradiance( + surface_tilt=self.tracking['surface_tilt'], + surface_azimuth=self.tracking['surface_azimuth'], + solar_zenith=self.solar_position['apparent_zenith'], + solar_azimuth=self.solar_position['azimuth'], + gcr=self.gcr, + height=self.height, + pitch=self.pitch, + ghi=self.clearsky_irradiance['ghi'], + dhi=self.clearsky_irradiance['dhi'], + dni=self.clearsky_irradiance['dni'], + albedo=self.albedo, + npoints=self.npoints + ) From 60e2fe2e4df1f3cf861fd2ee3c4e21fbb88bd0cb Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Fri, 23 Dec 2022 18:47:56 -0700 Subject: [PATCH 4/7] whatsnew --- docs/sphinx/source/whatsnew.rst | 1 + docs/sphinx/source/whatsnew/v0.9.5.rst | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew.rst b/docs/sphinx/source/whatsnew.rst index 464e59f121..d32104e889 100644 --- a/docs/sphinx/source/whatsnew.rst +++ b/docs/sphinx/source/whatsnew.rst @@ -6,6 +6,7 @@ What's New These are new features and improvements of note in each release. +.. include:: whatsnew/v0.9.5.rst .. include:: whatsnew/v0.9.4.rst .. include:: whatsnew/v0.9.3.rst .. include:: whatsnew/v0.9.2.rst diff --git a/docs/sphinx/source/whatsnew/v0.9.5.rst b/docs/sphinx/source/whatsnew/v0.9.5.rst index adf31d02f6..edc30560ec 100644 --- a/docs/sphinx/source/whatsnew/v0.9.5.rst +++ b/docs/sphinx/source/whatsnew/v0.9.5.rst @@ -32,7 +32,7 @@ Documentation Benchmarking ~~~~~~~~~~~~~ - +* Added benchmarks for :py:mod:`pvlib.bifacial.infinite_sheds` Requirements ~~~~~~~~~~~~ @@ -41,3 +41,4 @@ Requirements Contributors ~~~~~~~~~~~~ +* Will Holmgren (:ghuser:`wholmgren`) From 514340608545e49ba309a80b913432f1fba19326 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Wed, 28 Dec 2022 07:55:22 -0700 Subject: [PATCH 5/7] Update docs/sphinx/source/whatsnew/v0.9.5.rst Co-authored-by: Kevin Anderson --- docs/sphinx/source/whatsnew/v0.9.5.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.9.5.rst b/docs/sphinx/source/whatsnew/v0.9.5.rst index edc30560ec..4bda042190 100644 --- a/docs/sphinx/source/whatsnew/v0.9.5.rst +++ b/docs/sphinx/source/whatsnew/v0.9.5.rst @@ -32,7 +32,7 @@ Documentation Benchmarking ~~~~~~~~~~~~~ -* Added benchmarks for :py:mod:`pvlib.bifacial.infinite_sheds` +* Added benchmarks for :py:mod:`pvlib.bifacial.infinite_sheds` (:pull:`1627`) Requirements ~~~~~~~~~~~~ From 98a4b1f64c63d7b83ce8d49fef8ecb610bf9b1ad Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Wed, 28 Dec 2022 13:53:26 -0700 Subject: [PATCH 6/7] one day --- benchmarks/benchmarks/infinite_sheds.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/benchmarks/infinite_sheds.py b/benchmarks/benchmarks/infinite_sheds.py index 334666904e..47ad2ac01c 100644 --- a/benchmarks/benchmarks/infinite_sheds.py +++ b/benchmarks/benchmarks/infinite_sheds.py @@ -12,7 +12,7 @@ class InfiniteSheds: def setup(self): self.times = pd.date_range(start='20180601', freq='1min', - periods=8760*25) + periods=1440) self.location = location.Location(40, -80) self.solar_position = self.location.get_solarposition(self.times) self.clearsky_irradiance = self.location.get_clearsky(self.times) From c1c999a12590c582c4b699479dede86dde1e6731 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Wed, 28 Dec 2022 14:07:52 -0700 Subject: [PATCH 7/7] cleanup --- benchmarks/benchmarks/infinite_sheds.py | 5 ++++- docs/sphinx/source/whatsnew/v0.9.5.rst | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/benchmarks/benchmarks/infinite_sheds.py b/benchmarks/benchmarks/infinite_sheds.py index 47ad2ac01c..573cf19d7a 100644 --- a/benchmarks/benchmarks/infinite_sheds.py +++ b/benchmarks/benchmarks/infinite_sheds.py @@ -15,7 +15,10 @@ def setup(self): periods=1440) self.location = location.Location(40, -80) self.solar_position = self.location.get_solarposition(self.times) - self.clearsky_irradiance = self.location.get_clearsky(self.times) + self.clearsky_irradiance = self.location.get_clearsky( + self.times, + solar_position=self.solar_position, + ) self.surface_tilt = 20 self.surface_azimuth = 180 self.gcr = 0.35 diff --git a/docs/sphinx/source/whatsnew/v0.9.5.rst b/docs/sphinx/source/whatsnew/v0.9.5.rst index 4bda042190..32b785fbfd 100644 --- a/docs/sphinx/source/whatsnew/v0.9.5.rst +++ b/docs/sphinx/source/whatsnew/v0.9.5.rst @@ -40,5 +40,5 @@ Requirements Contributors ~~~~~~~~~~~~ - +* Kevin Anderson (:ghuser:`kanderso-nrel`) * Will Holmgren (:ghuser:`wholmgren`)