Skip to content

Commit

Permalink
update ndarray schema to 1.1
Browse files Browse the repository at this point in the history
ndarray schema 1.0 allows for objects with no required items.
This means that many objects (including empty objects) will validate
against this schema.

Schemas that reference ndarray were updated to use the new 1.1 schema.
  • Loading branch information
braingram committed Nov 21, 2022
1 parent b259b85 commit 1cb98f9
Show file tree
Hide file tree
Showing 14 changed files with 867 additions and 46 deletions.
8 changes: 4 additions & 4 deletions docs/source/schemas/core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ asdf library.

core/asdf-1.1.0
core/complex-1.0.0
core/ndarray-1.0.0
core/table-1.0.0
core/column-1.0.0
core/ndarray-1.1.0
core/table-1.1.0
core/column-1.1.0
core/constant-1.0.0
core/software-1.0.0
core/history_entry-1.0.0
core/extension_metadata-1.0.0
core/integer-1.0.0
core/integer-1.1.0
core/externalarray-1.0.0
core/subclass_metadata-1.0.0
2 changes: 1 addition & 1 deletion docs/source/schemas/fits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ FITS. It can safely be ignored by most ASDF implementations.

.. asdf-autoschemas::

fits/fits-1.0.0
fits/fits-1.1.0
6 changes: 3 additions & 3 deletions docs/source/schemas/unit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ The ``unit`` module contains schema to support the units of physical quantities.

.. asdf-autoschemas::

