Commit a8e96ff9 authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

FIX: Rebuild gapfilled time series (including dummy metadata file - debug).

Showing with 16 additions and 5 deletions
+16 -5
...@@ -44,15 +44,26 @@ def rebuildSeries(stack_fn, nc, od_fn, out_fld): ...@@ -44,15 +44,26 @@ def rebuildSeries(stack_fn, nc, od_fn, out_fld):
onm = nm[0] + '_' + d + '_' + nm[2] onm = nm[0] + '_' + d + '_' + nm[2]
if not os.path.exists(out_fld + '/' + onm): if not os.path.exists(out_fld + '/' + onm):
os.mkdir(out_fld + '/' + onm) os.mkdir(out_fld + '/' + onm)
else: #else:
sys.exit('Folder ' + out_fld + '/' + onm + ' already exists!') # sys.exit('Folder ' + out_fld + '/' + onm + ' already exists!')
expr = '{' + ','.join(['im1b'+str(b) for b in range(i+1,i+nc+1)]) + '}' expr = '{' + ','.join(['im1b'+str(b) for b in range(i+1,i+nc+1)]) + '}'
cmd = ['otbcli_BandMathX','-il',stack_fn,'-exp',expr,'-out',out_fld + '/' + onm + '/STACK_gapf.tif',dty] #cmd = ['otbcli_BandMathX','-il',stack_fn,'-exp',expr,'-out',out_fld + '/' + onm + '/STACK_gapf.tif',dty]
subprocess.call(cmd, shell=sh) subprocess.call(cmd, shell=sh)
cmd = ['otbcli_ManageNoData', '-in', out_fld + '/' + onm + '/STACK_gapf.tif', '-mode', 'buildmask', '-out', out_fld + '/' + onm + '/MASK_gapf.tif', 'uint8'] #cmd = ['otbcli_ManageNoData', '-in', out_fld + '/' + onm + '/STACK_gapf.tif', '-mode', 'buildmask', '-out', out_fld + '/' + onm + '/MASK_gapf.tif', 'uint8']
subprocess.call(cmd, shell=sh) subprocess.call(cmd, shell=sh)
cmd = ['otbcli_BandMath', '-il', out_fld + '/' + onm + '/MASK_gapf.tif', '-exp', 'im1b1==2', '-out', out_fld + '/' + onm + '/GAPMASK_gapf.tif', 'uint8'] #cmd = ['otbcli_BandMath', '-il', out_fld + '/' + onm + '/MASK_gapf.tif', '-exp', 'im1b1==2', '-out', out_fld + '/' + onm + '/GAPMASK_gapf.tif', 'uint8']
subprocess.call(cmd, shell=sh) subprocess.call(cmd, shell=sh)
# Dummy metadata file generation
if nm[0] == 'S2':
fn = 'tileInfo.json'
elif nm[0] == 'S2THEIA':
fn = 'GAPF_MTD_ALL.xml'
elif nm[0] == 'L8':
fn = 'GAPF_MTL.txt'
with open(out_fld + '/' + onm + '/' + fn,'wb') as mf:
mf.write('*** Dummy metadata file for ' + nm[0] + ' ***')
i += nc i += nc
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment