2

I have a Sentinel2 based product with the following product definition. It has 2 bands in it

name: product_name
description: Product Name
metadata_type: eo3

metadata:
    product:
        name: 'product_name'

measurements:
    - name: 'name_of_band'
      aliases: [band_1, name_of_band]
      dtype: uint8
      nodata: 0
      units: '1'
    - name: 'name_of_band2'
      aliases: [band_2, name_of_band2]
      dtype: uint8
      nodata: 0
      units: '1'

I am trying to index a dataset in it and for COG conversion as well as metadata yaml generation, I am using the following link - https://eodatasets.readthedocs.io/en/latest/#assemble-a-dataset-package

Here, I am writing the write_measurement line twice, like this

p.write_measurement("name_of_band", name_of_band_path)
p.write_measurement("name_of_band2", name_of_band2_path)

It throws the following error: NotImplementedError: TODO: Multi-band images not currently implemented (have 2)

I have seen similar kinds of product definitions with multiple bands here - https://github.com/opendatacube/datacube-dataset-config/tree/main/products, but can't quite find the way to write multiple measurements to a dataset yaml for indexing.

The above code works fine for single-band images, but not for multiband. How can I fix that?

1 Answer 1

2

This was not supported yet, as none of our own datasets came with multiple bands. I've added it in eodatasets>=0.23.

An index param is now available for reading measurements:

p.write_measurement("name_of_band", name_of_band_path, index=2)

Let me know if there are any issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.