Skip to content

skycell reference file schema is incompatible with inline storage #887

Description

@braingram

byteorder: little

combined with how asdf handles datatype validation means a skycell reference files with inline storage results in a validation error.

Practically we never want a skycell reference file with inline storage but the current test models creates small arrays that combined with an array_inline_threshold (spacetelescope/roman_datamodels#681) results in an a model that cannot be saved.

import asdf, roman_datamodels.datamodels as rdm
m = rdm.SkycellsRefModel.create_fake_data()
m.save("foo.asdf", all_array_storage="inline")

produces a validation error:

     'exact_datatype': True,
     'tag': 'tag:stsci.edu:asdf/core/ndarray-1.*',
     'title': 'Information about each projection region'}

On instance['projection_regions']:
    {'data': [0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0],
     'datatype': [{'datatype': 'int32', 'name': 'index'},
                  {'datatype': 'float64', 'name': 'ra_tangent'},
                  {'datatype': 'float64', 'name': 'dec_tangent'},
                  {'datatype': 'float64', 'name': 'ra_min'},
                  {'datatype': 'float64', 'name': 'ra_max'},
                  {'datatype': 'float64', 'name': 'dec_min'},
                  {'datatype': 'float64', 'name': 'dec_max'},
                  {'datatype': 'float32', 'name': 'orientat'},
                  {'datatype': 'float64', 'name': 'x_tangent'},
                  {'datatype': 'float64', 'name': 'y_tangent'},
                  {'datatype': 'int32', 'name': 'nx'},
                  {'datatype': 'int32', 'name': 'ny'},
                  {'datatype': 'int32', 'name': 'skycell_start'},
                  {'datatype': 'int32', 'name': 'skycell_end'}],
     'shape': []}

Note the lack of "byteorder" in the produced datatype.

FWIW if we remove byteorder from the schema, a similar validation error occurs when attempting to save to an internal block.

I am leaning towards this being an asdf bug since I'm struggling to think why the datatype validation would care about byteorder and perhaps we should drop that field from https://github.com/asdf-format/asdf/blob/db93e309fc9ead732e0ada8be41bb0ec90c6aa5a/asdf/tags/core/ndarray.py#L16

Pinging @sydduckworth for input on this from the asdf side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions