I have two rasters. One with the following values: 0,1,2,3,4,5,6,7,8,9,10 and the other one with continuous values ranging from 0 to 10000. I would like to create a raster where only values of the second raster will be kept when the first raster has values from 4 to 6. How could I do this using gdal_calc.py?
gdal_calc.py -A first_raster.tif -B second_raster.tif --outfile=Result.tif --calc="B*(3<=A>=7)" --NoDataValue=0
But I get a Value Error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Is that the correct way to introduce this condition in to the raster calculator? I thought that follows the same logic than the raster calculator used in QGIS, where the value in the ouput we want goes together with the * simbol and the condition goes in parenthesis.