Skip to content

Instantly share code, notes, and snippets.

@wtbarnes
Created January 9, 2022 18:24
Show Gist options
  • Save wtbarnes/f431e337b925165c02f36666198968ac to your computer and use it in GitHub Desktop.
Save wtbarnes/f431e337b925165c02f36666198968ac to your computer and use it in GitHub Desktop.
Glue config for exporting coordinates to ASDF files
"""
Glue environment customization
"""
from glue.config import data_exporter
from astropy.coordinates import SkyCoord
import sunpy.coordinates # This registers the needed coordinate frames
import asdf
@data_exporter('Coordinate ASDF Exporter')
def coordinate_asdf_exporter(filename, data, **kwargs):
with asdf.AsdfFile({'loop': SkyCoord(data['coord'])}) as afile:
afile.write_to(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment