Skip to content

add 'nrel' spa option for ET irradiance, fix doy - 1 bug #215

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 12 commits into from
Jul 13, 2016

Conversation

wholmgren
Copy link
Member

This PR adds a new 'nrel' option to irradiance.extraradiation that uses the well tested ephemeris code in spa.py. It also fixes the doy - 1 bug described in #211.

My plan is to let #214 sit for another day for comments, merge it, and then rebase/merge this PR.

@wholmgren wholmgren added this to the 0.4.0 milestone Jul 11, 2016
@wholmgren
Copy link
Member Author

Here are some benchmarks:

times = pd.DatetimeIndex(start='2015', end='2016', freq='1min')

In [40]: %timeit pvlib.irradiance.extraradiation(times, method='nrel', how='numba')
1 loop, best of 3: 1.67 s per loop

In [41]: %timeit pvlib.irradiance.extraradiation(times, method='nrel')
1 loop, best of 3: 3.87 s per loop

In [42]: %timeit pvlib.irradiance.extraradiation(times, method='pyephem')
1 loop, best of 3: 8.34 s per loop

In [43]: %timeit pvlib.irradiance.extraradiation(times, method='spencer')
10 loops, best of 3: 45.8 ms per loop

In [44]: %timeit pvlib.irradiance.extraradiation(times, method='asce')
10 loops, best of 3: 26 ms per loop

I was hoping that the nrel method would be faster, but it's still an improvement over pyephem.

@wholmgren
Copy link
Member Author

A sloppy copy/paste job led to an unnecessary slow line of code in solarposition.nrel_earthsun_distance. I removed the slow line and reran the tests:

In [61]: times = pd.DatetimeIndex(start='2015', end='2016', freq='1min')

In [62]: %timeit pvlib.irradiance.extraradiation(times, method='nrel', how='numba')
The slowest run took 10.33 times longer than the fastest. This could mean that an intermediate result is being cached.
1 loop, best of 3: 215 ms per loop

In [63]: %timeit pvlib.irradiance.extraradiation(times, method='nrel')
1 loop, best of 3: 953 ms per loop

In [64]: %timeit pvlib.irradiance.extraradiation(times, method='pyephem')
1 loop, best of 3: 7.9 s per loop

In [65]: %timeit pvlib.irradiance.extraradiation(times, method='spencer')
10 loops, best of 3: 64.4 ms per loop

In [66]: %timeit pvlib.irradiance.extraradiation(times, method='asce')
10 loops, best of 3: 28.5 ms per loop

@wholmgren wholmgren merged commit 51d7ecc into pvlib:master Jul 13, 2016
@wholmgren wholmgren deleted the discrefactor branch July 13, 2016 15:54
Jacc0027 added a commit to Jacc0027/pvlib-python that referenced this pull request Nov 1, 2021
kandersolar added a commit that referenced this pull request Jun 23, 2023
* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Merge branch 'Spectral-corrections' of https://github.com/Jacc0027/pvlib-python into Spectral-corrections

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update pvlib/atmosphere.py

Co-authored-by: Kevin Anderson <[email protected]>

* relocation of parameter descriptions according to the order of input parameters

* Update api.rst

Adding atmosphere.AM_AOD_PW_spectral correction as requested in #1296

* remove input screening

* move reference values to be optional parameters

* fix implementation issues

* first cut at tests using file from Jacc0027

* CI correction. Line #215

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Testing tests

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update atmosphere.py

* Test Review

* Update atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

* Update test_atmosphere.py

* Update atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update pvlib/atmosphere.py

Co-authored-by: Cliff Hansen <[email protected]>

* Update atmosphere.py

Added the requested changes

* Update atmosphere.py

Fixed 2 blank line errors.

* Update test_atmosphere.py

Updated test function name to: caballero_spectral_correction

* Update api.rst

Updated the atmosphere function name from AM_AOD_PW_spectral_correction to caballero_spectral_correction

* Update test_atmosphere.py

Updated some functions calls from AM_AOD_PW_spectral_correction to caballero_spectral_correction

* Update atmosphere.py

Updated the logic to show errors.

* Update pvlib/atmosphere.py

Co-authored-by: Cliff Hansen <[email protected]>

* Update pvlib/atmosphere.py

Co-authored-by: Cliff Hansen <[email protected]>

* Update pvlib/atmosphere.py

Co-authored-by: Cliff Hansen <[email protected]>

* Update pvlib/atmosphere.py

Co-authored-by: Cliff Hansen <[email protected]>

* Update pvlib/atmosphere.py

Co-authored-by: Cliff Hansen <[email protected]>

* Update pvlib/atmosphere.py

Co-authored-by: Cliff Hansen <[email protected]>

* Update atmosphere.py

* Update atmosphere.py

* Update atmosphere.py

Trying to solve #814 and #817 issues.

* Update atmosphere.py

* Update api.rst

* Delete api.rst

* Update test_atmosphere.py

* Update atmosphere.py

* Update test_atmosphere.py

* Update atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* Update test_atmosphere.py

* update function logic and get tests working

* Update atmosphere.py

Updated both "TODO" issues.

* Update atmosphere.py

* Update v0.9.6.rst

Added caballero spectral correction as a new function.

* Update airmass_atmospheric.rst

Added a new function: atmosphere.caballero_spectral_correction

* Update pvlib/atmosphere.py

Co-authored-by: Anton Driesse <[email protected]>

* rename function and move to pvlib.spectrum

following the conventions set out in #1628

* misc cleanup

- reorder and rename parameters to match #1768
- remove reference parameters
- shorten/simplify docstring
- restructure calculation to be more readable

---------

Co-authored-by: Kevin Anderson <[email protected]>
Co-authored-by: Kevin Anderson <[email protected]>
Co-authored-by: Cliff Hansen <[email protected]>
Co-authored-by: Anton Driesse <[email protected]>
Co-authored-by: Kevin Anderson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant