From 34310ca9cad3828465fc7d31aa9871393e0c8447 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Sun, 12 Aug 2018 18:05:10 -0700 Subject: [PATCH 1/3] PERF speciify time index in location.get_airmass --- pvlib/location.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/location.py b/pvlib/location.py index 1404bb18b0..df02858641 100644 --- a/pvlib/location.py +++ b/pvlib/location.py @@ -271,7 +271,7 @@ def get_airmass(self, times=None, solar_position=None, airmass_absolute = atmosphere.get_absolute_airmass(airmass_relative, pressure) - airmass = pd.DataFrame() + airmass = pd.DataFrame(index=solar_position.index) airmass['airmass_relative'] = airmass_relative airmass['airmass_absolute'] = airmass_absolute From 50252aa5dc74276ff5deb8da731685ef8630b273 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Sun, 12 Aug 2018 18:29:38 -0700 Subject: [PATCH 2/3] PERF speciify time index in ModelChain.prepare_inputs --- pvlib/modelchain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index f9beeb684e..0b6f184847 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -736,7 +736,7 @@ def prepare_inputs(self, times=None, weather=None): if weather is not None: self.weather = weather if self.weather is None: - self.weather = pd.DataFrame() + self.weather = pd.DataFrame(index=times) if times is not None: self.times = times From 180561df89ecf836a9bf0d4a5c52e3ed951470cc Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Sun, 12 Aug 2018 18:33:45 -0700 Subject: [PATCH 3/3] update whatsnew --- docs/sphinx/source/whatsnew/v0.6.0.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/sphinx/source/whatsnew/v0.6.0.rst b/docs/sphinx/source/whatsnew/v0.6.0.rst index c116fb18c5..7458e3f017 100644 --- a/docs/sphinx/source/whatsnew/v0.6.0.rst +++ b/docs/sphinx/source/whatsnew/v0.6.0.rst @@ -93,6 +93,9 @@ Enhancements * Add PVSyst thin-film recombination losses for CdTe and a:Si (:issue:`163`) * Python 3.7 officially supported. (:issue:`496`) * Improve performance of solarposition.ephemeris. (:issue:`512`) +* Improve performance of Location.get_airmass. Most noticeable when + solar position is supplied, time index length is less than 10000, and + method is looped over. (:issue:`502`) Bug fixes