{"id":7006,"library":"asdf-coordinates-schemas","title":"ASDF Coordinates Schemas","description":"ASDF Coordinates Schemas (asdf-coordinates-schemas) provides ASDF schemas specifically for validating astronomical coordinate tags, primarily those defined by `astropy.coordinates`. This package is typically consumed as a dependency by higher-level integration packages like `asdf-astropy` rather than being installed directly by end-users. It is part of the broader ASDF ecosystem, is actively maintained, and is currently at version 0.5.1.","status":"active","version":"0.5.1","language":"en","source_language":"en","source_url":"https://github.com/asdf-format/asdf-coordinates-schemas","tags":["asdf","astronomy","coordinates","schema","validation","astropy","data-format"],"install":[{"cmd":"pip install asdf-coordinates-schemas","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required Python version.","package":"python","optional":false},{"reason":"Core ASDF library, essential for schema interpretation and file I/O.","package":"asdf","optional":false},{"reason":"This package is the primary consumer of `asdf-coordinates-schemas` and provides the necessary converters to serialize/deserialize `astropy.coordinates` objects. Users are typically advised to install `asdf-astropy` instead of `asdf-coordinates-schemas` directly.","package":"asdf-astropy","optional":false},{"reason":"Provides the `astropy.coordinates` objects that these schemas define and validate.","package":"astropy","optional":false}],"imports":[{"note":"While importing the package is syntactically correct, it offers no direct user-facing API. The value lies in its registered schemas.","wrong":"import asdf_coordinates_schemas","symbol":"Not applicable for direct import","correct":"This library primarily provides schema definitions for the ASDF ecosystem. It is not typically imported directly into Python code for use of its classes or functions. Its schemas are automatically registered and used by the `asdf` library when `asdf-astropy` is installed."}],"quickstart":{"code":"import asdf\nimport astropy.units as u\nfrom astropy.coordinates import SkyCoord, ICRS\n\n# This example relies on asdf-astropy being installed to register the schemas and converters.\n# If you run this without asdf-astropy, it will likely fail to serialize SkyCoord.\n\n# Create an Astropy SkyCoord object\ncoord = SkyCoord(ra=10.68458 * u.deg, dec=41.26917 * u.deg, frame=ICRS())\n\n# Create an ASDF tree with the coordinate object\ntree = {'my_coordinate': coord}\n\n# Save the ASDF tree to a file\n# This will use the schemas provided by asdf-coordinates-schemas (via asdf-astropy)\nwith asdf.AsdfFile(tree) as af:\n    af.write('my_coordinates.asdf')\n\nprint(\"ASDF file 'my_coordinates.asdf' created successfully.\")\n\n# Read the ASDF file back\nwith asdf.open('my_coordinates.asdf') as af_read:\n    read_coord = af_read['my_coordinate']\n    print(f\"Read coordinate: {read_coord}\")\n    print(f\"Type: {type(read_coord)}\")","lang":"python","description":"This quickstart demonstrates how `asdf-coordinates-schemas` works implicitly. By installing `asdf-astropy` (which depends on `asdf-coordinates-schemas`), `astropy.coordinates` objects like `SkyCoord` can be seamlessly serialized into and deserialized from ASDF files. The schemas provided by this library ensure the correct validation and structure of the coordinate data within the ASDF file."},"warnings":[{"fix":"Ensure `asdf-astropy` is installed: `pip install asdf-astropy`. This will automatically install `asdf-coordinates-schemas` as a dependency.","message":"Users should generally install `asdf-astropy` instead of `asdf-coordinates-schemas` directly. `asdf-coordinates-schemas` only provides the schema definitions, while `asdf-astropy` provides the necessary Python converters and automatically registers these schemas with the `asdf` library for practical usage.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When creating ASDF files, be mindful of the ASDF standard version used. When reading, `asdf` is generally backwards compatible, but ensure your `asdf-astropy` package supports the specific schema version of the coordinates tag in the file. Consult `asdf-astropy` and `asdf` change logs for specific migration details.","message":"Major version changes in ASDF tags (e.g., `skycoord-1.0.0` vs. `skycoord-2.0.0`) signify breaking changes in the schema definition. If you are working with ASDF files created with older versions of `astropy.coordinates` or the ASDF standard, ensure your `asdf` and `asdf-astropy` installations are compatible with the schema versions used in those files.","severity":"breaking","affected_versions":"All versions, especially across ASDF standard version bumps"},{"fix":"Replace `AsdfFile.open()` calls with `asdf.open()` for reading ASDF files. For example, `with asdf.open('file.asdf') as af:`.","message":"The core `asdf` library, which is fundamental to using `asdf-coordinates-schemas` indirectly, has deprecated `AsdfFile.open` in favor of `asdf.open` (as of ASDF 2.2). While not directly part of `asdf-coordinates-schemas`, users interacting with ASDF files should use the modern `asdf.open` approach.","severity":"deprecated","affected_versions":"ASDF library versions < 3.0 (deprecated in 2.2, removal planned in 3.0)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install `asdf-astropy` to register the necessary schemas and converters: `pip install asdf-astropy`.","cause":"The ASDF library could not find the schema definition required to validate the `SkyCoord` tag. This typically means the extension that provides this schema (e.g., `asdf-astropy`) is not installed or properly registered.","error":"asdf.exceptions.ValidationError: Tag 'tag:astropy.org:astropy/coordinates/skycoord-1.0.0' not found in schema"},{"fix":"Ensure that `asdf-astropy` is installed. It provides the necessary converters for `astropy.coordinates` objects to be serialized into ASDF files: `pip install asdf-astropy`.","cause":"When attempting to write an `astropy.coordinates.SkyCoord` object to an ASDF file, the `asdf` library reported that it doesn't know how to serialize this Python object. This indicates that the corresponding converter for `SkyCoord` is not registered.","error":"TypeError: 'SkyCoord' object is not ASDF-serializable"}]}