Schemas

Documentation for each of the individual ASDF schemas defined by astropy can be found at the links below.

Documentation for the schemas defined in the ASDF Standard can be found here.

Coordinates

The following schemas are associated with astropy types from the Astronomical Coordinate Systems (astropy.coordinates) submodule:

coordinates/angle-1.0.0

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://astropy.org/schemas/astropy/coordinates/angle-1.0.0"
tag: "tag:astropy.org:astropy/coordinates/angle-1.0.0"

title: |
  Represents an Angle.

description:
  This object represents a subtype of Quantity which has units equivalent to
  radians or degrees.

examples:
  -
    - An Angle object in Degrees
    - |
        !<tag:astropy.org:astropy/coordinates/angle-1.0.0>
          unit: !unit/unit-1.0.0 deg
          value: 10.0

type: object
properties:
  value:
    description: |
      A vector of one or more values
    anyOf:
      - type: number
      - $ref: "tag:stsci.edu:asdf/core/ndarray-1.0.0"
  unit:
    description: |
      The unit corresponding to the values
    $ref: "tag:stsci.edu:asdf/unit/unit-1.0.0"
required: [value, unit]
...

coordinates/earthlocation-1.0.0

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://astropy.org/schemas/astropy/coordinates/earthlocation-1.0.0"
tag: "tag:astropy.org:astropy/coordinates/earthlocation-1.0.0"

title: |
  Represents EarthLocation objects from astropy.

description: |
  Location on the Earth.

type: object
properties:
  x:
    description: |
      X component of location in geocentric representation
    $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
  y:
    description: |
      Y component of location in geocentric representation
    $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
  z:
    description: |
      Z component of location in geocentric representation
    $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
  ellipsoid:
    description: |
      Reference ellipsoid that is used when representing geodetic coordinates.
    type: string
    enum: [WGS84, GRS80, WGS72]

required: [x, y, z]
additionalProperties: False
...

coordinates/latitude-1.0.0

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://astropy.org/schemas/astropy/coordinates/latitude-1.0.0"
tag: "tag:astropy.org:astropy/coordinates/latitude-1.0.0"

title: |
  Represents latitude-like angles.

description: |
  Represents latitude-like angle(s) which must be in the range -90 to +90 deg.

examples:
  -
    - A Latitude object in Degrees
    - |
        !<tag:astropy.org:astropy/coordinates/latitude-1.0.0>
          unit: !unit/unit-1.0.0 deg
          value: 10.0

type: object
properties:
  value:
    description: |
      A vector of one or more values
    anyOf:
      - type: number
      - $ref: "tag:stsci.edu:asdf/core/ndarray-1.0.0"
  unit:
    description: |
      The unit corresponding to the values
    $ref: "tag:stsci.edu:asdf/unit/unit-1.0.0"
required: [value, unit]
...

coordinates/longitude-1.0.0

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://astropy.org/schemas/astropy/coordinates/longitude-1.0.0"
tag: "tag:astropy.org:astropy/coordinates/longitude-1.0.0"

title: |
  Represents longitude-like angles.

description: |
    Longitude-like angle(s) which are wrapped within a contiguous 360 degree range.

examples:
  -
    - A Longitude object in Degrees
    - |
        !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>
          unit: !unit/unit-1.0.0 deg
          value: 10.0
          wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0>
            unit: !unit/unit-1.0.0 deg
            value: 180.0

type: object
properties:
  value:
    description: |
      A vector of one or more values
    anyOf:
      - type: number
      - $ref: "tag:stsci.edu:asdf/core/ndarray-1.0.0"
  unit:
    description: |
      The unit corresponding to the values
    $ref: "tag:stsci.edu:asdf/unit/unit-1.0.0"
  wrap_angle:
    description: |
      Angle at which to wrap back to ``wrap_angle - 360 deg``.
    $ref: "angle-1.0.0"

required: [value, unit, wrap_angle]
...

coordinates/representation-1.0.0

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://astropy.org/schemas/astropy/coordinates/representation-1.0.0"
tag: "tag:astropy.org:astropy/coordinates/representation-1.0.0"

title: |
  Representation of points or differentials in two or three dimensional space.

