I'm trying to write the Raster Calculator as part of a Python script for use with my other code. The below code runs with no errors but no output file is put in the directory.
Can anyone advise me what the issue is that this function doesn't appear to be working?
from qgis.core import QgsRasterLayerfrom PyQt5.QtGui import *from PyQt5.QtCore import *from qgis.analysis import *import processingfrom processing.core.Processing import Processingfrom qgis.analysis import QgsRasterCalculator, QgsRasterCalculatorEntrylayer_a = QgsRasterLayer('C:/Users/Public/try/singlebeam.tif','singlebeam') entries_a = [] band = QgsRasterCalculatorEntry() band.ref = layer_a.name() +'@1'band.raster = layer_a band.bandNumber = 1 entries_a.append(band)layer_b = QgsRasterLayer('C:/Users/Public/try/multibeam.tif', 'multibeam') entries_b = [] band = QgsRasterCalculatorEntry() band.ref = layer_b.name() +'@1'band.raster = layer_b band.bandNumber = 1 entries_b.append(band)expression = '("singlebeam@1" = 0) * "multibeam@1" + ("singlebeam@1" != 0) * "singlebeam@1"'path_to_output_file = 'C:/Users/Public/try/pycalc.tif'calc = QgsRasterCalculator(expression, path_to_output_file,'GTiff', layer_a.extent(), layer_a.width(), layer_a.height(), entries_a) result = calc.processCalculation()print("Complete!")