Describe the bug
The function poa_horizontal_ratio gives negative values when the sun is behind the array.
To Reproduce
pvlib.irradiance.poa_horizontal_ratio(60, 90, 60, 270)
-0.99999999999999933
Expected behavior
pvlib.irradiance.poa_horizontal_ratio(60, 90, 60, 270)
0.0
Versions:
pvlib.__version__: '0.5.2'
pandas.__version__: '0.19.2'
- python: 3.5.1
Additional context
Similar problems were fixed in other irradiance functions already (#526).