description: |
  Representation of points or differentials in two or three dimensional space.

examples:
  -
    - A SphericalRepresentation
    - |
        !<tag:astropy.org:astropy/coordinates/representation-1.0.0>
          components:
            distance: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 AU, value: 1.0}
            lat: !<tag:astropy.org:astropy/coordinates/latitude-1.0.0> {unit: !unit/unit-1.0.0 deg,
              value: 10.0}
            lon: !<tag:astropy.org:astropy/coordinates/longitude-1.0.0>
              unit: !unit/unit-1.0.0 deg
              value: 10.0
              wrap_angle: !<tag:astropy.org:astropy/coordinates/angle-1.0.0> {unit: !unit/unit-1.0.0 deg,
                value: 360.0}
          type: SphericalRepresentation
  -
    - A CartesianDifferential
    - |
        !<tag:astropy.org:astropy/coordinates/representation-1.0.0>
          components:
            d_x: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 100.0}
            d_y: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 200.0}
            d_z: !unit/quantity-1.1.0 {unit: !unit/unit-1.0.0 km s-1, value: 3141.0}
          type: CartesianDifferential

type: object
properties:
  type:
    type: string
    enum:
      - CartesianRepresentation
      - SphericalRepresentation
      - UnitSphericalRepresentation
      - RadialRepresentation
      - PhysicsSphericalRepresentation
      - CylindricalRepresentation
      - CartesianDifferential
      - SphericalDifferential
      - UnitSphericalCosLatDifferential
      - UnitSphericalDifferential
      - SphericalCosLatDifferential
      - RadialDifferential
      - PhysicsSphericalDifferential
      - CylindricalDifferential

  components:
    anyOf:
      # CartesianRepresentation
      - type: object
        properties:
          x:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          y:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          z:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # SphericalRepresentation
      - type: object
        properties:
          lat:
            $ref: "latitude-1.0.0"
          lon:
            $ref: "longitude-1.0.0"
          distance:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # UnitSphericalRepresentation
      - type: object
        properties:
          lat:
            $ref: "latitude-1.0.0"
          lon:
            $ref: "longitude-1.0.0"

      # RadialRepresentation
      - type: object
        properties:
          distance:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # PhysicsSphericalRepresentation
      - type: object
        properties:
          phi:
            $ref: "angle-1.0.0"
          theta:
            $ref: "angle-1.0.0"
          r:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # CylindricalRepresentation
      - type: object
        properties:
          rho:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          phi:
            $ref: "angle-1.0.0"
          z:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # CartesianDifferential
      - type: object
        properties:
          d_x:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_y:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_z:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # SphericalDifferential
      - type: object
        properties:
          d_lon:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_lat:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_distance:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # UnitSphericalCosLatDifferential
      - type: object
        properties:
          d_lon_coslat:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_lat:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # UnitSphericalDifferential
      - type: object
        properties:
          d_lon:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_lat:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # SphericalCosLatDifferential
      - type: object
        properties:
          d_lon_coslat:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_lat:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_distance:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # SphericalDifferential
      - type: object
        properties:
          d_lon:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_lat:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_distance:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # RadialDifferential
      - type: object
        properties:
          d_phi:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_theta:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_r:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # PhysicsSphericalDifferential
      - type: object
        properties:
          d_phi:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_theta:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_r:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # RadialDifferential
      - type: object
        properties:
          d_distance:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

      # CylindricalDifferential
      - type: object
        properties:
          d_rho:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_phi:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
          d_z:
            $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"

required: [type, components]
...

coordinates/skycoord-1.0.0

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://astropy.org/schemas/astropy/coordinates/skycoord-1.0.0"
tag: "tag:astropy.org:astropy/coordinates/skycoord-1.0.0"

title: |
  Represents a SkyCoord object from astropy

allOf:
  - type: object
    properties:
      frame:
        description: |
          A string describing the kind of frame that is represented by this
          SkyCoord object. This value is used when reconstructing SkyCoord.
        type: string
required: [frame]
additionalProperties: true
...

FITS

The following schemas are associated with astropy types from the FITS File Handling (astropy.io.fits) submodule:

