unit/quantity-1.1.0

Represents a Quantity object from astropy

Description

A Quantity object represents a value that has some unit associated with the number.

Outline

Schema Definitions

This type is an object with the following properties:

  • value

    objectRequired

    A vector of one or more values

    This node must validate against any of the following:

  • unit

    unit-1.0.0Required

    The unit corresponding to the values

Examples

A quantity consisting of a scalar value and unit:

!unit/quantity-1.1.0
  value: 3.14159
  unit: km

A quantity consisting of a single value in an array:

!unit/quantity-1.1.0
  value: !core/ndarray-1.0.0 [2.71828]
  unit: A

A quantity with an array of values:

!unit/quantity-1.1.0
  value: !core/ndarray-1.0.0 [1, 2, 3, 4]
  unit: s

A quantity with an n-dimensional array of values:

!unit/quantity-1.1.0
  value: !core/ndarray-1.0.0
    datatype: float64
    data: [[1, 2, 3],
           [4, 5, 6]]
  unit: pc

Original Schema

%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/unit/quantity-1.1.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
    - |
        !unit/quantity-1.1.0
          value: 3.14159
          unit: km

  -
    - A quantity consisting of a single value in an array
    - |
        !unit/quantity-1.1.0
          value: !core/ndarray-1.0.0 [2.71828]
          unit: A

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

  -
    - A quantity with an n-dimensional array of values
    - |
        !unit/quantity-1.1.0
          value: !core/ndarray-1.0.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
      - $ref: "../core/ndarray-1.0.0"
  unit:
    description: |
      The unit corresponding to the values
    $ref: unit-1.0.0
required: [value, unit]
...