Generate xml file programmatically

These nested loops will give you every combination of every raster:

for ndviraster in NDVIrasters:
    ras1 = Raster(ndviraster)
    for ndiiraster in NDIIrasters:
        ras2=Raster(ndiiraster)

Instead you probably want to do something like:

for idx in range(0, len(NDVIrasters) - 1):
  ras1 = NDVIrasters[idx]
  ras2 = NDIIrasters[idx]
  # etc

This will take the first NDVI raster, the first NDII raster (etc) the first time it runs, then the second of each type of raster the second time it runs (etc)

Tags:

Xml

File

Magento2