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

Sun-satellite angle ranges are not consistent #18

Closed
adybbroe opened this issue Jan 17, 2018 · 1 comment
Closed

Sun-satellite angle ranges are not consistent #18

adybbroe opened this issue Jan 17, 2018 · 1 comment

Comments

@adybbroe
Copy link
Contributor

from pyorbital.orbital import get_observer_look
from pyorbital.astronomy import get_alt_az, sun_zenith_angle
from datetime import datetime
import numpy as np

dtobj = datetime(2018, 1, 16, 14, 0)
lons, lats = np.array([-30., -27.]), np.array([0., 0.1])

sunz = sun_zenith_angle(dtobj, lons, lats)
sata, satel = get_observer_look(-75., 0., 35786023.0, dtobj, lons, lats, 0)
sunalt, suna = get_alt_az(dtobj, lons, lats)
suna = np.rad2deg(suna)

print(suna)
print(sata)

The above code produce the following output:

[ 173.60123028 -178.56645841]
[  90.          269.90995988]

So, the sun azimuth angles seem to be in the range of -180 to 180, but the satellite azimuth angles are in the range of 0 and 360.

I suggest that PyOrbital always return angles in degrees between -180 and 180!

@adybbroe
Copy link
Contributor Author

The thing is that the above azimuth angles should result in nearly the same azimuth differences. When you pass under the sun as above, the two angles jump, but the relative difference should not.

print(suna - sata)
# [  83.60123028 -448.47641828]

ssadiff = np.mod(suna - sata, 360)
ssadiff = np.where(ssadiff > 180, 360 - ssadiff, ssadiff)
print(ssadiff)
# [ 83.60123028  88.47641828]

But, if you had done something like this (as it was in Satpy before January 16, 2018) the azimuth difference angles jump!:

ssadiff = np.abs(suna - sata)
ssadiff
# array([  83.60123028,  448.47641828])

ssadiff = np.where(ssadiff > 180, 360 - ssadiff, ssadiff)
ssadiff
# array([ 83.60123028, -88.47641828])

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