Add files via upload
updated mainly to read the zipped datasets, remove orbit extender, try except for precise/coarse orbitLT1AB
parent
a6357870c7
commit
c6e8c7922e
|
@ -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:
|
||||
try:
|
||||
orb = self.extractPreciseOrbit()
|
||||
else:
|
||||
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:
|
||||
|
|
Loading…
Reference in New Issue