I’m using the gdal_calc.py in python in order to do the same thing as the Con tool in ArcGIS. I’m calling the .py using os.system:
os.system('gdal_calc.py -A%s -B%s --outfile=%s --calc="((A==-9999)*B)+((A>=-9000)*A)" --type="Float32"' % (file1,file2,Output_File))
Basically, I want to look at file1, and if a pixel has a value of -9999, replace it with the value from file2. Overall, the script runs and outputs a file that seems to be correct, however, when I randomly click through pixels to check their validity, I end up getting some pixel values that don’t match either file1 or file2. I have no idea how these pixel values are being calculated. Also, these are not just pixels around the very edge of the image, but all over.