You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow frames to set a default wrap angle for longitudes #11767
In #11676, a new HADec frame is introduced, for which the natural range for the longitude (hour angle) is -12 to 12 hours. We had to add a hack to ensure the default wrap angle for [Unit]SphericalRepresentation is overwritten, similar to the hack used in SkyOffsetFrame (and perhaps similar to what is done in sunpy?). It would be good if the frame_specific_representation_info could also give a default wrap_angle.
defrepresent_as(self, base, s='base', in_frame_units=False):
data=super().represent_as(base, s, in_frame_units=in_frame_units)
# If a frame wrap angle is set, use that wrap angle for any spherical representations.ifself._wrap_angleisnotNoneand \
isinstance(data, (UnitSphericalRepresentation, SphericalRepresentation)):
data.lon.wrap_angle=self._wrap_anglereturndata
Any of our frame classes can change the inherited class variable _wrap_angle from its default value of 180 degrees.
Activity
mkbrewer commentedon May 21, 2021
I should think that the required range should be inherent in the definition ofunits.hourangle.Never mind.
ayshih commentedon May 21, 2021
Since you mentioned SunPy, here's a reminder for how we've implemented it in our base frame (sunpy/sunpy#3223, inspired by #7462 (comment)):
https://github.com/sunpy/sunpy/blob/e0289b1aae66c667c43e36a306ba274b666fbfd4/sunpy/coordinates/frames.py#L141-L148
Any of our frame classes can change the inherited class variable
_wrap_anglefrom its default value of 180 degrees.