pyroSAR/gamma/util.py
def multilook(infile, outfile, targetres):
    """
    multilooking of SLC and MLI images

    if the image is in slant range the ground range resolution is computed by dividing the range pixel spacing by
    the sine of the incidence angle

    the looks in range and azimuth are chosen to approximate the target resolution by rounding the ratio between
    target resolution and ground range/azimuth pixel spacing to the nearest integer

    an ENVI HDR parameter file is automatically written for better handling on other software

    :param infile a SAR image in GAMMA format with a parameter file of name <infile>.par
    :param outfile the name of the output GAMMA file
    :param targetres: the target resolution in ground range


    """
    # read the input parameter file
    par = ISPPar(infile + '.par')
    
    # compute the range looks
    if par.image_geometry == 'SLANT_RANGE':
        # compute the ground range resolution
        groundRangePS = par.range_pixel_spacing / (math.sin(math.radians(par.incidence_angle)))
        rlks = int(round(float(targetres) / groundRangePS))
    else:
        rlks = int(round(float(targetres) / par.range_pixel_spacing))
    # compute the azimuth looks
    azlks = int(round(float(targetres) / par.azimuth_pixel_spacing))
    
    # set the look factors to 1 if they were computed to be 0
    rlks = rlks if rlks > 0 else 1
    azlks = azlks if azlks > 0 else 1
    
    if par.image_format in ['SCOMPLEX', 'FCOMPLEX']:
        # multilooking for SLC images
        process(['multi_look', infile, infile + '.par', outfile, outfile + '.par', rlks, azlks])
    else:
        # multilooking for MLI images
        process(['multi_look_MLI', infile, infile + '.par', outfile, outfile + '.par', rlks, azlks])
    par2hdr(outfile + '.par', outfile + '.hdr')

    multilooking of SLC and MLI images

    if the image is in slant range the ground range resolution is computed by dividing the range pixel spacing by
    the sine of the incidence angle

    the looks in range and azimuth are chosen to approximate the target resolution by rounding the ratio between
    target resolution and ground range/azimuth pixel spacing to the nearest integer

    an ENVI HDR parameter file is automatically written for better handling on other software

    :param infile a SAR image in GAMMA format with a parameter file of name <infile>.par
    :param outfile the name of the output GAMMA file
    :param targetres: the target resolution in ground range


    
multilooking of SLC and MLI images
if the image is in slant range the ground range resolution is computed by dividing the range pixel spacing by
the sine of the incidence angle

the looks in range and azimuth are chosen to approximate the target resolution by rounding the ratio between
target resolution and ground range/azimuth pixel spacing to the nearest integer

an ENVI HDR parameter file is automatically written for better handling on other software

:param infile a SAR image in GAMMA format with a parameter file of name .par
:param outfile the name of the output GAMMA file
:param targetres: the target resolution in ground range
multilooking of SLC and MLI images if the image is in slant range the ground range resolution is computed by dividing the range pixel spacing by the sine of the incidence angle the looks in range and azimuth are chosen to approximate the target resolution by rounding the ratio between target resolution and ground range / azimuth pixel spacing to the nearest integer an ENVI HDR parameter file is automatically written for better handling on other software : param infile a SAR image in GAMMA format with a parameter file of name . par : param outfile the name of the output GAMMA file : param targetres : the target resolution in ground range
def multilook(infile, outfile, targetres):
    par = ISPPar(infile + '.par')
    if par.image_geometry == 'SLANT_RANGE':
        groundRangePS = par.range_pixel_spacing / (math.sin(math.radians(par.incidence_angle)))
        rlks = int(round(float(targetres) / groundRangePS))
    else:
        rlks = int(round(float(targetres) / par.range_pixel_spacing))
    azlks = int(round(float(targetres) / par.azimuth_pixel_spacing))
    rlks = rlks if rlks > 0 else 1
    azlks = azlks if azlks > 0 else 1
    if par.image_format in ['SCOMPLEX', 'FCOMPLEX']:
        process(['multi_look', infile, infile + '.par', outfile, outfile + '.par', rlks, azlks])
    else:
        process(['multi_look_MLI', infile, infile + '.par', outfile, outfile + '.par', rlks, azlks])
    par2hdr(outfile + '.par', outfile + '.hdr')
def multilook ( infile , outfile , targetres ) : par = ISPPar ( infile + '.par' ) if par . image_geometry == 'SLANT_RANGE' : groundRangePS = par . range_pixel_spacing / ( math . sin ( math . radians ( par . incidence_angle ) ) ) rlks = int ( round ( float ( targetres ) / groundRangePS ) ) else : rlks = int ( round ( float ( targetres ) / par . range_pixel_spacing ) ) azlks = int ( round ( float ( targetres ) / par . azimuth_pixel_spacing ) ) rlks = rlks if rlks > 0 else 1 azlks = azlks if azlks > 0 else 1 if par . image_format in [ 'SCOMPLEX' , 'FCOMPLEX' ] : process ( [ 'multi_look' , infile , infile + '.par' , outfile , outfile + '.par' , rlks , azlks ] ) else : process ( [ 'multi_look_MLI' , infile , infile + '.par' , outfile , outfile + '.par' , rlks , azlks ] ) par2hdr ( outfile + '.par' , outfile + '.hdr' )
multilooking of SLC and MLI images
if the image is in slant range the ground range resolution is computed by dividing the range pixel spacing by
the sine of the incidence angle
multilooking of SLC and MLI images if the image is in slant range the ground range resolution is computed by dividing the range pixel spacing by the sine of the incidence angle
"""
    multilooking of SLC and MLI images

    if the image is in slant range the ground range resolution is computed by dividing the range pixel spacing by
    the sine of the incidence angle

    the looks in range and azimuth are chosen to approximate the target resolution by rounding the ratio between
    target resolution and ground range/azimuth pixel spacing to the nearest integer

    an ENVI HDR parameter file is automatically written for better handling on other software

    :param infile a SAR image in GAMMA format with a parameter file of name <infile>.par
    :param outfile the name of the output GAMMA file
    :param targetres: the target resolution in ground range


    """ # read the input parameter file # compute the range looks # compute the ground range resolution # compute the azimuth looks # set the look factors to 1 if they were computed to be 0 # multilooking for SLC images # multilooking for MLI images
infile
outfile
targetres