diff --git a/components/isceobj/Sensor/GRD/Sentinel1.py b/components/isceobj/Sensor/GRD/Sentinel1.py index 45e648b..00f9195 100755 --- a/components/isceobj/Sensor/GRD/Sentinel1.py +++ b/components/isceobj/Sensor/GRD/Sentinel1.py @@ -261,10 +261,10 @@ class Sentinel1(Component): self.validateUserInputs() - if self.xml.startswith('/vsizip'): #Read from zip file + if '.zip' in self.xml: try: parts = self.xml.split(os.path.sep) - zipname = os.path.join(*(parts[2:-3])) + zipname = os.path.join('/',*(parts[:-3])) fname = os.path.join(*(parts[-3:])) with zipfile.ZipFile(zipname, 'r') as zf: @@ -291,8 +291,10 @@ class Sentinel1(Component): ####Read in the orbits if self.orbitFile: - orb = self.extractPreciseOrbit() - else: + try: + orb = self.extractPreciseOrbit() + except: + pass orb = self.extractOrbit() self.product.orbit.setOrbitSource('Header') @@ -423,10 +425,11 @@ class Sentinel1(Component): nsp = "{http://www.esa.int/safe/sentinel-1.0}" - if self.manifest.startswith('/vsizip'): + if '.zip' in self.manifest: + import zipfile parts = self.manifest.split(os.path.sep) - zipname = os.path.join(*(parts[2:-2])) + zipname = os.path.join('/',*(parts[:-2])) fname = os.path.join(*(parts[-2:])) try: @@ -516,13 +519,7 @@ class Sentinel1(Component): vec.setVelocity(vel) frameOrbit.addStateVector(vec) - - orbExt = OrbitExtender(planet=Planet(pname='Earth')) - orbExt.configure() - newOrb = orbExt.extendOrbit(frameOrbit) - - - return newOrb + return frameOrbit def extractPreciseOrbit(self): ''' @@ -533,10 +530,9 @@ class Sentinel1(Component): except IOError as strerr: print("IOError: %s" % strerr) return - - _xml_root = ElementTree(file=fp).getroot() + #_xml_root = ElementTree(file=fp).getroot() - node = _xml_root.find('Data_Block/List_of_OSVs') + node = self._xml_root.find('Data_Block/List_of_OSVs') print('Extracting orbit from Orbit File: ', self.orbitFile) orb = Orbit() @@ -582,10 +578,10 @@ class Sentinel1(Component): if self.calibrationXml is None: raise Exception('No calibration file provided') - if self.calibrationXml.startswith('/vsizip'): + if '.zip' in self.calibrationXml: import zipfile parts = self.calibrationXml.split(os.path.sep) - zipname = os.path.join(*(parts[2:-4])) + zipname = os.path.join('/',*(parts[:-4])) fname = os.path.join(*(parts[-4:])) try: @@ -723,7 +719,7 @@ class Sentinel1(Component): print('Extracting normalized image ....') - src = gdal.Open(self.tiff.strip(), gdal.GA_ReadOnly) + src = gdal.Open('/vsizip//'+self.tiff.strip(), gdal.GA_ReadOnly) band = src.GetRasterBand(1) if self.product.numberOfSamples != src.RasterXSize: