Sentinel-1 export incidence angle raster with python

I am looking to get the local incidence angle for different parcels of land so I want to be able to export a raster containing the incidence angles as pixel values.

From this link I see I should "apply Range Doppler Terrain Correction on your data, select WGS84 as output coordinate system (already predefined) and include the local incidence angle in the output " but I am not sure how to translate this into a python script. I have this so far:

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)
    terrain_correct = snappy.GPF.createProduct('Terrain-Correction', parameters, raster)
    print("[INFO] terrain corrected")

    return terrain_correct

continue on with preprocessing

But I can’t find anywhere stating how to set the including local incidence angle as a parameter.

Any advice?

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