Пример #1
0
def main():
    """
    Placeholder
    """

    # parse command line arguments
    args = parseArguments()
    processor = Processor()

    # load spreadsheet
    df = pd.read_excel(args.inventory_file,
                       sheet_name=os.path.splitext(
                           os.path.basename(args.inventory_file))[0])

    # extract data folders
    pathlist = getPathList(args.root_path, '[0-9]{8}_[0-9]{6}')
    for path in pathlist:

        # generate pansharpened image if not exists or overwrite
        pathname = os.path.join(path, 'pansharpen_432.tif')
        if not os.path.exists(pathname) or args.overwrite:
            processor.getPansharpenImage(pathname)

        if os.path.exists(pathname):

            # extract unique details from pathname
            uid = getUniqueId(pathname)
            dt = getDateTimeString(pathname)

            if uid is not None and dt is not None:

                # retrieve record from spreadsheet
                record = df.loc[df['uid'] == uid]
                if record is not None:

                    try:
                        # generate 8bit image chip from pansharpened image
                        out_pathname = os.path.join(
                            os.path.join(args.out_path, uid),
                            '{}-{}.jpg'.format(uid, dt))
                        # out_pathname = os.path.join( args.out_path, '{}_{}.jpg'.format( uid, dt ) )
                        processor.getImageChip(pathname, (float(
                            record['longitude']), float(record['latitude'])),
                                               out_pathname)
                    except:
                        pass

    return
Пример #2
0
def main():
    """
    Placeholder
    """

    # parse command line arguments
    args = parseArguments()
    aoi = AoI()
    processor = Processor()

    # load spreadsheet
    df = pd.read_excel(args.inventory_file,
                       sheet_name=os.path.splitext(
                           os.path.basename(args.inventory_file))[0])

    # extract data folders
    pathlist = getPathList(args.root_path, '[0-9]{8}_[0-9]{6}$')
    for path in pathlist:

        # extract unique details from pathname
        uid = getUniqueId(path)
        dt = getDateTimeString(path)

        if uid is not None and dt is not None:

            # retrieve record from spreadsheet
            record = df.loc[df['uid'] == uid]
            if record is not None:

                try:
                    # merge TCI images into single image chip
                    out_pathname = os.path.join(
                        os.path.join(args.out_path, uid),
                        '{}-{}.jpg'.format(uid, dt))
                    processor.getImageChip(path, (float(
                        record['longitude']), float(record['latitude'])),
                                           out_pathname,
                                           size=512)

                except:
                    pass

    return
Пример #3
0
def getSceneList(args):

    """
    Placeholder
    """

    # assume single scene - else collect list
    pathlist = [ args.scene ]
    if args.batch is True:
        pathlist = getPathList( args.scene, os.path.join( args.scene, '*20*_*' ) )

    # get path list
    scenes = []
    for path in pathlist:

        dt = getDateTimeString( path )
        scenes.append ( path[ 0 : path.find( dt ) + len(dt) ] )

    return list( set ( scenes ) )
Пример #4
0
def main():

    """
    Placeholder
    """

    # parse arguments
    args = parseArguments()
    root = getRootPath( args.scene )

    # define aois
    aois = [ 
        {   'name' : 'shokpar',
            'bbox' : [ 43.1547, 74.8458, 43.1692, 74.8853 ]
        },
        {   'name' : 'gargarinskoye',
            'bbox' : [ 43.3863, 74.6333, 43.4083, 74.6741 ]
        },
        {   'name' : 'alaygyr',
            'bbox' : [ 49.0279, 74.4044, 49.0446, 74.4551 ]
        },
        {   'name' : 'kairakty',
            'bbox' : [ 48.6708, 73.2317, 48.7014, 73.2972 ]
        } 
        ]

    # create object and get unique datetimes
    dates = getDateList( args )
    obj = Processor()

    # for each aoi
    for aoi in aois:
        for d in dates:

            pathlist = getPathList( root, '{}*{}_*/{}'.format( root, d, aoi[ 'name' ] ) )
            if len( pathlist ) > 0:

                # execute processing
                out_path = '{}/{}/{}_000000'.format ( root.replace( 'ard', 'products' ), aoi[ 'name' ], d )
                obj.process( pathlist, out_path )

    return
Пример #5
0
def getDateTimeList(args):

    """
    Placeholder
    """

    # assume single scene - else collect list
    scenes = [ args.scene ]
    if args.batch is True:
        scenes = getPathList( args.scene, os.path.join( args.scene, '*20*_*' ) )
        
    # create list of datetime folders
    datetimes = []
    for scene in scenes:

        dt = getDateTimeString( scene )
        if dt is not datetimes :
            datetimes.append( dt )

    # ensure non duplicate list
    return list( set( datetimes ) )