asdf_astropy/converters/coordinates/sky_coord.py
raw| 1 | from asdf.extension import Converter |
| 2 | |
| 3 | |
| 4 | class SkyCoordConverter(Converter): |
| 5 | tags = ("tag:astropy.org:astropy/coordinates/skycoord-*",) |
| 6 | types = ("astropy.coordinates.sky_coordinate.SkyCoord",) |
| 7 | |
| 8 | def to_yaml_tree(self, obj, tag, ctx): |
| 9 | return obj.info._represent_as_dict() |
| 10 | |
| 11 | def from_yaml_tree(self, node, tag, ctx): |
| 12 | from astropy.coordinates.sky_coordinate import SkyCoord |
| 13 | |
| 14 | return SkyCoord.info._construct_from_dict(node) |