Skip to content

Instantly share code, notes, and snippets.

@PierrickKoch
Last active April 28, 2016 16:20
Show Gist options
  • Save PierrickKoch/bbc2e6a239647d7f22c00c35fa048afc to your computer and use it in GitHub Desktop.
Save PierrickKoch/bbc2e6a239647d7f22c00c35fa048afc to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
import os
import glob
import atlaas
from atlaas.helpers.gdal2 import gdal2
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)
for fatlaas in glob.glob("atlaas.*x*.tif"):
fregion = "region.%s.png"%fatlaas.split('.')[1]
atlaas.tile_to_region(fatlaas, fregion)
atlaas.merge('region.*x*.png', 'merged.region.%05i.png'%pcd_id)
pcd_id += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment