Skip to content

Commit

Permalink
Handle the case where an AltAz is stored inside a SkyCoord
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Jun 12, 2019
1 parent 668afe2 commit 5605173
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion python/astro_metadata_translator/observationInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import copy

import astropy.time
from astropy.coordinates import SkyCoord, AltAz

from .translator import MetadataTranslator
from .properties import PROPERTIES
Expand Down Expand Up @@ -176,7 +177,15 @@ def _is_property_ok(cls, property, value):
if value is None:
return True

if not isinstance(value, cls._PROPERTIES[property][2]):
property_type = cls._PROPERTIES[property][2]

# For AltAz coordinates, they can either arrive as AltAz or
# as SkyCoord(frame=AltAz) so try to find the frame inside
# the SkyCoord.
if issubclass(property_type, AltAz) and isinstance(value, SkyCoord):
value = value.frame

if not isinstance(value, property_type):
return False

return True
Expand Down

0 comments on commit 5605173

Please sign in to comment.