unit/unit-1.0.0
unit/defunit-1.0.0
unit/quantity-1.1.0
unit/unit-1.1.0
unit/defunit-1.1.0
unit/quantity-1.2.0
34 changes: 17 additions & 17 deletions resources/manifests/asdf-format.org/core/core-1.6.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ tags:
schema_uri: http://stsci.edu/schemas/asdf/core/asdf-1.1.0
title: Top-level schema for every ASDF file.
description: This schema contains the top-level attributes for every ASDF file.
- tag_uri: tag:stsci.edu:asdf/core/column-1.0.0
schema_uri: http://stsci.edu/schemas/asdf/core/column-1.0.0
- tag_uri: tag:stsci.edu:asdf/core/column-1.1.0
schema_uri: http://stsci.edu/schemas/asdf/core/column-1.1.0
title: A column in a table.
description: |-
Each column contains a name and an array of data, and an optional description
Expand Down Expand Up @@ -63,12 +63,12 @@ tags:
description: |-
A record of an operation that has been performed
upon a file.
- tag_uri: tag:stsci.edu:asdf/core/integer-1.0.0
schema_uri: http://stsci.edu/schemas/asdf/core/integer-1.0.0
- tag_uri: tag:stsci.edu:asdf/core/integer-1.1.0
schema_uri: http://stsci.edu/schemas/asdf/core/integer-1.1.0
title: Arbitrary precision integer value.
description: Represents an arbitrarily large integer value.
- tag_uri: tag:stsci.edu:asdf/core/ndarray-1.0.0
schema_uri: http://stsci.edu/schemas/asdf/core/ndarray-1.0.0
- tag_uri: tag:stsci.edu:asdf/core/ndarray-1.1.0
schema_uri: http://stsci.edu/schemas/asdf/core/ndarray-1.1.0
title: An *n*-dimensional array.
description: |-
There are two ways to store the data in an ndarray.
Expand All @@ -94,12 +94,12 @@ tags:
description: |-
Identifies the specific subclass that was serialized,
to enable ASDF readers to correctly deserialize the object.
- tag_uri: tag:stsci.edu:asdf/core/table-1.0.0
schema_uri: http://stsci.edu/schemas/asdf/core/table-1.0.0
- tag_uri: tag:stsci.edu:asdf/core/table-1.1.0
schema_uri: http://stsci.edu/schemas/asdf/core/table-1.1.0
title: A table.
description: |-
A table is represented as a list of columns, where each entry is a
[column](ref:core/column-1.0.0)
[column](ref:core/column-1.1.0)
object, containing the data and some additional information.
The data itself may be stored inline as text, or in binary in either
Expand All @@ -108,8 +108,8 @@ tags:
Each column in the table must have the same first (slowest moving)
dimension.
- tag_uri: tag:stsci.edu:asdf/fits/fits-1.0.0
schema_uri: http://stsci.edu/schemas/asdf/fits/fits-1.0.0
- tag_uri: tag:stsci.edu:asdf/fits/fits-1.1.0
schema_uri: http://stsci.edu/schemas/asdf/fits/fits-1.1.0
title: A FITS file inside of an ASDF file.
description: |-
This schema is useful for distributing ASDF files that can
Expand Down Expand Up @@ -154,8 +154,8 @@ tags:
good as an IEEE-754 double precision (float64) value. If
higher-precision is required, the `iso` or `yday` format should be
used.
- tag_uri: tag:stsci.edu:asdf/unit/defunit-1.0.0
schema_uri: http://stsci.edu/schemas/asdf/unit/defunit-1.0.0
- tag_uri: tag:stsci.edu:asdf/unit/defunit-1.1.0
schema_uri: http://stsci.edu/schemas/asdf/unit/defunit-1.1.0
title: Define a new physical unit.
description: |-
Defines a new unit. It can be used to either:
Expand All @@ -165,14 +165,14 @@ tags:
- Create a new unit name that is a equivalent to a given unit.
The new unit must be defined before any unit tags that use it.
- tag_uri: tag:stsci.edu:asdf/unit/quantity-1.1.0
schema_uri: http://stsci.edu/schemas/asdf/unit/quantity-1.1.0
- tag_uri: tag:stsci.edu:asdf/unit/quantity-1.2.0
schema_uri: http://stsci.edu/schemas/asdf/unit/quantity-1.2.0
title: Represents a Quantity object from astropy
description: |-
A Quantity object represents a value that has some unit
associated with the number.
- tag_uri: tag:stsci.edu:asdf/unit/unit-1.0.0
schema_uri: http://stsci.edu/schemas/asdf/unit/unit-1.0.0
- tag_uri: tag:stsci.edu:asdf/unit/unit-1.1.0
schema_uri: http://stsci.edu/schemas/asdf/unit/unit-1.1.0
title: Physical unit.
description: |-
This represents a physical unit, in [VOUnit syntax, Version 1.0](http://www.ivoa.net/documents/VOUnits/index.html).
Expand Down
49 changes: 49 additions & 0 deletions resources/schemas/stsci.edu/asdf/core/column-1.1.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/core/column-1.1.0"

title: >
A column in a table.
description: |
Each column contains a name and an array of data, and an optional description
and unit.
type: object
properties:
name:
description: |
The name of the column. Each name in a
[table](http://stsci.edu/schemas/asdf/core/table-1.1.0) must be
unique.
type: string
pattern: "[A-Za-z_][A-Za-z0-9_]*"

data:
description: |
The array data for the column.
allOf:
- $ref: ndarray-1.1.0

description:
description: |
An optional description of the column.
type: string
default: ''

unit:
description:
An optional unit for the column.
allOf:
- $ref: ../unit/unit-1.1.0

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

required: [name, data]
additionalProperties: false
...
53 changes: 53 additions & 0 deletions resources/schemas/stsci.edu/asdf/core/integer-1.1.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/core/integer-1.1.0"
title: Arbitrary precision integer value.
description: |
Represents an arbitrarily large integer value.
examples:
-
- An integer value that is stored using an internal array
- |
!core/integer-1.1.0
sign: +
string: '1193942770599561143856918438330'
words: !core/ndarray-1.1.0
source: 0
datatype: uint32
byteorder: little
shape: [4]
-
- The same integer value is stored using an inline array
- |
!core/integer-1.1.0
sign: +
string: '1193942770599561143856918438330'
words: !core/ndarray-1.1.0
data: [1103110586, 1590521629, 299257845, 15]
datatype: uint32
shape: [4]
type: object
properties:
words:
$ref: "ndarray-1.1.0"
description: |
An array of unsigned 32-bit words representing the integer value, stored
as little endian (i.e. the first word of the array represents the least
significant bits of the integer value).
sign:
type: string
pattern: "^[+-]$"
description: |
String indicating whether the integer value is positive or negative.
string:
type: string
description: |
Optional string representation of the integer value. This field is only
intended to improve readability for humans, and therefore no assumptions
about format should be made by ASDF readers.
required: [words, sign]
...
Loading

0 comments on commit 1cb98f9

Please sign in to comment.