Update I solved it thanks to this thread
To get the optional variable for any process use:
from snappy import GPF
GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis()
op_spi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi('OperatorName')
print('Op name:', op_spi.getOperatorDescriptor().getName())
print('Op alias:', op_spi.getOperatorDescriptor().getAlias())
param_Desc = op_spi.getOperatorDescriptor().getParameterDescriptors()
for param in param_Desc:
print(param.getName(), "or", param.getAlias())
I just added in “parameters.put(‘saveLocalIncidenceAngle’, True)” and the third band in the output has the incidence angle
def terrain_correction(raster):
# doppler range terrain correction
# default projection is WGS84
parameters = snappy.HashMap()
parameters.put('demName', 'SRTM 3Sec') # DEM will be automatically downloaded
parameters.put('imgResamplingMethod', 'BILINEAR_INTERPOLATION') # default
parameters.put('nodataValueAtSea', False) # do not mask out areas without elevation
parameters.put('saveSelectedSourceBand', True)
parameters.put('saveLocalIncidenceAngle', True)
terrain_correct = snappy.GPF.createProduct('Terrain-Correction', parameters, raster)
print("[INFO] terrain corrected")
return terrain_correct