Skip to content

STAC item validation failure when using view extension apply #258

@tyler-c2s

Description

@tyler-c2s

Currently getting validation errors when using the view extensions .apply() method.

Example:

view_dict = {'off_nadir': 0, 'sun_azimuth': 133.076479108908, 'sun_elevation': 33.4042972979731}
item.ext.view.apply(**view_dict)
item.validate()

results in:

ValidationError: None is not of type 'number'

Failed validating 'type' in schema['allOf'][1]['properties']['properties']['properties']['view:incidence_angle']:
    {'maximum': 90,
     'minimum': 0,
     'title': 'Center incidence angle',
     'type': 'number'}

On instance['properties']['view:incidence_angle']:
    None

this is not the case when directly adding each property:

"""
view_dict = {'off_nadir': 0, 'sun_azimuth': 133.076479108908, 'sun_elevation': 33.4042972979731}
item.ext.view.off_nadir = view_dict["off_nadir"]
item.ext.view.sun_azimuth = view_dict["sun_azimuth"]
item.ext.view.sun_elevation = view_dict["sun_elevation"]
item.validate()

the issue appears to be that when using the apply function, any non-included parameters are set to None, causing issues in validation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions