Example #1
0
def run():
    need_merge = False
    atlaas_tiles = glob.glob("atlaas.*x*.tif")
    for fatlaas in atlaas_tiles:
        fregion = "region.%s.png"%fatlaas.split('.')[1]
        need_convert = True
        file_exists = False
        if os.path.isfile(fregion):
            file_exists = True
            satlaas = os.stat(fatlaas)
            sregion = os.stat(fregion)
            if satlaas.st_mtime <= sregion.st_mtime:
                need_convert = False
        if need_convert:
            logger.debug(fregion)
            if file_exists:
                atlaas.tile_to_region(fatlaas, fregion+".tmp")
                merge(fregion+".tmp", fregion)
                os.unlink(fregion+".tmp")
            else:
                atlaas.tile_to_region(fatlaas, fregion)
            need_merge = True
    if need_merge:
        sys.stdout = devnull
        atlaas.merge("region.*x*.png", "region.png")
        sys.stdout = stdout
Example #2
0
def run():
    need_merge = False
    atlaas_tiles = glob.glob("atlaas.*x*.tif")
    for fatlaas in atlaas_tiles:
        fregion = "region.%s.png" % fatlaas.split('.')[1]
        need_convert = True
        file_exists = False
        if os.path.isfile(fregion):
            file_exists = True
            satlaas = os.stat(fatlaas)
            sregion = os.stat(fregion)
            if satlaas.st_mtime <= sregion.st_mtime:
                need_convert = False
        if need_convert:
            logger.debug(fregion)
            if file_exists:
                atlaas.tile_to_region(fatlaas, fregion + ".tmp")
                merge(fregion + ".tmp", fregion)
                os.unlink(fregion + ".tmp")
            else:
                atlaas.tile_to_region(fatlaas, fregion)
            need_merge = True
    if need_merge:
        sys.stdout = devnull
        atlaas.merge("region.*x*.png", "region.png")
        sys.stdout = stdout
Example #3
0
from atlaas.helpers.image import zero

if not glob.glob("atlaas.*x*.tif"):
    test = atlaas.Atlaas()
    test.init(120.0, 120.0, 0.1, 377016.5, 4824342.9, 141.0, 31, True)
    test.process()
    test.save_currents()
    del test

# 1st erase data in tiles so as to have same size in merge() without noise
for fatlaas in glob.glob("atlaas.*x*.tif"):
    g = gdal2(fatlaas)
    g.bands *= 0
    g.save()
    fregion = "region.%s.png"%fatlaas.split('.')[1]
    atlaas.tile_to_region(fatlaas, fregion)

for fregion in glob.glob("region.*x*.png"):
    zero(fregion) # empty data

pcd_id = 0
patern = 'cloud.%05i.pcd'

test = atlaas.Atlaas()
test.init(120.0, 120.0, 0.1, 377016.5, 4824342.9, 141.0, 31, True)

while os.path.isfile(patern%pcd_id):
    test.merge_file(patern%pcd_id)
    test.save_currents()
    atlaas.merge('atlaas.*x*.tif', 'merged.atlaas.%05i.tif'%pcd_id, compress=True)
    for fatlaas in glob.glob("atlaas.*x*.tif"):