On running the script in the link below to generate the dataset documentation for data downloaded from USGS Landsat 8 Collection 2 Level 2, it ends in an error. ls_usgs_sr_l2.py script

The error :

Traceback (most recent call last):
  File "ls_usgs_sr_l2_prepare.py", line 186, in <module>
  File "C:\Users\Username\Anaconda3\envs\cubeenv\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Username\Anaconda3\envs\cubeenv\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\Username\Anaconda3\envs\cubeenv\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Username\Anaconda3\envs\cubeenv\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "ls_usgs_sr_l2_prepare.py", line 181, in main
    yaml.dump(prepare_datasets(path, file, output), stream, explicit_start=True)
  File "ls_usgs_sr_l2_prepare.py", line 153, in prepare_datasets
    doc = prep_dataset(path, metadata)
  File "ls_usgs_sr_l2_prepare.py", line 96, in prep_dataset
    satellite = doc.find('.//satellite').text
AttributeError: 'NoneType' object has no attribute 'text'

This is the product definition used

What is causing the error here?

1 Answer 1


That generation of prepare scripts are not maintained.

Also, it depends on what metadata files you run it on.

For more satisfactory results, you want to use the USGS STAC API and the new stac-to-dc script, but it also isn't well tested against USGS Collection2 Level-2 data.

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