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()
|
self.validateUserInputs()
|
||||||
|
|
||||||
if self.xml.startswith('/vsizip'): #Read from zip file
|
if '.zip' in self.xml:
|
||||||
try:
|
try:
|
||||||
parts = self.xml.split(os.path.sep)
|
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:]))
|
fname = os.path.join(*(parts[-3:]))
|
||||||
|
|
||||||
with zipfile.ZipFile(zipname, 'r') as zf:
|
with zipfile.ZipFile(zipname, 'r') as zf:
|
||||||
|
@ -291,8 +291,10 @@ class Sentinel1(Component):
|
||||||
|
|
||||||
####Read in the orbits
|
####Read in the orbits
|
||||||
if self.orbitFile:
|
if self.orbitFile:
|
||||||
orb = self.extractPreciseOrbit()
|
try:
|
||||||
else:
|
orb = self.extractPreciseOrbit()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
orb = self.extractOrbit()
|
orb = self.extractOrbit()
|
||||||
|
|
||||||
self.product.orbit.setOrbitSource('Header')
|
self.product.orbit.setOrbitSource('Header')
|
||||||
|
@ -423,10 +425,11 @@ class Sentinel1(Component):
|
||||||
|
|
||||||
nsp = "{http://www.esa.int/safe/sentinel-1.0}"
|
nsp = "{http://www.esa.int/safe/sentinel-1.0}"
|
||||||
|
|
||||||
if self.manifest.startswith('/vsizip'):
|
if '.zip' in self.manifest:
|
||||||
|
|
||||||
import zipfile
|
import zipfile
|
||||||
parts = self.manifest.split(os.path.sep)
|
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:]))
|
fname = os.path.join(*(parts[-2:]))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -516,13 +519,7 @@ class Sentinel1(Component):
|
||||||
vec.setVelocity(vel)
|
vec.setVelocity(vel)
|
||||||
frameOrbit.addStateVector(vec)
|
frameOrbit.addStateVector(vec)
|
||||||
|
|
||||||
|
return frameOrbit
|
||||||
orbExt = OrbitExtender(planet=Planet(pname='Earth'))
|
|
||||||
orbExt.configure()
|
|
||||||
newOrb = orbExt.extendOrbit(frameOrbit)
|
|
||||||
|
|
||||||
|
|
||||||
return newOrb
|
|
||||||
|
|
||||||
def extractPreciseOrbit(self):
|
def extractPreciseOrbit(self):
|
||||||
'''
|
'''
|
||||||
|
@ -533,10 +530,9 @@ class Sentinel1(Component):
|
||||||
except IOError as strerr:
|
except IOError as strerr:
|
||||||
print("IOError: %s" % strerr)
|
print("IOError: %s" % strerr)
|
||||||
return
|
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)
|
print('Extracting orbit from Orbit File: ', self.orbitFile)
|
||||||
orb = Orbit()
|
orb = Orbit()
|
||||||
|
@ -582,10 +578,10 @@ class Sentinel1(Component):
|
||||||
if self.calibrationXml is None:
|
if self.calibrationXml is None:
|
||||||
raise Exception('No calibration file provided')
|
raise Exception('No calibration file provided')
|
||||||
|
|
||||||
if self.calibrationXml.startswith('/vsizip'):
|
if '.zip' in self.calibrationXml:
|
||||||
import zipfile
|
import zipfile
|
||||||
parts = self.calibrationXml.split(os.path.sep)
|
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:]))
|
fname = os.path.join(*(parts[-4:]))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -723,7 +719,7 @@ class Sentinel1(Component):
|
||||||
|
|
||||||
print('Extracting normalized image ....')
|
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)
|
band = src.GetRasterBand(1)
|
||||||
|
|
||||||
if self.product.numberOfSamples != src.RasterXSize:
|
if self.product.numberOfSamples != src.RasterXSize:
|
||||||
|
|
Loading…
Reference in New Issue