fits/fits-1.0.0

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://astropy.org/schemas/astropy/fits/fits-1.0.0"
title: >
  A FITS file inside of an ASDF file.
description: |
  This schema is useful for distributing ASDF files that can
  automatically be converted to FITS files by specifying the exact
  content of the resulting FITS file.

  Not all kinds of data in FITS are directly representable in ASDF.
  For example, applying an offset and scale to the data using the
  `BZERO` and `BSCALE` keywords.  In these cases, it will not be
  possible to store the data in the native format from FITS and also
  be accessible in its proper form in the ASDF file.

  Only image and binary table extensions are supported.

examples:
  -
    - A simple FITS file with a primary header and two extensions
    - |
        !<tag:astropy.org:astropy/fits/fits-1.0.0>
            - header:
              - [SIMPLE, true, conforms to FITS standard]
              - [BITPIX, 8, array data type]
              - [NAXIS, 0, number of array dimensions]
              - [EXTEND, true]
              - []
              - ['', Top Level MIRI Metadata]
              - []
              - [DATE, '2013-08-30T10:49:55.070373', The date this file was created (UTC)]
              - [FILENAME, MiriDarkReferenceModel_test.fits, The name of the file]
              - [TELESCOP, JWST, The telescope used to acquire the data]
              - []
              - ['', Information about the observation]
              - []
              - [DATE-OBS, '2013-08-30T10:49:55.000000', The date the observation was made (UTC)]
            - data: !core/ndarray-1.0.0
                datatype: float32
                shape: [2, 3, 3, 4]
                source: 0
                byteorder: big
              header:
              - [XTENSION, IMAGE, Image extension]
              - [BITPIX, -32, array data type]
              - [NAXIS, 4, number of array dimensions]
              - [NAXIS1, 4]
              - [NAXIS2, 3]
              - [NAXIS3, 3]
              - [NAXIS4, 2]
              - [PCOUNT, 0, number of parameters]
              - [GCOUNT, 1, number of groups]
              - [EXTNAME, SCI, extension name]
              - [BUNIT, DN, Units of the data array]
            - data: !core/ndarray-1.0.0
                datatype: float32
                shape: [2, 3, 3, 4]
                source: 1
                byteorder: big
              header:
              - [XTENSION, IMAGE, Image extension]
              - [BITPIX, -32, array data type]
              - [NAXIS, 4, number of array dimensions]
              - [NAXIS1, 4]
              - [NAXIS2, 3]
              - [NAXIS3, 3]
              - [NAXIS4, 2]
              - [PCOUNT, 0, number of parameters]
              - [GCOUNT, 1, number of groups]
              - [EXTNAME, ERR, extension name]
              - [BUNIT, DN, Units of the error array]

allOf:
  - tag: "tag:astropy.org:astropy/fits/fits-1.0.0"
  - type: array
    items:
      type: object
      properties:
        data:
          description: "The data part of the HDU."
          anyOf:
            - $ref: "tag:stsci.edu:asdf/core/ndarray-1.0.0"
            - $ref: "../table/table-1.0.0"
            # Retain backwards compatibility with table defined by ASDF Standard
            - $ref: "tag:stsci.edu:asdf/core/table-1.0.0"
            - type: "null"
          default: null

Table

The following schemas are associated with astropy types from the Data Tables (astropy.table) submodule:

table/table-1.0.0

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://astropy.org/schemas/astropy/table/table-1.0.0"
tag: "tag:astropy.org:astropy/table/table-1.0.0"

title: >
  A table.

