30
30
31
31
32
32
33
-
33
+ import os
34
34
import sys
35
35
import argparse
36
- import os
37
36
from osgeo import gdal
37
+ from isce .applications .gdal2isce_xml import gdal2isce_xml
38
+
38
39
39
40
# command line parsing of input file
40
41
def cmdLineParse ():
@@ -62,22 +63,32 @@ def cmdLineParse():
62
63
63
64
# check if the input file exist
64
65
if not os .path .isfile (inps .input_dem_vrt ):
65
- raise Exception ('Input file is not found ....' )
66
+ raise Exception ('Input file is not found ....' )
66
67
# check if the provided input file is a .vrt file and also get the envi filename
67
68
input_dem_envi , file_extension = os .path .splitext (inps .input_dem_vrt )
68
69
if file_extension != '.vrt' :
69
- raise Exception ('Input file is not a vrt file ....' )
70
+ raise Exception ('Input file is not a vrt file ....' )
70
71
# get the file path
71
72
input_path = os .path .dirname (os .path .abspath (inps .input_dem_vrt ))
72
73
73
74
74
75
# convert the output resolution from m in degrees
75
76
# (this is approximate, could use instead exact expression)
76
77
if inps .res_meter != '' :
77
- 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 )
78
+ gdal_opts = gdal .WarpOptions (format = 'ENVI' ,
79
+ outputType = gdal .GDT_Int16 ,
80
+ dstSRS = 'EPSG:4326' ,
81
+ xRes = float (inps .res_meter )/ 110 / 1000 ,
82
+ yRes = float (inps .res_meter )/ 110 / 1000 ,
83
+ targetAlignedPixels = True )
78
84
# res_degree = float(inps.res_meter)/110/1000
79
85
elif inps .res_seconds != '' :
80
- 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 )
86
+ gdal_opts = gdal .WarpOptions (format = 'ENVI' ,
87
+ outputType = gdal .GDT_Int16 ,
88
+ dstSRS = 'EPSG:4326' ,
89
+ xRes = float (inps .res_seconds )* 1 / 60 * 1 / 60 ,
90
+ yRes = float (inps .res_seconds )* 1 / 60 * 1 / 60 ,
91
+ targetAlignedPixels = True )
81
92
# res_degree = float(1/60*1/60*float(inps.res_seconds))
82
93
83
94
# The ENVI filename of the coarse DEM to be generated
@@ -90,5 +101,5 @@ def cmdLineParse():
90
101
ds = None
91
102
92
103
# Generating the ISCE xml and vrt of this coarse DEM
93
- cmd = " gdal2isce_xml.py -i " + coarse_dem_envi
94
- os . system ( cmd )
104
+ gdal2isce_xml ( coarse_dem_envi + '.vrt' )
105
+
0 commit comments