Skip to content

improve speed of Location.get_airmass #528

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 3 commits into from
Aug 14, 2018
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
3 changes: 3 additions & 0 deletions docs/sphinx/source/whatsnew/v0.6.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pvlib/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down