I'm very new to python and arcpy.
The task:
I have a large series of rasters (r0, r1, r2, r3...) (tif; n=240) and corresponding quality rasters (qr0, qr1, qr2, qr3...) (tif) with values 0,1,2,3 (whereas 0 is good quality and all other values are bad quality). I would like to check the cell quality of a quality raster (e.g. qr1) in a if-statement
. If condition is true (quality=good=0), I would like to replace that quality value by the corresponding raster (r1), if not, I would like to check if the quality is true in the previous quality raster (qr0) at the same pixel location and if true, I would like to replace the quality value with that raster value (r0). In the case that quality value is also bad, I would like to check a third case: if the following quality raster value (qr2) is true, than replace the value with the corresponding raster (r2). If the quality is bad in all three quality rasters (qr0, qr1, qr2), than assign a no data to the cell.
My initial idea: As far as I'm informed I should use a nested for loop-statements with if or elif-statements but I'm a bit confused in how assigning the speficic rasters and looping through them.