I would like to stack around 700 Landsat images in specific format as input to YATSM Continuous change detection and classification (CCDC) algorithm. I try to use this bash script 4_stack_TIFF.sh. In this script, the stacking is done using this file landsat_stack.py. I'm getting two errors:

  • First is related to the lack of a module module load batch_landsat. I could find this the shared repositiries

  • Second is related to landsat_stack.py, I get the following: Stacking to extent: Traceback (most recent call last): File "./landsat_stack.py", line 936, in <module> sys.exit(main()) File "./landsat_stack.py", line 920, in main utm, resume, fformat, creation_opts)) File "./landsat_stack.py", line 757, in landsat_stack print('\tUpper Left: {ulx},{uly}'.format(ulx=extent[0], uly=extent[1])) TypeError: 'NoneType' object is not subscriptable Done!


  1. Is there someone who have used YATSM and faced the same issue in landsat data pre-processing?
  2. if not; Can you suggest me a solution using Rasterio or Rio?


8 band images: 
   Band 1 SR (SR * 10000)
   Band 2 SR (SR * 10000)
   Band 3 SR (SR * 10000)
   Band 4 SR (SR * 10000)
   Band 5 SR (SR * 10000)
   Band 7 SR (SR * 10000)
   Band 6 Thermal Brightness (C * 100)
       0 - clear land
       1 - clear water
       2 - cloud
       3 - snow
       4 - shadow
       255 - NoData
  • I succeed to stack the bands using a rasterio code from @LoïcDutrieux. I have added a modification to the writing because in the bands I want to stack the Landsat *_bqa.tif band's dtype = uint16 where all the others are int16. So I forced it to be the same as the rest. Here is the last line of the code: dst.write_band(id + 1, src1.read(1).astype(rasterio.int16)) – mlateb May 25 '18 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.