description: |
  A table is represented as a list of columns, where each entry is a
  [column](ref:http://stsci.edu/schemas/asdf/core/column-1.0.0)
  object, containing the data and some additional information.

  The data itself may be stored inline as text, or in binary in either
  row- or column-major order by use of the `strides` property on the
  individual column arrays.

  Each column in the table must have the same first (slowest moving)
  dimension.

examples:
  -
    - A table stored in column-major order, with each column in a separate block
    - |
        !<tag:astropy.org:astropy/table/table-1.0.0>
          columns:
          - !core/column-1.0.0
            data: !core/ndarray-1.0.0
              source: 0
              datatype: float64
              byteorder: little
              shape: [3]
            description: RA
            meta: {foo: bar}
            name: a
            unit: !unit/unit-1.0.0 deg
          - !core/column-1.0.0
            data: !core/ndarray-1.0.0
              source: 1
              datatype: float64
              byteorder: little
              shape: [3]
            description: DEC
            name: b
          - !core/column-1.0.0
            data: !core/ndarray-1.0.0
              source: 2
              datatype: [ascii, 1]
              byteorder: big
              shape: [3]
            description: The target name
            name: c
          colnames: [a, b, c]

  -
    - A table stored in row-major order, all stored in the same block
    - |
        !<tag:astropy.org:astropy/table/table-1.0.0>
          columns:
          - !core/column-1.0.0
            data: !core/ndarray-1.0.0
              source: 0
              datatype: float64
              byteorder: little
              shape: [3]
              strides: [13]
            description: RA
            meta: {foo: bar}
            name: a
            unit: !unit/unit-1.0.0 deg
          - !core/column-1.0.0
            data: !core/ndarray-1.0.0
              source: 0
              datatype: float64
              byteorder: little
              shape: [3]
              offset: 4
              strides: [13]
            description: DEC
            name: b
          - !core/column-1.0.0
            data: !core/ndarray-1.0.0
              source: 0
              datatype: [ascii, 1]
              byteorder: big
              shape: [3]
              offset: 12
              strides: [13]
            description: The target name
            name: c
          colnames: [a, b, c]

type: object
properties:
  columns:
    description: |
      A list of columns in the table.
    type: array
    items:
      anyOf:
        - $ref: "tag:stsci.edu:asdf/core/column-1.0.0"
        - $ref: "tag:stsci.edu:asdf/core/ndarray-1.0.0"
        - $ref: "tag:stsci.edu:asdf/time/time-1.1.0"
        - $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
        - $ref: "../coordinates/skycoord-1.0.0"
        - $ref: "../coordinates/earthlocation-1.0.0"
        - $ref: "../time/timedelta-1.0.0"

  colnames:
    description: |
      A list containing the names of the columns in the table (in order).
    type: array
    items:
      - type: string

  qtable:
    description: |
      A flag indicating whether or not the serialized type was a QTable
    type: boolean
    default: False

  meta:
    description: |
      Additional free-form metadata about the table.
    type: object
    default: {}

additionalProperties: false
required: [columns, colnames]

Time

The following schemas are associated with astropy types from the Time and Dates (astropy.time) submodule:

time/timedelta-1.0.0

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/asdf/asdf-schema-1.0.0"
id: "http://astropy.org/schemas/astropy/time/time-1.1.0"
title: Represents an instance of TimeDelta from astropy
description: |
  Represents the time difference between two times.

type: object
properties:
    jd1:
      anyOf:
        - type: number
        - $ref: "tag:stsci.edu:asdf/core/ndarray-1.0.0"
      description: |
        Value representing first 64 bits of precision
    jd2:
      anyOf:
        - type: number
        - $ref: "tag:stsci.edu:asdf/core/ndarray-1.0.0"
      description: |
        Value representing second 64 bits of precision
    format:
      type: string
      description: |
        Format of time value representation.
    scale:
      type: string
      description: |
        Time scale of input value(s).
      enum: [tdb, tt, ut1, tcg, tcb, tai, local]
required: [jd1, jd2, format]
additionalProperties: False
...

Units

The following schemas are associated with astropy types from the Units and Quantities (astropy.units) submodule:

units/equivalency-1.0.0

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://astropy.org/schemas/astropy/units/equivalency-1.0.0"
tag: "tag:astropy.org:astropy/units/equivalency-1.0.0"

title: |
  Represents unit equivalency.

description: |
  Supports serialization of equivalencies between units
  in certain contexts

definitions:
  equivalency:
    type: object
    properties:
      name:
        type: string
      kwargs_names:
        type: array
        items:
          type: string
      kwargs_values:
        type: array
        items:
          anyOf:
            - $ref: "tag:stsci.edu:asdf/unit/quantity-1.1.0"
            - type: number
            - type: "null"

type: array
items:
  $ref: "#/definitions/equivalency"
...