Skip to content

OverflowError: math range error when calculating get_radiation_direct at sunrise. #148

@SamuelLarkin

Description

@SamuelLarkin

Hi,
I came across a bug where, at first glance, there seems to be a problem calculating the direct radiation right around sunrise and sunset.

Here's the error message.

2022-03-29 06:36:32 - collector.elevation - INFO - Going up.
Exception in thread Collector:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/home/balta/git/Hepa/collector/collector.py", line 537, in run
    self.update_sun_position()
  File "/home/balta/git/Hepa/collector/collector.py", line 519, in update_sun_position
    self.sun.update(
  File "/home/balta/git/Hepa/collector/collector.py", line 95, in update
    rad = radiation.get_radiation_direct(date, self.elevation)
  File "/home/balta/git/Hepa/venv/lib/python3.9/site-packages/pysolar/radiation.py", line 50, in get_radiation_direct
    return flux * math.exp(-1 * optical_depth * air_mass_ratio) * is_daytime
OverflowError: math range error

I'm using pysolar==0.10.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions