opendatacube / eo-datasets

Easily write, validate and convert EO datasets and metadata.
Apache License 2.0
49 stars 26 forks source link

eo3dataset serialise dump mishandles scientific notation #260

Closed pindge closed 2 years ago

pindge commented 2 years ago

related to: https://github.com/opendatacube/datacube-explorer/issues/223

Explorer displays odc-product.yaml (https://explorer.sandbox.dea.ga.gov.au/products/s2a_ard_granule.odc-product.yaml) with function https://github.com/opendatacube/datacube-explorer/blob/6b1b7dc0445b9c4c7be282ab5a60d84593e0c9d0/cubedash/_utils.py#L546 using eodatasets3 serialise dump_all https://github.com/opendatacube/eo-datasets/blob/3f5178ccc0bf725354ee602c9e09a3ca768847d6/eodatasets3/serialise.py#L106-L108

the output mishandles scientific notation.

- name: nbart_swir_2
  dtype: int16
  units: '1'
  nodata: -999
  aliases:
  - nbart_band_11
  - nbart_B11
  - nbart_Band11
  spectral_definition:
    response:
    - 7e-06
    - 7e-06
    - 8e-06
    - 2.8e-05

datacube has a util function that dumps the YAML scientific notation correctly.

https://github.com/opendatacube/datacube-core/blob/5456533119d245a35fee33f00486fa50fc67f5d2/datacube/scripts/product.py#L229

datacube core accurately dumps spectral_definition response image