pyroSAR/gamma/util.py
def correctOSV(id, osvdir=None, logpath=None, osvType='POE'):
    """
    correct GAMMA parameter files with orbit state vector information from dedicated OSV files
    
    Parameters
    ----------
    id: ~pyroSAR.drivers.ID
        the scene to be corrected
    osvdir: str
        the directory of OSV files; subdirectories POEORB and RESORB are created automatically
    logpath: str
        a path to write logfiles to
    osvType: str or list
        the type of orbit file either 'POE', 'RES' or a list of both

    Returns
    -------
    """
    
    if not isinstance(id, ID):
        raise IOError('id must be of type pyroSAR.ID')
    
    if id.sensor not in ['S1A', 'S1B']:
        raise IOError('this method is currently only available for Sentinel-1. Please stay tuned...')
    
    if not os.path.isdir(logpath):
        os.makedirs(logpath)
    
    if osvdir is None:
        osvdir = os.path.join(id.scene, 'osv')
        if not os.path.isdir(osvdir):
            os.makedirs(osvdir)
        try:
            id.getOSV(osvdir, osvType)
        except URLError:
            print('..no internet access')
    
    images = id.getGammaImages(id.scene)
    # read parameter file entries int object
    with ISPPar(images[0] + '.par') as par:
        # extract acquisition time stamp
        timestamp = datetime(*map(int, par.date)).strftime('%Y%m%dT%H%M%S')
    
    # find an OSV file matching the time stamp and defined OSV type(s)
    with OSV(osvdir) as osv:
        osvfile = osv.match(timestamp, osvType)
    if not osvfile:
        raise RuntimeError('no Orbit State Vector file found')
    
    # update the GAMMA parameter file with the selected orbit state vectors
    print('correcting state vectors with file {}'.format(osvfile))
    for image in images:
        process(['S1_OPOD_vec', image + '.par', osvfile], logpath=logpath)

    correct GAMMA parameter files with orbit state vector information from dedicated OSV files
    
    Parameters
    ----------
    id: ~pyroSAR.drivers.ID
        the scene to be corrected
    osvdir: str
        the directory of OSV files; subdirectories POEORB and RESORB are created automatically
    logpath: str
        a path to write logfiles to
    osvType: str or list
        the type of orbit file either 'POE', 'RES' or a list of both

    Returns
    -------
    
correct GAMMA parameter files with orbit state vector information from dedicated OSV files
Parameters

~pyroSAR.drivers.ID
the scene to be corrected
osvdir: str
the directory of OSV files; subdirectories POEORB and RESORB are created automatically
logpath: str
a path to write logfiles to
osvType: str or list
the type of orbit file either 'POE', 'RES' or a list of both

Returns
correct GAMMA parameter files with orbit state vector information from dedicated OSV files Parameters ~pyroSAR . drivers . ID the scene to be corrected osvdir : str the directory of OSV files ; subdirectories POEORB and RESORB are created automatically logpath : str a path to write logfiles to osvType : str or list the type of orbit file either ' POE ' ' RES ' or a list of both Returns
def correctOSV(id, osvdir=None, logpath=None, osvType='POE'):
    if not isinstance(id, ID):
        raise IOError('id must be of type pyroSAR.ID')
    if id.sensor not in ['S1A', 'S1B']:
        raise IOError('this method is currently only available for Sentinel-1. Please stay tuned...')
    if not os.path.isdir(logpath):
        os.makedirs(logpath)
    if osvdir is None:
        osvdir = os.path.join(id.scene, 'osv')
        if not os.path.isdir(osvdir):
            os.makedirs(osvdir)
        try:
            id.getOSV(osvdir, osvType)
        except URLError:
            print('..no internet access')
    images = id.getGammaImages(id.scene)
    with ISPPar(images[0] + '.par') as par:
        timestamp = datetime(*map(int, par.date)).strftime('%Y%m%dT%H%M%S')
    with OSV(osvdir) as osv:
        osvfile = osv.match(timestamp, osvType)
    if not osvfile:
        raise RuntimeError('no Orbit State Vector file found')
    print('correcting state vectors with file {}'.format(osvfile))
    for image in images:
        process(['S1_OPOD_vec', image + '.par', osvfile], logpath=logpath)
def correctOSV ( id , osvdir = None , logpath = None , osvType = 'POE' ) : if not isinstance ( id , ID ) : raise IOError ( 'id must be of type pyroSAR.ID' ) if id . sensor not in [ 'S1A' , 'S1B' ] : raise IOError ( 'this method is currently only available for Sentinel-1. Please stay tuned...' ) if not os . path . isdir ( logpath ) : os . makedirs ( logpath ) if osvdir is None : osvdir = os . path . join ( id . scene , 'osv' ) if not os . path . isdir ( osvdir ) : os . makedirs ( osvdir ) try : id . getOSV ( osvdir , osvType ) except URLError : print ( '..no internet access' ) images = id . getGammaImages ( id . scene ) with ISPPar ( images [ 0 ] + '.par' ) as par : timestamp = datetime ( * map ( int , par . date ) ) . strftime ( '%Y%m%dT%H%M%S' ) with OSV ( osvdir ) as osv : osvfile = osv . match ( timestamp , osvType ) if not osvfile : raise RuntimeError ( 'no Orbit State Vector file found' ) print ( 'correcting state vectors with file {}' . format ( osvfile ) ) for image in images : process ( [ 'S1_OPOD_vec' , image + '.par' , osvfile ] , logpath = logpath )
correct GAMMA parameter files with orbit state vector information from dedicated OSV files
Parameters
correct GAMMA parameter files with orbit state vector information from dedicated OSV files Parameters
"""
    correct GAMMA parameter files with orbit state vector information from dedicated OSV files
    
    Parameters
    ----------
    id: ~pyroSAR.drivers.ID
        the scene to be corrected
    osvdir: str
        the directory of OSV files; subdirectories POEORB and RESORB are created automatically
    logpath: str
        a path to write logfiles to
    osvType: str or list
        the type of orbit file either 'POE', 'RES' or a list of both

    Returns
    -------
    """ # read parameter file entries int object # extract acquisition time stamp # find an OSV file matching the time stamp and defined OSV type(s) # update the GAMMA parameter file with the selected orbit state vectors
id
osvdir
logpath
osvType