update system call of gdal2isce_xml with python interface
+ update os.system() call of gdal2isce_xml.py with the python function call, in stripmapStack/topo.py and applications/downsampleDEM.py + break the long lines in downsampleDEM.py for easy readingLT1AB
parent
f06d22e02c
commit
f14981341d
|
@ -30,11 +30,12 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
|
||||||
from osgeo import gdal
|
from osgeo import gdal
|
||||||
|
from isce.applications.gdal2isce_xml import gdal2isce_xml
|
||||||
|
|
||||||
|
|
||||||
# command line parsing of input file
|
# command line parsing of input file
|
||||||
def cmdLineParse():
|
def cmdLineParse():
|
||||||
|
@ -74,10 +75,20 @@ if __name__ == '__main__':
|
||||||
# convert the output resolution from m in degrees
|
# convert the output resolution from m in degrees
|
||||||
# (this is approximate, could use instead exact expression)
|
# (this is approximate, could use instead exact expression)
|
||||||
if inps.res_meter != '':
|
if inps.res_meter != '':
|
||||||
gdal_opts = gdal.WarpOptions(format='ENVI',outputType=gdal.GDT_Int16,dstSRS='EPSG:4326',xRes=float(inps.res_meter)/110/1000,yRes=float(inps.res_meter)/110/1000,targetAlignedPixels=True)
|
gdal_opts = gdal.WarpOptions(format='ENVI',
|
||||||
|
outputType=gdal.GDT_Int16,
|
||||||
|
dstSRS='EPSG:4326',
|
||||||
|
xRes=float(inps.res_meter)/110/1000,
|
||||||
|
yRes=float(inps.res_meter)/110/1000,
|
||||||
|
targetAlignedPixels=True)
|
||||||
# res_degree = float(inps.res_meter)/110/1000
|
# res_degree = float(inps.res_meter)/110/1000
|
||||||
elif inps.res_seconds != '':
|
elif inps.res_seconds != '':
|
||||||
gdal_opts = gdal.WarpOptions(format='ENVI',outputType=gdal.GDT_Int16,dstSRS='EPSG:4326',xRes=float(inps.res_seconds)*1/60*1/60,yRes=float(inps.res_seconds)*1/60*1/60,targetAlignedPixels=True)
|
gdal_opts = gdal.WarpOptions(format='ENVI',
|
||||||
|
outputType=gdal.GDT_Int16,
|
||||||
|
dstSRS='EPSG:4326',
|
||||||
|
xRes=float(inps.res_seconds)*1/60*1/60,
|
||||||
|
yRes=float(inps.res_seconds)*1/60*1/60,
|
||||||
|
targetAlignedPixels=True)
|
||||||
# res_degree = float(1/60*1/60*float(inps.res_seconds))
|
# res_degree = float(1/60*1/60*float(inps.res_seconds))
|
||||||
|
|
||||||
# The ENVI filename of the coarse DEM to be generated
|
# The ENVI filename of the coarse DEM to be generated
|
||||||
|
@ -90,5 +101,5 @@ if __name__ == '__main__':
|
||||||
ds = None
|
ds = None
|
||||||
|
|
||||||
# Generating the ISCE xml and vrt of this coarse DEM
|
# Generating the ISCE xml and vrt of this coarse DEM
|
||||||
cmd = "gdal2isce_xml.py -i " + coarse_dem_envi
|
gdal2isce_xml(coarse_dem_envi+'.vrt')
|
||||||
os.system(cmd)
|
|
||||||
|
|
|
@ -419,9 +419,8 @@ def runMultilook(in_dir, out_dir, alks, rlks, in_ext='.rdr', out_ext='.rdr', met
|
||||||
|
|
||||||
# generate ISCE .xml file
|
# generate ISCE .xml file
|
||||||
if not os.path.isfile(out_file+'.xml'):
|
if not os.path.isfile(out_file+'.xml'):
|
||||||
cmd = 'gdal2isce_xml.py -i {}.vrt'.format(out_file)
|
from isce.applications.gdal2isce_xml import gdal2isce_xml
|
||||||
print(cmd)
|
gdal2isce_xml(out_file+'.vrt')
|
||||||
os.system(cmd)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise ValueError('un-supported multilook method: {}'.format(method))
|
raise ValueError('un-supported multilook method: {}'.format(method))
|
||||||
|
|
Loading…
Reference in New Issue