Skip to content
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

Argument to asin() above 1 in get_azimuth_fast? #52

Open
timseed opened this issue Jul 8, 2017 · 3 comments
Open

Argument to asin() above 1 in get_azimuth_fast? #52

timseed opened this issue Jul 8, 2017 · 3 comments

Comments

@timseed
Copy link

timseed commented Jul 8, 2017

As previously reported this method returns an error:

This fails using

import pysolar
import datetime

az=pysolar.solar.get_azimuth_fast(48, 14, datetime.datetime(2015, 3, 10, 16, 30))
print('{}'.format(az))

The reason for there failure is the asin function is being given a value of (1.1); Which is out of bounds... This can be resolved by using %1.

The solution is to change the line in Solar.py

From:

  azimuth_rad = math.asin(math.cos(declination_rad) * math.sin(hour_angle_rad) / math.cos(altitude_rad))

To:
azimuth_rad = math.asin( (math.cos(declination_rad) * math.sin(hour_angle_rad) / math.cos(altitude_rad))%1)

I have not checked to see if this may occur in the get_azimuth method.

@pingswept
Copy link
Owner

I suspect you're on the right track here. Any thoughts on when or why asin is getting called with values above 1? I'm hesitant to just wipe out values above 1 without understanding why they're appearing in the first place.

@timseed
Copy link
Author

timseed commented Jul 11, 2017 via email

@pingswept
Copy link
Owner

If anyone can replicate this, I'd be interested in the details.

@pingswept pingswept changed the title Math Domain Error in get_azimuth_fast Argument to asin() above 1 in get_azimuth_fast? Dec 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants