Ejemplo n.º 1
0
def make_dirs():
    """
    Create directories needed to run s2p.
    """
    common.mkdir_p(cfg['out_dir'])
    common.mkdir_p(os.path.expandvars(cfg['temporary_dir']))

    # store a json dump of the config.cfg dictionary
    with open(os.path.join(cfg['out_dir'], 'config.json'), 'w') as f:
        cfg_copy = copy.deepcopy(cfg)
        cfg_copy['out_dir'] = '.'
        json.dump(cfg_copy, f, indent=2, default=workaround_json_int64)

    # copy RPC xml files in the output directory
    for img in cfg['images']:
        shutil.copy2(img['rpc'], cfg['out_dir'])

    # download needed srtm tiles
    if not cfg['disable_srtm']:
        x = cfg['roi']['x']
        y = cfg['roi']['y']
        w = cfg['roi']['w']
        h = cfg['roi']['h']
        for s in srtm.list_srtm_tiles(cfg['images'][0]['rpc'], x, y, w, h):
            srtm.get_srtm_tile(s, cfg['srtm_dir'])
Ejemplo n.º 2
0
def make_dirs():
    """
    Create directories needed to run s2p.
    """
    common.mkdir_p(cfg['out_dir'])
    common.mkdir_p(os.path.expandvars(cfg['temporary_dir']))

    # store a json dump of the config.cfg dictionary
    with open(os.path.join(cfg['out_dir'], 'config.json'), 'w') as f:
        cfg_copy = copy.deepcopy(cfg)
        cfg_copy['out_dir']='.'
        json.dump(cfg_copy, f, indent=2)

    # copy RPC xml files in the output directory
    for img in cfg['images']:
        shutil.copy2(img['rpc'], cfg['out_dir'])

    # download needed srtm tiles
    if not cfg['disable_srtm']:
        x = cfg['roi']['x']
        y = cfg['roi']['y']
        w = cfg['roi']['w']
        h = cfg['roi']['h']
        for s in srtm.list_srtm_tiles(cfg['images'][0]['rpc'], x, y, w, h):
            srtm.get_srtm_tile(s, cfg['srtm_dir'])