| 1 |
from asdf.extension import Converter |
| 2 |
|
| 3 |
|
| 4 |
class EarthLocationConverter(Converter): |
| 5 |
tags = ("tag:astropy.org:astropy/coordinates/earthlocation-*",) |
| 6 |
types = ( |
| 7 |
"astropy.coordinates.earth.EarthLocation", |
| 8 |
"astropy.utils.masked.core.MaskedEarthLocation", |
| 9 |
) |
| 10 |
|
| 11 |
def to_yaml_tree(self, obj, tag, ctx): |
| 12 |
result = obj.info._represent_as_dict() |
| 13 |
result.pop("__class__", None) |
| 14 |
return result |
| 15 |
|
| 16 |
def from_yaml_tree(self, node, tag, ctx): |
| 17 |
from astropy.coordinates.earth import EarthLocation |
| 18 |
|
| 19 |
return EarthLocation.info._construct_from_dict(node) |