Skip to content

Fix total irrad #77

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
Jul 12, 2015
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
1 change: 1 addition & 0 deletions docs/sphinx/source/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ What's New

These are new features and improvements of note in each release.

.. include:: whatsnew/v0.2.1.txt
.. include:: whatsnew/v0.2.0.txt
.. include:: whatsnew/v0.1.0.txt
18 changes: 18 additions & 0 deletions docs/sphinx/source/whatsnew/v0.2.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. _whatsnew_0210:

v0.2.1 (July 13, 2015)
-----------------------

This is a minor release from 0.2.1. It includes a large number of bug fixes
for the IPython notebook tutorials.
We recommend that all users upgrade to this version.

Bug fixes
~~~~~~~~~

* Fix incorrect call to Perez irradiance function (:issue:`76`)

Contributors
~~~~~~~~~~~~

* Will Holmgren
13 changes: 8 additions & 5 deletions pvlib/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,19 @@ def total_irrad(surface_tilt, surface_azimuth,
if model == 'isotropic':
sky = isotropic(surface_tilt, dhi)
elif model == 'klutcher':
sky = klucher(surface_tilt, surface_azimuth, dhi, ghi, solar_zenith, solar_azimuth)
sky = klucher(surface_tilt, surface_azimuth, dhi, ghi,
solar_zenith, solar_azimuth)
elif model == 'haydavies':
sky = haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra, solar_zenith, solar_azimuth)
sky = haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
solar_zenith, solar_azimuth)
elif model == 'reindl':
sky = reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra, solar_zenith,
solar_azimuth)
sky = reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra,
solar_zenith, solar_azimuth)
elif model == 'king':
sky = king(surface_tilt, dhi, ghi, solar_zenith)
elif model == 'perez':
sky = perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra, solar_zenith, solar_azimuth, AM,
sky = perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
solar_zenith, solar_azimuth, airmass,
modelt=model_perez)
else:
raise ValueError('invalid model selection {}'.format(model))
Expand Down
14 changes: 14 additions & 0 deletions pvlib/test/test_irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,20 @@ def test_perez():
ephem_data['apparent_azimuth'], AM)


def test_total_irrad():
models = ['isotropic', 'klutcher', 'haydavies', 'reindl', 'king', 'perez']
AM = atmosphere.relativeairmass(ephem_data['apparent_zenith'])

for model in models:
total = irradiance.total_irrad(
32, 180,
ephem_data['apparent_zenith'], ephem_data['azimuth'],
dni=irrad_data['dni'], ghi=irrad_data['ghi'], dhi=irrad_data['dhi'],
dni_extra=dni_et, airmass=AM,
model=model,
surface_type='urban')


def test_globalinplane():
aoi = irradiance.aoi(40, 180, ephem_data['apparent_zenith'],
ephem_data['apparent_azimuth'])
Expand Down