1

Working in QGIS 2.14, I'm making a script to prepare images for remote sensing classifications. The user is prompted to enter multiple rasters for each band. I would like these rasters to be organized into a dictionary so each band can be prepared in loop.

##Prepare Band Images = name
##Band01 = multiple raster
##Band02 = multiple raster

dictionary = {
   "band01": Band01,
   "band02": Band02
}

for bandidx, bandfiles in dictionary.items():
   # Prepare band images

My issue is that the above script produces the following error message:

enter image description here

Is it possible to have a dictionary with 'multiple raster' variables in it? Alternatively, is there an easier way to make a list of 'multiple raster' variables?

0

The problem is with the spaces in the variable definition

With

##Band01 = multiple raster

Band01 is not defined (the variable name is Band01 + space), whereas with

##Band01= multiple raster

There's no problem

  • I'd suggest that is a bug. The processing script code should do a .strip() on all tokens. Probably not worth reporting though as 3.0 changes the processing scripts completely. – user2856 Jul 16 '18 at 23:22

Your Answer

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

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