Skip to content

C2L2 Landsat Support #83

@khmara-breeze

Description

@khmara-breeze

I am trying to run pymetric mountain_model on the C2L2 landsat data.

I'm getting an error on the following command line:

python C:\pymetric\code\local\landsat_prep_scene.py -i C:\pymetric\example\landsat_2022.ini

Error traceback:

################################################################################
Run Time Stamp:      2022-09-09 12:13:00.235495
Current Directory:   c:\pymetric
Script:              landsat_prep_scene.py

Preparing Landsat scenes
  INI File:          landsat_2022.ini

################################################################################
Run Time Stamp:      2022-09-09 12:13:03.229206
Current Directory:   C:\pymetric\example\2022\p038r037\LC08_L2SP_038037_20220704_20220707_02_T1
  INI File:          landsat_2022.ini
Traceback (most recent call last):
  File "C:\pymetric\code\prep_functions\landsat_prep_scene_func.py", line 1295, in <module>
    stats_flag=args.stats, overwrite_flag=args.overwrite)
  File "C:\pymetric\code\prep_functions\landsat_prep_scene_func.py", line 172, in main
    image = et_image.Image(image_ws, env)
  File "C:\pymetric\code\support\et_image.py", line 222, in __init__
    self.process_mtl()
  File "C:\pymetric\code\support\et_image.py", line 428, in process_mtl
    logging.debug(log_f.format('Correction:', self.correction))
AttributeError: 'Image' object has no attribute 'correction'

As far as I can see from the code, in the code\support\et_image.py file, on line 302, C2L2 landsat metadata is parsed incorrectly, my C2L2 landsat metadata file does not contain DATA_TYPE or PRODUCT_TYPE keys.

elif ('DATA_TYPE' == mtl_line[0] or
	  'PRODUCT_TYPE' == mtl_line[0]):
	self.correction = mtl_line[1].replace('"', '')

Also I noticed from the code, that pymetric does not understand the C2L2 landsat images name format, so it cannot find the bands it needs.

My question is, does pymetric support C2L2 landsat data, or is there any workaround for this?

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