Skip to content

Linke turbidity out of bounds error at (90, 180) #262

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

Closed
mikofski opened this issue Nov 14, 2016 · 0 comments · Fixed by #264
Closed

Linke turbidity out of bounds error at (90, 180) #262

mikofski opened this issue Nov 14, 2016 · 0 comments · Fixed by #264
Labels
Milestone

Comments

@mikofski
Copy link
Member

Some of the edge cases don't work:

>>> from pvlib.clearsky import lookup_linke_turbidity
>>> import pandas as pd
>>> time = pd.DatetimeIndex(start='1/1/2016', end='1/2/2016', freq='H')
>>> import os
>>> lookup_linke_turbidity(time, 90, 180, os.path.join('Downloads', 'LinkeTurbidities.mat'))

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\pvlib\clearsky.py", line 210, in lookup_linke_turbidity
    g = linke_turbidity_table[latitude_index][longitude_index]
IndexError: index 4320 is out of bounds for axis 0 with size 4320

Should be an easy fix, I will try to submit something today, and obviously since these edge cases are north and south poles, I don't think that this issue occurs very often if ever - nevertheless, it should be handled gracefully.

mikofski added a commit to mikofski/pvlib-python that referenced this issue Nov 15, 2016
* set minimum index as 0 not 1
* adjust _linearly_scale so that is increments are 5 minutes or 1/12 of an
 arcdegree from the centers of neighboring indices
* this fixes the out of bounds error for latitudes or longitudes at the
 limits of the range
* move _linearly_scale to be right after lookup_linke_turbidity
* add link to pdf on AOD and LT from MeteoTest
* raise IndexError if outputmatrix is more than half an index outside of
 the limits

Signed-off-by: Mark Mikofski <[email protected]>
@wholmgren wholmgren added the bug label Nov 16, 2016
@wholmgren wholmgren added this to the 0.4.2 milestone Nov 16, 2016
wholmgren pushed a commit that referenced this issue Nov 18, 2016
* fix #263 and #262

* set minimum index as 0 not 1
* adjust _linearly_scale so that is increments are 5 minutes or 1/12 of an
 arcdegree from the centers of neighboring indices
* this fixes the out of bounds error for latitudes or longitudes at the
 limits of the range
* move _linearly_scale to be right after lookup_linke_turbidity
* add link to pdf on AOD and LT from MeteoTest
* raise IndexError if outputmatrix is more than half an index outside of
 the limits

Signed-off-by: Mark Mikofski <[email protected]>

* unset debug logging

Signed-off-by: Mark Mikofski <[email protected]>

* remove logging and use pytest with raises context

Signed-off-by: Mark Mikofski <[email protected]>

* all test passing now

Signed-off-by: Mark Mikofski <[email protected]>

* fixes #265

* use calendar month days instead of approximation of monthly middles
* also account for leap years
* if all years are leap years, or not any are leap years, use fast interp,
 otherwise loop and interpolate each timestamp
* add _leapyear tests and update expected values for new interpolated
 Linke turbidity factors

Signed-off-by: Mark Mikofski <[email protected]>

* update expected values for test_location.test_get_clearsky

Signed-off-by: Mark Mikofski <[email protected]>

* update test_modelchain.py with new expected values for PR #264

Signed-off-by: Mark Mikofski <[email protected]>

* add (at)requires_scipy and update whatsnew v0.4.2

Signed-off-by: Mark Mikofski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants