%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/unit/quantity-1.3.0"

title: >
  Represents a Quantity object from astropy
description: |
  A Quantity object represents a value that has some unit
  associated with the number.

examples:
  -
    - A quantity consisting of a scalar value and unit
    - asdf-standard-1.6.0
    - |
        !unit/quantity-1.3.0
          value: 3.14159
          unit: km
  -
    - A quantity consisting of a scalar value with datatype and unit
    - asdf-standard-1.6.0
    - |
        !unit/quantity-1.3.0
          value: 3.14159
          unit: km
          datatype: float32
  -
    - A quantity consisting of a single value in an array
    - asdf-standard-1.6.0
    - |
        !unit/quantity-1.3.0
          value: !core/ndarray-1.1.0 [2.71828]
          unit: A

  -
    - A quantity with an array of values
    - asdf-standard-1.6.0
    - |
        !unit/quantity-1.3.0
          value: !core/ndarray-1.1.0 [1, 2, 3, 4]
          unit: s

  -
    - A quantity with an n-dimensional array of values
    - asdf-standard-1.6.0
    - |
        !unit/quantity-1.3.0
          value: !core/ndarray-1.1.0
            datatype: float64
            data: [[1, 2, 3],
                   [4, 5, 6]]
          unit: pc


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