Skip to content

Report error when adding product with nodata: value outside the range of the data type #2230

@pjonsson

Description

@pjonsson

When upgrading to 1.9, I found we had a product definition that looks like this:

name: a_name
description: Something
metadata_type: eo3
license: CC-BY-4.0
metadata:
  product:
    name: a_name
measurements:
  - name: "cld"
    dtype: uint8
    nodata: NaN
    units: "percent"

and it seems to be accepted by datacube product add file.yaml with both 1.8 and 1.9. I don't know the history for why our product definition looks the way it does, but it would be nice if datacube had given an error when trying to add this.

Edit: tests/data/ga_s1_nrb_iw_hh_0.odc-product.yaml contains:

  - name: gamma0_to_sigma0_ratio
    dtype: float32
    nodata: .nan
    units: '1'

which uses a floating point type so NaN is present, but the leading period doesn't look like it's matching the schema definition:

            nodata:
              oneOf:
                - type: number
                - enum: [nan, NAN, NaN, Inf, -Inf]

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