vbonvin / POUET

Programming Observations Usefully at Euler Telescope
GNU General Public License v3.0
1 stars 1 forks source link

Angle to wind is potentially wrongly computed #64

Closed vbonvin closed 5 years ago

vbonvin commented 5 years ago

I just stumbled upon a potential bug in the way the angle to wind is computed. In obs.py, compute_angletowind we use

angletowind = abs(winddirection-self.azimuth.degree)

this is too simplistic. If one angle is smaller than 0, or the diff between the two larger than 180 we might get a wrong diff angle with this formula.

A proper approach would be to use astropy angular_separation utility as follow

angle_utilities.angular_separation(azi, 0, wd, 0)*360./( 2 * 3.1416)

kuntzer commented 5 years ago

Okay. I pushed it.

I just want to mention that using angle_utilities may not be a good idea: see this Astropy GitHub thread why. We should be constructing SkyCoord instances and use the separation method instead.

I'm not sure changing this is worth the effort.

Since the main point of this issue is solved, I close it.