Merge remote-tracking branch 'rtburns/pycuampcor-suggestions' into pycuampcor

LT1AB
Lijun Zhu 2021-07-27 10:54:20 -07:00
commit eae30c10a8
33 changed files with 472 additions and 551 deletions

View File

@ -53,6 +53,10 @@ jobs:
topsApp.py --help --steps
stripmapApp.py --help --steps
python3 -c "import isce"
# Create dummy ref/secondary configs for topsApp
ln -s ../examples/input_files/reference_TOPS_SENTINEL1.xml reference.xml
ln -s reference.xml secondary.xml
topsApp.py --steps --end=preprocess ../examples/input_files/topsApp.xml
test:
docker:

View File

@ -246,7 +246,7 @@ from collections import UserDict
def dict_to_xml(adict,file,nodeTag=None,elementTag=None):
a = ET.Element(nodeTag) # something to hang nodes on
a = dict_to_et(a,adict,nodeTag,elementTag)
et = a.getchildren()[0]
et = list(a)[0]
indent(et)
tree = ET.ElementTree(et)
tree.write(file)

View File

@ -44,7 +44,7 @@ class CEOSDB(object):
self.metadata = {}
if not xml == None:
self.xmlFP = open(self.xml, 'r')
self.rootChildren = ET(file=self.xmlFP).getroot().getchildren()
self.rootChildren = list(ET(file=self.xmlFP).getroot())
else:
self.xmlFP = None
self.rootChildren = []
@ -81,7 +81,7 @@ class CEOSDB(object):
self.metadata[key] = [None]*loopCount
for i in range(loopCount):
struct = {}
for node in z.getchildren():
for node in z:
(subkey,data) = self.decodeNode(node)
struct[subkey] = data
self.metadata[key][i] = struct
@ -98,7 +98,7 @@ class CEOSDB(object):
xmlFP = open(self.xml, 'r')
self.root = ET(file=xmlFP).getroot()
for z in self.root.getchildren():
for z in self.root:
# If the tag name is 'rec', this is a plain old record
if z.tag == 'rec':
(key,data) = self.decodeNode(z)
@ -116,7 +116,7 @@ class CEOSDB(object):
self.metadata[key] = [None]*loopCount
for i in range(loopCount):
struct = {}
for node in z.getchildren():
for node in z:
(subkey,data) = self.decodeNode(node)
struct[subkey] = data
self.metadata[key][i] = struct

View File

@ -276,8 +276,8 @@ class Radarsat2_GRD(Component):
glist = (self.getxmlelement('imageAttributes/geographicInformation/geolocationGrid'))
lat = []
lon = []
for child in glist.getchildren():
for grandchild in child.getchildren():
for child in glist:
for grandchild in child:
string = ElementTree.tostring(grandchild, encoding = 'unicode', method = 'xml')
string = string.split("<")[1]
string = string.split(">")[0]
@ -303,7 +303,7 @@ class Radarsat2_GRD(Component):
if node.tag == 'stateVector':
sv = StateVector()
sv.configure()
for z in node.getchildren():
for z in node:
if z.tag == 'timeStamp':
timeStamp = self.convertToDateTime(z.text)
elif z.tag == 'xPosition':
@ -346,16 +346,16 @@ class Radarsat2_GRD(Component):
if not node.tag == 'imageTiePoint':
continue
for z in node.getchildren():
for z in node:
if z.tag == 'imageCoordinate':
for zz in z.getchildren():
for zz in z:
if zz.tag == 'line':
line = float(zz.text)
elif zz.tag == 'pixel':
pixel = float(zz.text)
if z.tag == 'geodeticCoordinate':
for zz in z.getchildren():
for zz in z:
if zz.tag == 'latitude':
lat = float(zz.text)
elif zz.tag == 'longitude':
@ -424,8 +424,8 @@ class Radarsat2_GRD(Component):
lines = []
data = []
for child in node.getchildren():
for child in node.getchildren():
for child in node:
for child in node:
string = ElementTree.tostring(child, encoding = 'unicode', method = 'xml')
string = string.split("<")[1]
string = string.split(">")[0]

View File

@ -406,7 +406,7 @@ class Sentinel1(Component):
lat = []
lon = []
for child in glist.getchildren():
for child in glist:
lat.append( float(child.find('latitude').text))
lon.append( float(child.find('longitude').text))
@ -502,7 +502,7 @@ class Sentinel1(Component):
frameOrbit = Orbit()
frameOrbit.configure()
for child in node.getchildren():
for child in node:
timestamp = self.convertToDateTime(child.find('time').text)
pos = []
vel = []
@ -543,7 +543,7 @@ class Sentinel1(Component):
tstart = self.product.sensingStart - margin
tend = self.product.sensingStop + margin
for child in node.getchildren():
for child in node:
timestamp = self.convertToDateTime(child.find('UTC').text[4:])
if (timestamp >= tstart) and (timestamp < tend):
@ -606,7 +606,7 @@ class Sentinel1(Component):
pixels = []
data = None
for ii, child in enumerate(node.getchildren()):
for ii, child in enumerate(node):
pixnode = child.find('pixel')
nump = int(pixnode.attrib['count'])
@ -685,7 +685,7 @@ class Sentinel1(Component):
noise_range_lut_indices = np.zeros((num_vectors,))
noise_range_lut_values = np.zeros((num_vectors, self.product.numberOfSamples))
for ii, child in enumerate(node.getchildren()):
for ii, child in enumerate(node):
print("Processing range noise vector {}/{}".format(ii + 1, num_vectors))
pixnode = child.find('pixel')
@ -711,7 +711,7 @@ class Sentinel1(Component):
noise_azimuth_lut_indices = defaultdict(list)
noise_azimuth_lut_values = defaultdict(list)
for block_i, child in enumerate(node.getchildren()):
for block_i, child in enumerate(node):
print("Processing azimuth noise vector {}/{}".format(block_i + 1, num_vectors))
linenode = child.find('line')
signode = child.find("noiseAzimuthLut")
@ -861,7 +861,7 @@ class Sentinel1(Component):
data = []
for ii, child in enumerate(node.getchildren()):
for ii, child in enumerate(node):
t0 = self.convertToDateTime(child.find('azimuthTime').text)
lines.append( (t0-self.product.sensingStart).total_seconds()/self.product.azimuthTimeInterval)

View File

@ -325,8 +325,8 @@ class Terrasar_GRD(Component):
glist = (self.getxmlelement(self._xml2_root, 'geolocationGrid'))
lat = []
lon = []
for child in glist.getchildren():
for grandchild in child.getchildren():
for child in glist:
for grandchild in child:
string = ElementTree.tostring(child, encoding = 'unicode', method = 'xml')
string = string.split("<")[1]
string = string.split(">")[0]
@ -352,7 +352,7 @@ class Terrasar_GRD(Component):
if node.tag == 'stateVec':
sv = StateVector()
sv.configure()
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
timeStamp = self.convertToDateTime2(z.text)
elif z.tag == 'posX':
@ -396,7 +396,7 @@ class Terrasar_GRD(Component):
if not node.tag == 'gridPoint':
continue
for zz in node.getchildren():
for zz in node:
if zz.tag == 't':
az_time = float(zz.text)
elif zz.tag == 'tau':
@ -429,9 +429,9 @@ class Terrasar_GRD(Component):
if not node.tag == 'antennaPattern':
continue
for z in node.getchildren():
for z in node:
if z.tag == 'elevationPattern':
for zz in z.getchildren():
for zz in z:
if zz.tag == 'gainExt':
node = float(zz.text)
node2.append(node)
@ -467,9 +467,9 @@ class Terrasar_GRD(Component):
for node in self._xml_root.find('productSpecific'):
if not node.tag == 'projectedImageInfo':
continue
for z in node.getchildren():
for z in node:
if z.tag == 'slantToGroundRangeProjection':
for zz in z.getchildren():
for zz in z:
if zz.tag == 'coefficient':
p = float(zz.text)*(SPEED_OF_LIGHT)
pp.append(p)

View File

@ -441,7 +441,7 @@ class _Product(Radarsat2Namespace):
self.imageAttributes = _ImageAttributes()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('productId'):
self.productId = z.text
elif z.tag == self.elementName('documentIdentifier'):
@ -483,7 +483,7 @@ class _SourceAttributes(Radarsat2Namespace):
self.orbitAndAttitude = _OrbitAndAttitude()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('satellite'):
self.satellite = z.text
elif z.tag == self.elementName('sensor'):
@ -548,7 +548,7 @@ class _RadarParameters(Radarsat2Namespace):
def set_from_etnode(self,node):
i = 0
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('acquisitionType'):
self.acquisitionType = z.text
elif z.tag == self.elementName('beams'):
@ -608,7 +608,7 @@ class _ReferenceNoiseLevel(Radarsat2Namespace):
self.noiseLevelValues = []
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('pixelFirstNoiseValue'):
self.pixelFirstNoiseValue = int(z.text)
elif z.tag == self.elementName('stepSize'):
@ -660,7 +660,7 @@ class _OrbitAndAttitude(Radarsat2Namespace):
self.attitudeInformation = _AttitudeInformation()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('orbitInformation'):
self.orbitInformation.set_from_etnode(z)
elif z.tag == self.elementName('attitudeInformation'):
@ -685,7 +685,7 @@ class _OrbitInformation(Radarsat2Namespace):
self.stateVectors = []
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('passDirection'):
self.passDirection = z.text
elif z.tag == self.elementName('orbitDataSource'):
@ -722,7 +722,7 @@ class _StateVector(Radarsat2Namespace):
self.zVelocity = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('timeStamp'):
self.timeStamp = self.convertToDateTime(z.text)
elif z.tag == self.elementName('xPosition'):
@ -766,7 +766,7 @@ class _AttitudeInformation(Radarsat2Namespace):
self.attitudeAngles = []
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('attitudeDataSource'):
self.attitudeDataSource = z.text
elif z.tag == self.elementName('attitudeOffsetApplied'):
@ -797,7 +797,7 @@ class _AttitudeAngles(Radarsat2Namespace):
self.pitch = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('timeStamp'):
self.timeStamp = self.convertToDateTime(z.text)
elif z.tag == self.elementName('yaw'):
@ -833,7 +833,7 @@ class _ImageGenerationParameters(Radarsat2Namespace):
self.payloadCharacteristicsFile = []
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('generalProcessingInformation'):
self.generalProcessingInformation.set_from_etnode(z)
elif z.tag == self.elementName('sarProcessingInformation'):
@ -869,7 +869,7 @@ class _GeneralProcessingInformation(Radarsat2Namespace):
self.softwareVersion = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('productType'):
self.productType = z.text
elif z.tag == self.elementName('_processingFacility'):
@ -925,7 +925,7 @@ class _SarProcessingInformation(Radarsat2Namespace):
self._satelliteHeight = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('lutApplied'):
self.lutApplied = z.text
elif z.tag == self.elementName('numberOfLinesProcessed'):
@ -971,7 +971,7 @@ class _Window(Radarsat2Namespace):
self.windowCoefficient = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('windowName'):
self.windowName = z.text
elif z.tag == self.elementName('windowCoefficient'):
@ -1000,7 +1000,7 @@ class _DopplerCentroid(Radarsat2Namespace):
self.dopplerCentroidConfidence = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('timeOfDopplerCentroidEstimate'):
self.timeOfDopplerCentroidEstimate = self.convertToDateTime(z.text)
elif z.tag == self.elementName('dopplerAmbiguity'):
@ -1027,7 +1027,7 @@ class _DopplerRateValues(Radarsat2Namespace):
self.dopplerRateValuesCoefficients = []
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('dopplerRateReferenceTime'):
self.dopplerRateReferenceTime = float(z.text)
elif z.tag == self.elementName('dopplerRateValuesCoefficients'):
@ -1056,7 +1056,7 @@ class _SlantRangeToGroundRange(Radarsat2Namespace):
self.groundToSlantRangeCoefficients = []
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('zeroDopplerAzimuthTime'):
self.zeroDopplerAzimuthTime = self.convertToDateTime(z.text)
elif z.tag == self.elementName('slantRangeTimeToFirstRangeSample'):
@ -1072,7 +1072,7 @@ class _ImageAttributes(Radarsat2Namespace):
self.fullResolutionImageData = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('productFormat'):
self.productFormat = z.text
elif z.tag == self.elementName('outputMediaInterleaving'):
@ -1097,7 +1097,7 @@ class _RasterAttributes(Radarsat2Namespace):
self.pixelTimeOrdering = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('dataType'):
self.dataType = z.text
elif z.tag == self.elementName('bitsPerSample'):
@ -1123,7 +1123,7 @@ class _GeographicInformation(Radarsat2Namespace):
self.referenceEllipsoidParameters = _ReferenceEllipsoidParameters()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('geolocationGrid'):
self.geolocationGrid.set_from_etnode(z)
@ -1133,7 +1133,7 @@ class _GeolocationGrid(Radarsat2Namespace):
self.imageTiePoint = []
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('imageTiePoint'):
tp = _ImageTiePoint()
tp.set_from_etnode(z)
@ -1147,7 +1147,7 @@ class _ImageTiePoint(Radarsat2Namespace):
self.geodeticCoordinates = _GeodeticCoordinates()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('imageCoordinate'):
self.imageCoordinates.set_from_etnode(z)
elif z.tag == self.elementName('geodeticCoordinate'):
@ -1170,7 +1170,7 @@ class _ImageCoordinates(Radarsat2Namespace):
self.pixel = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('line'):
self.line = float(z.text)
elif z.tag == self.elementName('pixel'):
@ -1194,7 +1194,7 @@ class _GeodeticCoordinates(Radarsat2Namespace):
self.height = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('latitude'):
self.latitude = float(z.text)
elif z.tag == self.elementName('longitude'):
@ -1223,7 +1223,7 @@ class _ReferenceEllipsoidParameters(Radarsat2Namespace):
self.geodeticTerrainHeight = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == self.elementName('ellipsoidName'):
self.ellipsoidName = z.text
elif z.tag == self.elementName('semiMajorAxis'):

View File

@ -370,7 +370,7 @@ class Sentinel1(Sensor):
frameOrbit = Orbit()
frameOrbit.setOrbitSource('Header')
for child in node.getchildren():
for child in node:
timestamp = self.convertToDateTime(child.find('time').text)
pos = []
vel = []
@ -416,7 +416,7 @@ class Sentinel1(Sensor):
tstart = self.frame.getSensingStart() - margin
tend = self.frame.getSensingStop() + margin
for child in node.getchildren():
for child in node:
timestamp = self.convertToDateTime(child.find('UTC').text[4:])
if (timestamp >= tstart) and (timestamp < tend):
@ -487,7 +487,7 @@ class Sentinel1(Sensor):
tdiff = 1.0e9
dpoly = None
for index, burst in enumerate(node.getchildren()):
for index, burst in enumerate(node):
refTime = self.convertToDateTime( burst.find('azimuthTime').text)
delta = abs((refTime - self.frame.sensingMid).total_seconds())

View File

@ -635,7 +635,7 @@ class Sentinel1(Component):
'''
burstList = self.getxmlelement('swathTiming/burstList')
for index, burst in enumerate(burstList.getchildren()):
for index, burst in enumerate(burstList):
bb = self.product.bursts[index]
bb.sensingStart = self.convertToDateTime(burst.find('azimuthTime').text)
deltaT = datetime.timedelta(seconds=(bb.numberOfLines - 1)*bb.azimuthTimeInterval)
@ -670,7 +670,7 @@ class Sentinel1(Component):
####Read in fm rates separately
fmrateList = self.getxmlelement('generalAnnotation/azimuthFmRateList')
fmRates = []
for index, burst in enumerate(fmrateList.getchildren()):
for index, burst in enumerate(fmrateList):
r0 = 0.5 * Const.c * float(burst.find('t0').text)
try:
c0 = float(burst.find('c0').text)
@ -702,7 +702,7 @@ class Sentinel1(Component):
dcList = self.getxmlelement('dopplerCentroid/dcEstimateList')
dops = [ ]
for index, burst in enumerate(dcList.getchildren()):
for index, burst in enumerate(dcList):
r0 = 0.5 * Const.c* float(burst.find('t0').text)
refTime = self.convertToDateTime(burst.find('azimuthTime').text)
@ -729,7 +729,7 @@ class Sentinel1(Component):
eapList = self.getxmlelement('antennaPattern/antennaPatternList')
eaps = []
for index, burst in enumerate(eapList.getchildren()):
for index, burst in enumerate(eapList):
refTime = self.convertToDateTime(burst.find('azimuthTime').text)
taus = [float(val) for val in burst.find('slantRangeTime').text.split()]
angs = [float(val) for val in burst.find('elevationAngle').text.split()]
@ -801,7 +801,7 @@ class Sentinel1(Component):
frameOrbit = Orbit()
frameOrbit.configure()
for child in node.getchildren():
for child in node:
timestamp = self.convertToDateTime(child.find('time').text)
pos = []
vel = []
@ -847,7 +847,7 @@ class Sentinel1(Component):
tstart = self.product.bursts[0].sensingStart - margin
tend = self.product.bursts[-1].sensingStop + margin
for child in node.getchildren():
for child in node:
timestamp = self.convertToDateTime(child.find('UTC').text[4:])
if (timestamp >= tstart) and (timestamp < tend):
@ -889,7 +889,7 @@ class Sentinel1(Component):
xml_root = ET.ElementTree(file=fp).getroot()
res = xml_root.find('calibrationParamsList/calibrationParams')
paramsList = xml_root.find('calibrationParamsList')
for par in (paramsList.getchildren()):
for par in paramsList:
if (par.find('swath').text.strip() == ('IW'+str(burst.swathNumber))) and (par.find('polarisation').text == burst.polarization):
self._delta_theta = float(par.find('elevationAntennaPattern/elevationAngleIncrement').text)
Geap_IQ = [float(val) for val in par.find('elevationAntennaPattern/values').text.split()]

View File

@ -122,8 +122,7 @@ class TanDEMX(Component):
raise IOError(strerr)
self._xml_root = ElementTree(file=fp).getroot()
a = self._xml_root.getchildren()
for z in a:
for z in self._xml_root:
if z.tag == 'generalHeader':
self.generalHeader.set_from_etnode(z)
if z.tag == 'productComponents':
@ -441,7 +440,7 @@ class _GeneralHeader(object):
self.fileName = node.attrib['fileName']
self.fileVersion = node.attrib['fileVersion']
self.status = node.attrib['status']
for z in node.getchildren():
for z in node:
if z.tag == 'itemName':
self.itemName = z.text
if z.tag == 'mission':
@ -512,7 +511,7 @@ class _ProductComponents(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'annotation':
self.annotation.append(_Annotation())
self.annotation[-1].set_from_etnode(z)
@ -554,7 +553,7 @@ class _Annotation(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'type':
self.type = z.text
if z.tag == 'file':
@ -581,7 +580,7 @@ class _ImageData(object):
def set_from_etnode(self,node):
self.layerIndex = int(node.attrib['layerIndex'])
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.type = z.text
if z.tag == 'file':
@ -610,7 +609,7 @@ class _QuickLooks(object):
def set_from_etnode(self,node):
self.layerIndex = int(node.attrib['layerIndex'])
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.type = z.text
if z.tag == 'file':
@ -636,7 +635,7 @@ class _CompositeQuickLook(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'file':
self.file.set_from_etnode(z)
return
@ -656,7 +655,7 @@ class _BrowseImage(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'file':
self.file.set_from_etnode(z)
return
@ -676,7 +675,7 @@ class _MapPlot(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'file':
self.file.set_from_etnode(z)
return
@ -706,7 +705,7 @@ class _ProductInfo(object):
self.sceneInfo = _SceneInfo()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'generationInfo':
self.generationInfo.set_from_etnode(z)
if z.tag == 'missionInfo':
@ -752,7 +751,7 @@ class _GenerationInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'logicalProductID':
self.logicalProductID = z.text
if z.tag == 'receivingStation':
@ -800,7 +799,7 @@ class _QualityInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'qualityInspection':
self.qualityInspection = z.text
if z.tag == 'qualityRemark':
@ -830,7 +829,7 @@ class _MissionInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'mission':
self.mission = z.text
if z.tag == 'orbitPhase':
@ -872,7 +871,7 @@ class _PolarisationList(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.polLayer = z.text
@ -890,7 +889,7 @@ class _ImagingModeStripMap(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'azimuthBeamID':
self.azimuthBeamID = z.text
return
@ -908,7 +907,7 @@ class _ImagingModeSpecificInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'stripMap':
self.stripMap.set_from_etnode(z)
return
@ -933,7 +932,7 @@ class _AcquisitionInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'sensor':
self.sensor = z.text
if z.tag == 'imagingMode':
@ -980,7 +979,7 @@ class _ProductVariantInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'productType':
self.productType = z.text
if z.tag == 'productVariant':
@ -1014,7 +1013,7 @@ class _ImageRaster(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'numberOfRows':
self.numberOfRows = int(z.text)
if z.tag == 'numberOfColumns':
@ -1062,7 +1061,7 @@ class _ImageDataInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'imageRaster':
self.imageRaster.set_from_etnode(z)
return
@ -1084,7 +1083,7 @@ class _SceneInfoTime(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = z.text
if z.tag == 'timeGPS':
@ -1111,7 +1110,7 @@ class _SceneInfoRangeTime(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'firstPixel':
self.firstPixel = float(z.text)
if z.tag == 'lastPixel':
@ -1139,7 +1138,7 @@ class _SceneInfoSceneCornerCoord(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'refRow':
self.refRow = int(z.text)
if z.tag == 'refColumn':
@ -1188,7 +1187,7 @@ class _SceneCenterCoord(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'refRow':
self.refRow = int(z.text)
if z.tag == 'refColumn':
@ -1237,7 +1236,7 @@ class _SceneInfo(object):
def set_from_etnode(self,node):
iCorner = -1
for z in node.getchildren():
for z in node:
if z.tag == 'sceneID':
self.sceneID = z.text
if z.tag == 'start':
@ -1282,7 +1281,7 @@ class _ProductSpecific(object):
self.complexImageInfo = _ComplexImageInfo()
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'complexImageInfo':
self.complexImageInfo.set_from_etnode(z)
return
@ -1302,7 +1301,7 @@ class _ComplexImageInfo(object):
self.quicklookDataStartWith = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'commonPRF':
self.commonPRF = float(z.text)
if z.tag == 'commonRSF':
@ -1348,7 +1347,7 @@ class _ProjectedSpacingRange(object):
self.slantRange = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'groundNear':
self.groundNear = float(z.text)
if z.tag == 'groundFar':
@ -1381,7 +1380,7 @@ class _Platform(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'referenceData':
self.referenceData.set_from_etnode(z)
if z.tag == 'orbit':
@ -1410,7 +1409,7 @@ class _SARAntennaPosition(object):
def set_from_etnode(self,node):
self.DRAoffset = node.attrib['DRAoffset']
for w in node.getchildren():
for w in node:
if w.tag == 'x':
self.x = float(w.text)
if w.tag == 'y':
@ -1438,7 +1437,7 @@ class _GPSAntennaPosition(object):
def set_from_etnode(self,node):
self.GPSreceiver = node.attrib['GPSreceiver']
self.unit = node.attrib['unit']
for w in node.getchildren():
for w in node:
if w.tag == 'x':
self.x = float(w.text)
if w.tag == 'y':
@ -1469,7 +1468,7 @@ class _PlatformReferenceData(object):
def set_from_etnode(self,node):
iGPSAnt = -1
for x in node.getchildren():
for x in node:
if x.tag == 'SARAntennaMechanicalBoresight':
self.SARAntennaMechanicalBoresight = float(x.text)
if x.tag == 'SARAntennaPosition':
@ -1497,7 +1496,7 @@ class _FirstStateTime(object):
self.firstStateTimeGPSFraction = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'firstStateTimeUTC':
self.firstStateTimeUTC = z.text
if z.tag == 'firstStateTimeGPS':
@ -1523,7 +1522,7 @@ class _LastStateTime(object):
self.lastStateTimeGPSFraction = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'lastStateTimeUTC':
self.lastStateTimeUTC = z.text
if z.tag == 'lastStateTimeGPS':
@ -1562,7 +1561,7 @@ class _OrbitHeader(object):
self.dataGapIndicator = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'generationSystem':
self.generationSystem = z.text
self.generationSystemVersion = z.attrib['version']
@ -1652,7 +1651,7 @@ class _StateVec(object):
self.maneuver = node.attrib['maneuver']
self.num = int(node.attrib['num'])
self.qualInd = int(node.attrib['qualInd'])
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = datetime.datetime.strptime(z.text,"%Y-%m-%dT%H:%M:%S.%f")
if z.tag == 'timeGPS':
@ -1700,7 +1699,7 @@ class _Orbit(object):
self.stateVec = ()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'orbitHeader':
self.orbitHeader.set_from_etnode(z)
if z.tag == 'stateVec':
@ -1737,7 +1736,7 @@ class _AttitudeData(object):
self.maneuver = node.attrib['maneuver']
self.num = int(node.attrib['num'])
self.qualInd = int(node.attrib['qualInd'])
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = z.text
if z.tag == 'timeGPS':
@ -1782,7 +1781,7 @@ class _FirstAttitudeTime(object):
self.firstAttitudeTimeGPSFraction = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'firstAttitudeTimeUTC':
self.firstAttitudeTimeUTC = z.text
if z.tag == 'firstAttitudeTimeGPS':
@ -1808,7 +1807,7 @@ class _LastAttitudeTime(object):
self.lastAttitudeTimeGPSFraction = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'lastAttitudeTimeUTC':
self.lastAttitudeTimeUTC = z.text
if z.tag == 'lastAttitudeTimeGPS':
@ -1834,7 +1833,7 @@ class _AttitudeDataRefFrame(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'FromFrame':
self.FromFrame = z.text
if z.tag == 'ToFrame':
@ -1870,7 +1869,7 @@ class _AttitudeHeader(object):
self.steeringLawIndicator = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'generationSystem':
self.generationSystem = z.text
self.generationSystemVersion = z.attrib['version']
@ -1948,7 +1947,7 @@ class _Attitude(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'attitudeHeader':
self.attitudeHeader.set_from_etnode(z)
if z.tag == 'attitudeData':
@ -1977,7 +1976,7 @@ class _Instrument(object):
self.settings = _InstrumentSettings()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'instrumentInfoCoordinateType':
self.instrumentInfoCoordinateType = z.text
if z.tag == 'radarParameters':
@ -2003,7 +2002,7 @@ class _RadarParameters(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'centerFrequency':
self.centerFrequency = float(z.text)
return
@ -2024,7 +2023,7 @@ class _RxGainSetting(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'startTimeUTC':
self.startTimeUTC = z.text
if z.tag == 'stopTimeUTC':
@ -2058,7 +2057,7 @@ class _DataSegment(object):
def set_from_etnode(self,node):
self.segmentID = int(node.attrib['segmentID'])
for z in node.getchildren():
for z in node:
if z.tag == 'startTimeUTC':
self.startTimeUTC = z.text
if z.tag == 'stopTimeUTC':
@ -2095,7 +2094,7 @@ class _SettingRecord(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'dataSegment':
self.dataSegment.set_from_etnode(z)
if z.tag == 'PRF':
@ -2157,7 +2156,7 @@ class _InstrumentSettings(object):
self.settingRecord = ()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.polLayer = z.text
if z.tag == 'DRAoffset':
@ -2245,7 +2244,7 @@ class _Processing(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'geometry':
self.geometry.set_from_etnode(z)
if z.tag == 'doppler':
@ -2279,7 +2278,7 @@ class _ProcessingGeometry(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'geometryCoordinateType':
self.geometryCoordinateType = z.text
if z.tag == 'velocityParameter':
@ -2315,7 +2314,7 @@ class _VelocityParameter(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = z.text
if z.tag == 'velocityParameterPolynomial':
@ -2342,7 +2341,7 @@ class _VelocityParameterPolynomial(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -2385,7 +2384,7 @@ class _ZeroDopplerVelocity(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'velocity':
self.velocity = float(z.text)
return
@ -2405,7 +2404,7 @@ class _DopplerRate(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = z.text
if z.tag == 'dopplerRatePolynomial':
@ -2432,7 +2431,7 @@ class _DopplerRatePolynomial(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -2477,7 +2476,7 @@ class _ProcessingDoppler(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'dopplerBasebandEstimationMethod':
self.dopplerBasebandEstimationMethod = z.text
if z.tag == 'dopplerGeometricEstimationMethod':
@ -2518,7 +2517,7 @@ class _ProcessingDopplerCentroid(object):
def set_from_etnode(self,node):
self.layerIndex = int(node.attrib['layerIndex'])
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.polLayer = z.text
if z.tag == 'DRAoffset':
@ -2581,7 +2580,7 @@ class _DopplerEstimate(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = z.text
if z.tag == 'dopplerAtMidRange':
@ -2636,7 +2635,7 @@ class _BasebandDoppler(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -2681,7 +2680,7 @@ class _GeometricDoppler(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -2727,7 +2726,7 @@ class _CombinedDoppler(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -2779,7 +2778,7 @@ class _ProcessingParameter(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'beamID':
self.beamID = z.text
if z.tag == 'processingInfoCoordinateType':
@ -2844,7 +2843,7 @@ class _RangeCompression(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'segmentInfo':
self.segmentInfo.set_from_etnode(z)
if z.tag == 'chirps':
@ -2869,7 +2868,7 @@ class _RCSegmentInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.polLayer = z.text
if z.tag == 'dataSegment':
@ -2894,7 +2893,7 @@ class _RCDataSegment(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'startTimeUTC':
self.startTimeUTC = z.text
if z.tag == 'stopTimeUTC':
@ -2921,7 +2920,7 @@ class _RCChirps(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'referenceChirp':
self.referenceChirp.set_from_etnode(z)
return
@ -2949,7 +2948,7 @@ class _RCReferenceChirp(object):
def set_from_etnode(self,node):
self.pulseCode = int(node.attrib['pulseCode'])
for z in node.getchildren():
for z in node:
if z.tag == 'pulseType':
self.pulseType = z.text
if z.tag == 'chirpDesignator':
@ -3002,7 +3001,7 @@ class _RCChirpAmplitude(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -3047,7 +3046,7 @@ class _RCChirpPhase(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -3090,7 +3089,7 @@ class _CorrectedInstrumentDelay(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.polLayer = z.text
if z.tag == 'DRAoffset':
@ -3143,7 +3142,7 @@ class _File(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'location':
self.location.set_from_etnode(z)
if z.tag == 'size':
@ -3172,7 +3171,7 @@ class _FileLocation(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'host':
self.host = z.text
if z.tag == 'path':

View File

@ -117,8 +117,7 @@ class TerraSARX(Sensor):
raise IOError(strerr)
self._xml_root = ElementTree(file=fp).getroot()
a = self._xml_root.getchildren()
for z in a:
for z in self._xml_root:
if z.tag == 'generalHeader':
self.generalHeader.set_from_etnode(z)
if z.tag == 'productComponents':
@ -407,7 +406,7 @@ class _GeneralHeader(object):
self.fileName = node.attrib['fileName']
self.fileVersion = node.attrib['fileVersion']
self.status = node.attrib['status']
for z in node.getchildren():
for z in node:
if z.tag == 'itemName':
self.itemName = z.text
if z.tag == 'mission':
@ -478,7 +477,7 @@ class _ProductComponents(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'annotation':
self.annotation.append(_Annotation())
self.annotation[-1].set_from_etnode(z)
@ -520,7 +519,7 @@ class _Annotation(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'type':
self.type = z.text
if z.tag == 'file':
@ -547,7 +546,7 @@ class _ImageData(object):
def set_from_etnode(self,node):
self.layerIndex = int(node.attrib['layerIndex'])
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.type = z.text
if z.tag == 'file':
@ -576,7 +575,7 @@ class _QuickLooks(object):
def set_from_etnode(self,node):
self.layerIndex = int(node.attrib['layerIndex'])
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.type = z.text
if z.tag == 'file':
@ -602,7 +601,7 @@ class _CompositeQuickLook(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'file':
self.file.set_from_etnode(z)
return
@ -622,7 +621,7 @@ class _BrowseImage(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'file':
self.file.set_from_etnode(z)
return
@ -642,7 +641,7 @@ class _MapPlot(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'file':
self.file.set_from_etnode(z)
return
@ -673,7 +672,7 @@ class _ProductInfo(object):
self.sceneInfo = _SceneInfo()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'generationInfo':
self.generationInfo.set_from_etnode(z)
if z.tag == 'missionInfo':
@ -719,7 +718,7 @@ class _GenerationInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'logicalProductID':
self.logicalProductID = z.text
if z.tag == 'receivingStation':
@ -767,7 +766,7 @@ class _QualityInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'qualityInspection':
self.qualityInspection = z.text
if z.tag == 'qualityRemark':
@ -797,7 +796,7 @@ class _MissionInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'mission':
self.mission = z.text
if z.tag == 'orbitPhase':
@ -839,7 +838,7 @@ class _PolarisationList(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.polLayer = z.text
@ -857,7 +856,7 @@ class _ImagingModeStripMap(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'azimuthBeamID':
self.azimuthBeamID = z.text
return
@ -875,7 +874,7 @@ class _ImagingModeSpecificInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'stripMap':
self.stripMap.set_from_etnode(z)
return
@ -900,7 +899,7 @@ class _AcquisitionInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'sensor':
self.sensor = z.text
if z.tag == 'imagingMode':
@ -947,7 +946,7 @@ class _ProductVariantInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'productType':
self.productType = z.text
if z.tag == 'productVariant':
@ -981,7 +980,7 @@ class _ImageRaster(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'numberOfRows':
self.numberOfRows = int(z.text)
if z.tag == 'numberOfColumns':
@ -1029,7 +1028,7 @@ class _ImageDataInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'imageRaster':
self.imageRaster.set_from_etnode(z)
return
@ -1051,7 +1050,7 @@ class _SceneInfoTime(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = z.text
if z.tag == 'timeGPS':
@ -1078,7 +1077,7 @@ class _SceneInfoRangeTime(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'firstPixel':
self.firstPixel = float(z.text)
if z.tag == 'lastPixel':
@ -1106,7 +1105,7 @@ class _SceneInfoSceneCornerCoord(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'refRow':
self.refRow = int(z.text)
if z.tag == 'refColumn':
@ -1155,7 +1154,7 @@ class _SceneCenterCoord(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'refRow':
self.refRow = int(z.text)
if z.tag == 'refColumn':
@ -1204,7 +1203,7 @@ class _SceneInfo(object):
def set_from_etnode(self,node):
iCorner = -1
for z in node.getchildren():
for z in node:
if z.tag == 'sceneID':
self.sceneID = z.text
if z.tag == 'start':
@ -1249,7 +1248,7 @@ class _ProductSpecific(object):
self.complexImageInfo = _ComplexImageInfo()
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'complexImageInfo':
self.complexImageInfo.set_from_etnode(z)
return
@ -1269,7 +1268,7 @@ class _ComplexImageInfo(object):
self.quicklookDataStartWith = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'commonPRF':
self.commonPRF = float(z.text)
if z.tag == 'commonRSF':
@ -1315,7 +1314,7 @@ class _ProjectedSpacingRange(object):
self.slantRange = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'groundNear':
self.groundNear = float(z.text)
if z.tag == 'groundFar':
@ -1348,7 +1347,7 @@ class _Platform(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'referenceData':
self.referenceData.set_from_etnode(z)
if z.tag == 'orbit':
@ -1377,7 +1376,7 @@ class _SARAntennaPosition(object):
def set_from_etnode(self,node):
self.DRAoffset = node.attrib['DRAoffset']
for w in node.getchildren():
for w in node:
if w.tag == 'x':
self.x = float(w.text)
if w.tag == 'y':
@ -1405,7 +1404,7 @@ class _GPSAntennaPosition(object):
def set_from_etnode(self,node):
self.GPSreceiver = node.attrib['GPSreceiver']
self.unit = node.attrib['unit']
for w in node.getchildren():
for w in node:
if w.tag == 'x':
self.x = float(w.text)
if w.tag == 'y':
@ -1436,7 +1435,7 @@ class _PlatformReferenceData(object):
def set_from_etnode(self,node):
iGPSAnt = -1
for x in node.getchildren():
for x in node:
if x.tag == 'SARAntennaMechanicalBoresight':
self.SARAntennaMechanicalBoresight = float(x.text)
if x.tag == 'SARAntennaPosition':
@ -1464,7 +1463,7 @@ class _FirstStateTime(object):
self.firstStateTimeGPSFraction = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'firstStateTimeUTC':
self.firstStateTimeUTC = z.text
if z.tag == 'firstStateTimeGPS':
@ -1490,7 +1489,7 @@ class _LastStateTime(object):
self.lastStateTimeGPSFraction = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'lastStateTimeUTC':
self.lastStateTimeUTC = z.text
if z.tag == 'lastStateTimeGPS':
@ -1529,7 +1528,7 @@ class _OrbitHeader(object):
self.dataGapIndicator = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'generationSystem':
self.generationSystem = z.text
self.generationSystemVersion = z.attrib['version']
@ -1619,7 +1618,7 @@ class _StateVec(object):
self.maneuver = node.attrib['maneuver']
self.num = int(node.attrib['num'])
self.qualInd = int(node.attrib['qualInd'])
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = datetime.datetime.strptime(z.text,"%Y-%m-%dT%H:%M:%S.%f")
if z.tag == 'timeGPS':
@ -1667,7 +1666,7 @@ class _Orbit(object):
self.stateVec = ()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'orbitHeader':
self.orbitHeader.set_from_etnode(z)
if z.tag == 'stateVec':
@ -1704,7 +1703,7 @@ class _AttitudeData(object):
self.maneuver = node.attrib['maneuver']
self.num = int(node.attrib['num'])
self.qualInd = int(node.attrib['qualInd'])
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = z.text
if z.tag == 'timeGPS':
@ -1749,7 +1748,7 @@ class _FirstAttitudeTime(object):
self.firstAttitudeTimeGPSFraction = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'firstAttitudeTimeUTC':
self.firstAttitudeTimeUTC = z.text
if z.tag == 'firstAttitudeTimeGPS':
@ -1775,7 +1774,7 @@ class _LastAttitudeTime(object):
self.lastAttitudeTimeGPSFraction = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'lastAttitudeTimeUTC':
self.lastAttitudeTimeUTC = z.text
if z.tag == 'lastAttitudeTimeGPS':
@ -1801,7 +1800,7 @@ class _AttitudeDataRefFrame(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'FromFrame':
self.FromFrame = z.text
if z.tag == 'ToFrame':
@ -1837,7 +1836,7 @@ class _AttitudeHeader(object):
self.steeringLawIndicator = None
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'generationSystem':
self.generationSystem = z.text
self.generationSystemVersion = z.attrib['version']
@ -1915,7 +1914,7 @@ class _Attitude(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'attitudeHeader':
self.attitudeHeader.set_from_etnode(z)
if z.tag == 'attitudeData':
@ -1944,7 +1943,7 @@ class _Instrument(object):
self.settings = _InstrumentSettings()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'instrumentInfoCoordinateType':
self.instrumentInfoCoordinateType = z.text
if z.tag == 'radarParameters':
@ -1970,7 +1969,7 @@ class _RadarParameters(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'centerFrequency':
self.centerFrequency = float(z.text)
return
@ -1991,7 +1990,7 @@ class _RxGainSetting(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'startTimeUTC':
self.startTimeUTC = z.text
if z.tag == 'stopTimeUTC':
@ -2025,7 +2024,7 @@ class _DataSegment(object):
def set_from_etnode(self,node):
self.segmentID = int(node.attrib['segmentID'])
for z in node.getchildren():
for z in node:
if z.tag == 'startTimeUTC':
self.startTimeUTC = z.text
if z.tag == 'stopTimeUTC':
@ -2062,7 +2061,7 @@ class _SettingRecord(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'dataSegment':
self.dataSegment.set_from_etnode(z)
if z.tag == 'PRF':
@ -2124,7 +2123,7 @@ class _InstrumentSettings(object):
self.settingRecord = ()
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.polLayer = z.text
if z.tag == 'DRAoffset':
@ -2212,7 +2211,7 @@ class _Processing(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'geometry':
self.geometry.set_from_etnode(z)
if z.tag == 'doppler':
@ -2246,7 +2245,7 @@ class _ProcessingGeometry(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'geometryCoordinateType':
self.geometryCoordinateType = z.text
if z.tag == 'velocityParameter':
@ -2282,7 +2281,7 @@ class _VelocityParameter(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = z.text
if z.tag == 'velocityParameterPolynomial':
@ -2309,7 +2308,7 @@ class _VelocityParameterPolynomial(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -2352,7 +2351,7 @@ class _ZeroDopplerVelocity(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'velocity':
self.velocity = float(z.text)
return
@ -2372,7 +2371,7 @@ class _DopplerRate(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = z.text
if z.tag == 'dopplerRatePolynomial':
@ -2399,7 +2398,7 @@ class _DopplerRatePolynomial(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -2444,7 +2443,7 @@ class _ProcessingDoppler(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'dopplerBasebandEstimationMethod':
self.dopplerBasebandEstimationMethod = z.text
if z.tag == 'dopplerGeometricEstimationMethod':
@ -2485,7 +2484,7 @@ class _ProcessingDopplerCentroid(object):
def set_from_etnode(self,node):
self.layerIndex = int(node.attrib['layerIndex'])
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.polLayer = z.text
if z.tag == 'DRAoffset':
@ -2548,7 +2547,7 @@ class _DopplerEstimate(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'timeUTC':
self.timeUTC = z.text
if z.tag == 'dopplerAtMidRange':
@ -2603,7 +2602,7 @@ class _BasebandDoppler(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -2648,7 +2647,7 @@ class _GeometricDoppler(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -2694,7 +2693,7 @@ class _CombinedDoppler(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -2746,7 +2745,7 @@ class _ProcessingParameter(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'beamID':
self.beamID = z.text
if z.tag == 'processingInfoCoordinateType':
@ -2811,7 +2810,7 @@ class _RangeCompression(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'segmentInfo':
self.segmentInfo.set_from_etnode(z)
if z.tag == 'chirps':
@ -2836,7 +2835,7 @@ class _RCSegmentInfo(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.polLayer = z.text
if z.tag == 'dataSegment':
@ -2861,7 +2860,7 @@ class _RCDataSegment(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'startTimeUTC':
self.startTimeUTC = z.text
if z.tag == 'stopTimeUTC':
@ -2888,7 +2887,7 @@ class _RCChirps(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'referenceChirp':
self.referenceChirp.set_from_etnode(z)
return
@ -2916,7 +2915,7 @@ class _RCReferenceChirp(object):
def set_from_etnode(self,node):
self.pulseCode = int(node.attrib['pulseCode'])
for z in node.getchildren():
for z in node:
if z.tag == 'pulseType':
self.pulseType = z.text
if z.tag == 'chirpDesignator':
@ -2969,7 +2968,7 @@ class _RCChirpAmplitude(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -3014,7 +3013,7 @@ class _RCChirpPhase(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'validityRangeMin':
self.validityRangeMin = float(z.text)
if z.tag == 'validityRangeMax':
@ -3057,7 +3056,7 @@ class _CorrectedInstrumentDelay(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'polLayer':
self.polLayer = z.text
if z.tag == 'DRAoffset':
@ -3110,7 +3109,7 @@ class _File(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'location':
self.location.set_from_etnode(z)
if z.tag == 'size':
@ -3135,7 +3134,7 @@ class _FileLocation(object):
return
def set_from_etnode(self,node):
for z in node.getchildren():
for z in node:
if z.tag == 'host':
self.host = z.text
if z.tag == 'path':

View File

@ -154,7 +154,7 @@ class XmlUtil:
else:
keyWord = var.find('name').text
listChildren = var.getchildren()
listChildren = list(var)
tmpDict = {}
for description in listChildren:
if(description.tag == 'name'):

View File

@ -90,7 +90,7 @@ class OrderedDict(UserDict):
def dict_to_xml(adict,file):
a = ET.Element('') # something to hang nodes on
a = dict_to_et(a,adict)
et = a.getchildren()[0]
et = list(a)[0]
indent(et)
tree = ET.ElementTree(et)
tree.write(file)

View File

@ -3,7 +3,7 @@
import os
Import('envGPUgeo2rdr')
package = envGPUgeo2rdr['PACKAGE']
package = envGPUgeo2rdr['PACKAGE']
project = envGPUgeo2rdr['PROJECT']
install = envGPUgeo2rdr['PRJ_SCONS_INSTALL'] + '/' + package + '/' + project
build = envGPUgeo2rdr['PRJ_SCONS_BUILD'] + '/' + package + '/' + project + '/src'
@ -11,7 +11,7 @@ build = envGPUgeo2rdr['PRJ_SCONS_BUILD'] + '/' + package + '/' + project + '/src
if envGPUgeo2rdr['GPU_ACC_ENABLED']:
envGPUgeo2rdr.AppendUnique(CPPPATH=envGPUgeo2rdr['CUDACPPPATH'])
envGPUgeo2rdr.AppendUnique(LIBPATH=envGPUgeo2rdr['CUDALIBPATH'])
envGPUgeo2rdr.AppendUnique(LIBS=['cuda','cudart'])
envGPUgeo2rdr.AppendUnique(LIBS=['cudart'])
###Custom cython builder
@ -24,7 +24,7 @@ def cythonPseudoBuilder(env,source,bld,inst):
cppCode = env.Pyx2Cpp(source)
listFiles = [source+'.cpp', 'Ellipsoid.cpp', 'Geo2rdr.cpp', 'GeoController.cpp', 'LinAlg.cpp', 'Orbit.cpp', 'Poly1d.cpp']
env.MergeFlags('-fopenmp -O3 -std=c++11 -fPIC -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -Wall -Wstrict-prototypes')
if (env['GPU_ACC_ENABLED']):
listFiles.append('GPUgeo.cu')
lib = env.LoadableModule(target = 'GPUgeo2rdr.abi3.so', source = listFiles, CPPDEFINES = 'GPU_ACC_ENABLED')

View File

@ -11,7 +11,7 @@ build = envGPUresampslc['PRJ_SCONS_BUILD'] + '/' + package + '/' + project + '/s
if envGPUresampslc['GPU_ACC_ENABLED']:
envGPUresampslc.AppendUnique(CPPPATH=envGPUresampslc['CUDACPPPATH'])
envGPUresampslc.AppendUnique(LIBPATH=envGPUresampslc['CUDALIBPATH'])
envGPUresampslc.AppendUnique(LIBS=['cuda','cudart'])
envGPUresampslc.AppendUnique(LIBS=['cudart'])
###Custom cython builder

View File

@ -3,7 +3,7 @@
import os
Import('envGPUtopozero')
package = envGPUtopozero['PACKAGE']
package = envGPUtopozero['PACKAGE']
project = envGPUtopozero['PROJECT']
install = envGPUtopozero['PRJ_SCONS_INSTALL'] + '/' + package + '/' + project
build = envGPUtopozero['PRJ_SCONS_BUILD'] + '/' + package + '/' + project + '/src'
@ -11,7 +11,7 @@ build = envGPUtopozero['PRJ_SCONS_BUILD'] + '/' + package + '/' + project + '/sr
if envGPUtopozero['GPU_ACC_ENABLED']:
envGPUtopozero.AppendUnique(CPPPATH=envGPUtopozero['CUDACPPPATH'])
envGPUtopozero.AppendUnique(LIBPATH=envGPUtopozero['CUDALIBPATH'])
envGPUtopozero.AppendUnique(LIBS=['cuda','cudart'])
envGPUtopozero.AppendUnique(LIBS=['cudart'])
###Custom cython builder
cythonBuilder = Builder(action = 'cython3 $SOURCE --cplus',

View File

@ -14,7 +14,7 @@ Export('envPyCuAmpcor')
if envPyCuAmpcor['GPU_ACC_ENABLED']:
envPyCuAmpcor.Append(CPPPATH=envPyCuAmpcor['CUDACPPPATH'])
envPyCuAmpcor.Append(LIBPATH=envPyCuAmpcor['CUDALIBPATH'])
envPyCuAmpcor.Append(LIBS=['cuda','cudart','cufft','cublas'])
envPyCuAmpcor.Append(LIBS=['cudart','cufft','cublas'])
build = envPyCuAmpcor['PRJ_SCONS_BUILD'] + '/' + package + '/' + project
# includeScons = os.path.join('include','SConscript')

View File

@ -40,6 +40,8 @@ def createParser():
help='Reference image')
parser.add_argument('-s', '--secondary',type=str, dest='secondary', required=True,
help='Secondary image')
parser.add_argument('--fix-xml','--fix-image-xml', dest='fixImageXml', action='store_true',
help='Fix the image file path in the XML file. Enable this if input files havee been moved.')
parser.add_argument('--op','--outprefix','--output-prefix', type=str, dest='outprefix',
default='offset', required=True,
@ -156,12 +158,13 @@ def estimateOffsetField(reference, secondary, inps=None):
return 0
# update file path in xml file
for fname in [reference, secondary]:
fname = os.path.abspath(fname)
img = IML.loadImage(fname)[0]
img.filename = fname
img.setAccessMode('READ')
img.renderHdr()
if inps.fixImageXml:
for fname in [reference, secondary]:
fname = os.path.abspath(fname)
img = IML.loadImage(fname)[0]
img.filename = fname
img.setAccessMode('READ')
img.renderHdr()
###Loading the secondary image object
sim = isceobj.createSlcImage()
@ -372,14 +375,24 @@ def prepareGeometry(full_dir, out_dir, x_start, y_start, x_step, y_step, num_win
x/y_step - int, output pixel step in column/row direction
num_win_x/y - int, number of columns/rows
"""
full_dir = os.path.abspath(full_dir)
out_dir = os.path.abspath(out_dir)
# grab the file extension for full resolution file
full_exts = ['.rdr.full','.rdr'] if full_dir != out_dir else ['.rdr.full']
full_exts = [e for e in full_exts if os.path.isfile(os.path.join(full_dir, '{f}{e}'.format(f=fbases[0], e=e)))]
if len(full_exts) == 0:
raise ValueError('No full resolution {}.rdr* file found in: {}'.format(fbases[0], full_dir))
full_ext = full_exts[0]
print('-'*50)
print('generate the corresponding multi-looked geometry datasets using gdal ...')
in_files = [os.path.join(full_dir, '{}.rdr.full'.format(i)) for i in fbases]
# input files
in_files = [os.path.join(full_dir, '{f}{e}'.format(f=f, e=full_ext)) for f in fbases]
in_files = [i for i in in_files if os.path.isfile(i)]
if len(in_files) == 0:
raise ValueError('No full resolution geometry file found in: {}'.format(full_dir))
fbases = [os.path.basename(i).split('.')[0] for i in in_files]
# output files
out_files = [os.path.join(out_dir, '{}.rdr'.format(i)) for i in fbases]
os.makedirs(out_dir, exist_ok=True)

View File

@ -553,17 +553,18 @@ cuAmpcorChunk::cuAmpcorChunk(cuAmpcorParameter *param_, GDALImage *reference_, G
stream);
}
corrNormalizerRaw = new cuNormalizer(
corrNormalizerRaw = std::unique_ptr<cuNormalizeProcessor>(newCuNormalizer(
param->searchWindowSizeHeightRaw,
param->searchWindowSizeWidthRaw,
param->numberWindowDownInChunk * param->numberWindowAcrossInChunk
);
));
corrNormalizerOverSampled = new cuNormalizer(
corrNormalizerOverSampled =
std::unique_ptr<cuNormalizeProcessor>(newCuNormalizer(
param->searchWindowSizeHeight,
param->searchWindowSizeWidth,
param->numberWindowDownInChunk * param->numberWindowAcrossInChunk
);
));
#ifdef CUAMPCOR_DEBUG

View File

@ -66,8 +66,8 @@ private:
cuFreqCorrelator *cuCorrFreqDomain, *cuCorrFreqDomain_OverSampled;
// correlation surface normalizer
cuNormalizer *corrNormalizerRaw;
cuNormalizer *corrNormalizerOverSampled;
std::unique_ptr<cuNormalizeProcessor> corrNormalizerRaw;
std::unique_ptr<cuNormalizeProcessor> corrNormalizerOverSampled;
// save offset results in different stages
cuArrays<int2> *offsetInit;

View File

@ -67,6 +67,13 @@ void cuCorrNormalize256(cuArrays<float> *correlation, cuArrays<float> *reference
void cuCorrNormalize512(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream);
void cuCorrNormalize1024(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream);
// in cuCorrNormalizationSAT.cu: to normalize the cross correlation function with sum area table
void cuCorrNormalizeSAT(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary,
cuArrays<float> * referenceSum2, cuArrays<float> *secondarySAT, cuArrays<float> *secondarySAT2, cudaStream_t stream);
template<int Size>
void cuCorrNormalizeFixed(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream);
// in cuCorrNormalizationSAT.cu: to normalize the cross correlation function with sum area table
void cuCorrNormalizeSAT(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary,
cuArrays<float> * referenceSum2, cuArrays<float> *secondarySAT, cuArrays<float> *secondarySAT2, cudaStream_t stream);

View File

@ -377,64 +377,20 @@ void cuCorrNormalize(cuArrays<float> *templates, cuArrays<float> *images, cuArra
}
void cuCorrNormalize64(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
template<int N> struct Log2;
template<> struct Log2<64> { static const int value = 6; };
template<> struct Log2<128> { static const int value = 7; };
template<> struct Log2<256> { static const int value = 8; };
template<> struct Log2<512> { static const int value = 9; };
template<> struct Log2<1024> { static const int value = 10; };
template<int Size>
void cuCorrNormalizeFixed(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
{
const int nImages = correlation->count;
const dim3 grid(1, 1, nImages);
const float invReferenceSize = 1.0f/reference->size;
cuCorrNormalize_kernel< 6><<<grid, 64, 0, stream>>>(nImages,
reference->devData, reference->height, reference->width, reference->size,
secondary->devData, secondary->height, secondary->width, secondary->size,
correlation->devData, correlation->height, correlation->width, correlation->size,
invReferenceSize);
getLastCudaError("cuCorrNormalize kernel error");
}
void cuCorrNormalize128(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
{
const int nImages = correlation->count;
const dim3 grid(1, 1, nImages);
const float invReferenceSize = 1.0f/reference->size;
cuCorrNormalize_kernel< 7><<<grid, 128, 0, stream>>>(nImages,
reference->devData, reference->height, reference->width, reference->size,
secondary->devData, secondary->height, secondary->width, secondary->size,
correlation->devData, correlation->height, correlation->width, correlation->size,
invReferenceSize);
getLastCudaError("cuCorrNormalize kernel error");
}
void cuCorrNormalize256(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
{
const int nImages = correlation->count;
const dim3 grid(1, 1, nImages);
const float invReferenceSize = 1.0f/reference->size;
cuCorrNormalize_kernel< 8><<<grid, 256, 0, stream>>>(nImages,
reference->devData, reference->height, reference->width, reference->size,
secondary->devData, secondary->height, secondary->width, secondary->size,
correlation->devData, correlation->height, correlation->width, correlation->size,
invReferenceSize);
getLastCudaError("cuCorrNormalize kernel error");
}
void cuCorrNormalize512(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
{
const int nImages = correlation->count;
const dim3 grid(1, 1, nImages);
const float invReferenceSize = 1.0f/reference->size;
cuCorrNormalize_kernel< 9><<<grid, 512, 0, stream>>>(nImages,
reference->devData, reference->height, reference->width, reference->size,
secondary->devData, secondary->height, secondary->width, secondary->size,
correlation->devData, correlation->height, correlation->width, correlation->size,
invReferenceSize);
getLastCudaError("cuCorrNormalize kernel error");
}
void cuCorrNormalize1024(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
{
const int nImages = correlation->count;
const dim3 grid(1, 1, nImages);
const float invReferenceSize = 1.0f/reference->size;
cuCorrNormalize_kernel< 10><<<grid, 1024, 0, stream>>>(nImages,
cuCorrNormalize_kernel<Log2<Size>::value><<<grid, Size, 0, stream>>>(nImages,
reference->devData, reference->height, reference->width, reference->size,
secondary->devData, secondary->height, secondary->width, secondary->size,
correlation->devData, correlation->height, correlation->width, correlation->size,
@ -442,5 +398,20 @@ void cuCorrNormalize1024(cuArrays<float> *correlation, cuArrays<float> *referenc
getLastCudaError("cuCorrNormalize kernel error");
}
template void cuCorrNormalizeFixed<64>(cuArrays<float> *correlation,
cuArrays<float> *reference, cuArrays<float> *secondary,
cudaStream_t stream);
template void cuCorrNormalizeFixed<128>(cuArrays<float> *correlation,
cuArrays<float> *reference, cuArrays<float> *secondary,
cudaStream_t stream);
template void cuCorrNormalizeFixed<256>(cuArrays<float> *correlation,
cuArrays<float> *reference, cuArrays<float> *secondary,
cudaStream_t stream);
template void cuCorrNormalizeFixed<512>(cuArrays<float> *correlation,
cuArrays<float> *reference, cuArrays<float> *secondary,
cudaStream_t stream);
template void cuCorrNormalizeFixed<1024>(cuArrays<float> *correlation,
cuArrays<float> *reference, cuArrays<float> *secondary,
cudaStream_t stream);
// end of file

View File

@ -7,45 +7,30 @@
#include "cuCorrNormalizer.h"
#include "cuAmpcorUtil.h"
cuNormalizer::cuNormalizer(int secondaryNX, int secondaryNY, int count)
cuNormalizeProcessor*
newCuNormalizer(int secondaryNX, int secondaryNY, int count)
{
// depending on NY, choose different processor
if(secondaryNY <= 64) {
processor = new cuNormalize64();
return new cuNormalizeFixed<64>();
}
else if (secondaryNY <= 128) {
processor = new cuNormalize128();
return new cuNormalizeFixed<128>();
}
else if (secondaryNY <= 256) {
processor = new cuNormalize256();
return new cuNormalizeFixed<256>();
}
else if (secondaryNY <= 512) {
processor = new cuNormalize512();
return new cuNormalizeFixed<512>();
}
else if (secondaryNY <= 1024) {
processor = new cuNormalize1024();
return new cuNormalizeFixed<1024>();
}
else {
processor = new cuNormalizeSAT(secondaryNX, secondaryNY, count);
return new cuNormalizeSAT(secondaryNX, secondaryNY, count);
}
}
cuNormalizer::~cuNormalizer()
{
delete processor;
}
void cuNormalizer::execute(cuArrays<float> *correlation,
cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
{
processor->execute(correlation, reference, secondary, stream);
}
/**
*
*
**/
cuNormalizeSAT::cuNormalizeSAT(int secondaryNX, int secondaryNY, int count)
{
// allocate the work array
@ -74,34 +59,17 @@ void cuNormalizeSAT::execute(cuArrays<float> *correlation,
referenceSum2, secondarySAT, secondarySAT2, stream);
}
void cuNormalize64::execute(cuArrays<float> *correlation,
template<int Size>
void cuNormalizeFixed<Size>::execute(cuArrays<float> *correlation,
cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
{
cuCorrNormalize64(correlation, reference, secondary, stream);
cuCorrNormalizeFixed<Size>(correlation, reference, secondary, stream);
}
void cuNormalize128::execute(cuArrays<float> *correlation,
cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
{
cuCorrNormalize128(correlation, reference, secondary, stream);
}
template class cuNormalizeFixed<64>;
template class cuNormalizeFixed<128>;
template class cuNormalizeFixed<256>;
template class cuNormalizeFixed<512>;
template class cuNormalizeFixed<1024>;
void cuNormalize256::execute(cuArrays<float> *correlation,
cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
{
cuCorrNormalize256(correlation, reference, secondary, stream);
}
void cuNormalize512::execute(cuArrays<float> *correlation,
cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
{
cuCorrNormalize512(correlation, reference, secondary, stream);
}
void cuNormalize1024::execute(cuArrays<float> *correlation,
cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream)
{
cuCorrNormalize1024(correlation, reference, secondary, stream);
}
// end of file
// end of file

View File

@ -4,7 +4,7 @@
*
* cuNormalizeProcessor is an abstract class for processors to normalize the correlation surface.
* It has different implementations wrt different image sizes.
* cuNormalize64, 128, ... 1024 use a shared memory accelerated algorithm, which are limited by the number of cuda threads in a block.
* cuNormalizeFixed<64/128/.../1024> use a shared memory accelerated algorithm, which are limited by the number of cuda threads in a block.
* cuNormalizeSAT uses the sum area table based algorithm, which applies to any size (used for >1024).
* cuNormalizer is a wrapper class which determines which processor to use.
*/
@ -22,53 +22,18 @@
class cuNormalizeProcessor {
public:
// default constructor and destructor
cuNormalizeProcessor() {}
~cuNormalizeProcessor() {}
cuNormalizeProcessor() = default;
virtual ~cuNormalizeProcessor() = default;
// execute interface
virtual void execute(cuArrays<float> * correlation, cuArrays<float> *reference, cuArrays<float> *secondary, cudaStream_t stream) = 0;
};
class cuNormalizer {
private:
cuNormalizeProcessor *processor;
public:
// disable the default constructor
cuNormalizer() = delete;
// constructor with the secondary dimension
cuNormalizer(int secondaryNX, int secondaryNY, int count);
// destructor
~cuNormalizer();
// execute correlation surface normalization
void execute(cuArrays<float> *correlation, cuArrays<float> *reference, cuArrays<float> *secondary,
cudaStream_t stream);
};
// factory with the secondary dimension
cuNormalizeProcessor* newCuNormalizer(int NX, int NY, int count);
class cuNormalize64 : public cuNormalizeProcessor
{
public:
void execute(cuArrays<float> * correlation, cuArrays<float> *reference, cuArrays<float> *search, cudaStream_t stream) override;
};
class cuNormalize128 : public cuNormalizeProcessor
{
public:
void execute(cuArrays<float> * correlation, cuArrays<float> *reference, cuArrays<float> *search, cudaStream_t stream) override;
};
class cuNormalize256 : public cuNormalizeProcessor
{
public:
void execute(cuArrays<float> * correlation, cuArrays<float> *reference, cuArrays<float> *search, cudaStream_t stream) override;
};
class cuNormalize512 : public cuNormalizeProcessor
{
public:
void execute(cuArrays<float> * correlation, cuArrays<float> *reference, cuArrays<float> *search, cudaStream_t stream) override;
};
class cuNormalize1024 : public cuNormalizeProcessor
template<int Size>
class cuNormalizeFixed : public cuNormalizeProcessor
{
public:
void execute(cuArrays<float> * correlation, cuArrays<float> *reference, cuArrays<float> *search, cudaStream_t stream) override;
@ -88,4 +53,4 @@ public:
};
#endif
// end of file
// end of file

View File

@ -162,7 +162,7 @@ def formPairs(idir, numberOfSubsequentDates, pairTimeSpanMinimum=None, pairTimeS
for pair in pairsProcess:
rdate = pair.split('-')[0]
sdate = pair.split('-')[1]
if (rdate not in datesIncluded) and (sdate not in datesIncluded):
if (rdate not in datesExcluded) and (sdate not in datesExcluded):
pairsProcess2.append(pair)
pairsProcess = pairsProcess2

View File

@ -44,7 +44,7 @@ def get_Date(RSAT2folder):
tree = etree.parse(RSAT2file)
root = tree.getroot()
for attributes in root.iter('{http://www.rsi.ca/rs2/prod/xml/schemas}sourceAttributes'):
attribute_list = attributes.getchildren()
attribute_list = list(attributes)
for attribute in attribute_list:
if attribute.tag=='{http://www.rsi.ca/rs2/prod/xml/schemas}rawDataStartTime':
date = attribute.text

View File

@ -26,6 +26,7 @@ noMCF = 'False'
defoMax = '2'
maxNodes = 72
def createParser():
parser = argparse.ArgumentParser( description='Preparing the directory structure and config files for stack processing of StripMap data')
@ -42,7 +43,7 @@ def createParser():
parser.add_argument('-m', '--reference_date', dest='referenceDate', type=str, default=None,
help='Directory with reference acquisition')
parser.add_argument('-t', '--time_threshold', dest='dtThr', type=float, default=10000.0,
help='Time threshold (max temporal baseline in days)')
@ -57,7 +58,7 @@ def createParser():
parser.add_argument('-S', '--sensor', dest='sensor', type=str, required=False,
help='SAR sensor used to define square multi-look pixels')
parser.add_argument('-u', '--unw_method', dest='unwMethod', type=str, default='snaphu',
parser.add_argument('-u', '--unw_method', dest='unwMethod', type=str, default='snaphu',
help='unwrapping method (icu, snaphu, or snaphu2stage), no to skip phase unwrapping.')
parser.add_argument('-f','--filter_strength', dest='filtStrength', type=str, default=filtStrength,
@ -72,7 +73,7 @@ def createParser():
iono.add_argument('-B', '--subband_bandwidth ', dest='bandWidth', type=str, default=None,
help='sub-band band width')
iono.add_argument('--filter_sigma_x', dest='filterSigmaX', type=str, default='100',
iono.add_argument('--filter_sigma_x', dest='filterSigmaX', type=str, default='100',
help='filter sigma for gaussian filtering the dispersive and nonDispersive phase')
iono.add_argument('--filter_sigma_y', dest='filterSigmaY', type=str, default='100.0',
@ -87,14 +88,14 @@ def createParser():
iono.add_argument('--filter_kernel_rotation', dest='filterKernelRotation', type=str, default='0.0',
help='rotation angle of the filter kernel in degrees (default = 0.0)')
parser.add_argument('-W', '--workflow', dest='workflow', type=str, default='slc',
parser.add_argument('-W', '--workflow', dest='workflow', type=str, default='slc',
help='The InSAR processing workflow : (slc, interferogram, ionosphere)')
parser.add_argument('-z', '--zero', dest='zerodop', action='store_true', default=False,
parser.add_argument('-z', '--zero', dest='zerodop', action='store_true', default=False,
help='Use zero doppler geometry for processing - Default : No')
parser.add_argument('--nofocus', dest='nofocus', action='store_true', default=False,
parser.add_argument('--nofocus', dest='nofocus', action='store_true', default=False,
help='If input data is already focused to SLCs - Default : do focus')
parser.add_argument('-c', '--text_cmd', dest='text_cmd', type=str, default='',
parser.add_argument('-c', '--text_cmd', dest='text_cmd', type=str, default='',
help='text command to be added to the beginning of each line of the run files. Example : source ~/.bash_profile;')
parser.add_argument('-useGPU', '--useGPU', dest='useGPU',action='store_true', default=False,
help='Allow App to use GPU when available')
@ -102,18 +103,19 @@ def createParser():
parser.add_argument('--summary', dest='summary', action='store_true', default=False, help='Show summary only')
return parser
def cmdLineParse(iargs = None):
parser = createParser()
inps = parser.parse_args(args=iargs)
inps.slcDir = os.path.abspath(inps.slcDir)
inps.workDir = os.path.abspath(inps.workDir)
inps.dem = os.path.abspath(inps.dem)
return inps
def get_dates(inps):
dirs = glob.glob(inps.slcDir+'/*')
acuisitionDates = []
for dirf in dirs:
@ -134,13 +136,13 @@ def get_dates(inps):
inps.referenceDate = acuisitionDates[0]
secondaryDates = acuisitionDates.copy()
secondaryDates.remove(inps.referenceDate)
return acuisitionDates, inps.referenceDate, secondaryDates
return acuisitionDates, inps.referenceDate, secondaryDates
def slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False):
# A coregistered stack of SLCs
i=0
if inps.bbox:
i+=1
runObj = run()
@ -149,7 +151,6 @@ def slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs,
runObj.crop(acquisitionDates, config_prefix, native=not inps.zerodop, israw=not inps.nofocus)
runObj.finalize()
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_reference'.format(i))
@ -190,40 +191,40 @@ def slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs,
config_prefix = 'config_fineResamp_'
runObj.secondarys_fine_resampleSlc(stackReferenceDate, secondaryDates, config_prefix, split=splitFlag)
runObj.finalize()
if rubberSheet:
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_denseOffset'.format(i))
config_prefix = 'config_denseOffset_'
runObj.denseOffsets_Network(pairs, stackReferenceDate, secondaryDates, config_prefix)
runObj.finalize()
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_denseOffset'.format(i))
config_prefix = 'config_denseOffset_'
runObj.denseOffsets_Network(pairs, stackReferenceDate, secondaryDates, config_prefix)
runObj.finalize()
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_invertDenseOffsets'.format(i))
runObj.invertDenseOffsets()
runObj.finalize()
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_resampleOffset'.format(i))
config_prefix = 'config_resampOffsets_'
runObj.resampleOffset(secondaryDates, config_prefix)
runObj.finalize()
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_invertDenseOffsets'.format(i))
runObj.invertDenseOffsets()
runObj.finalize()
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_replaceOffsets'.format(i))
runObj.replaceOffsets(secondaryDates)
runObj.finalize()
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_resampleOffset'.format(i))
config_prefix = 'config_resampOffsets_'
runObj.resampleOffset(secondaryDates, config_prefix)
runObj.finalize()
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_fineResamp'.format(i))
config_prefix = 'config_fineResamp_'
runObj.secondarys_fine_resampleSlc(stackReferenceDate, secondaryDates, config_prefix, split=splitFlag)
runObj.finalize()
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_replaceOffsets'.format(i))
runObj.replaceOffsets(secondaryDates)
runObj.finalize()
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_fineResamp'.format(i))
config_prefix = 'config_fineResamp_'
runObj.secondarys_fine_resampleSlc(stackReferenceDate, secondaryDates, config_prefix, split=splitFlag)
runObj.finalize()
# adding the baseline grid generation
i+=1
@ -235,20 +236,22 @@ def slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs,
return i
def interferogramStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs):
# an interferogram stack without ionosphere correction.
# an interferogram stack without ionosphere correction.
# coregistration is with geometry + const offset
i = slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False)
i+=1
runObj = run()
runObj.configure(inps, 'run_{:02d}_igram'.format(i))
config_prefix = 'config_igram_'
low_or_high = "/"
runObj.igrams_network(pairs, acquisitionDates, stackReferenceDate, low_or_high, config_prefix)
runObj.igrams_network(pairs, acquisitionDates, stackReferenceDate, low_or_high, config_prefix)
runObj.finalize()
return
def interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs):
@ -273,7 +276,7 @@ def interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondary
config_prefix = 'config_igram_'
low_or_high = "/"
runObj.igrams_network(pairs, acquisitionDates, stackReferenceDate, low_or_high, config_prefix)
runObj.finalize()
runObj.finalize()
i+=1
runObj = run()
@ -297,69 +300,68 @@ def interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondary
config_prefix = 'config_iono_'
lowBand = '/LowBand/'
highBand = '/HighBand/'
runObj.dispersive_nonDispersive(pairs, acquisitionDates, stackReferenceDate,
lowBand, highBand, config_prefix)
runObj.dispersive_nonDispersive(pairs, acquisitionDates, stackReferenceDate, lowBand, highBand, config_prefix)
runObj.finalize()
return
def main(iargs=None):
inps = cmdLineParse(iargs)
# name of the folder of the coreg SLCs including baselines, SLC, geom_reference subfolders
inps.stack_folder = 'merged'
inps.dense_offsets_folder = 'dense_offsets'
inps = cmdLineParse(iargs)
# name of the folder of the coreg SLCs including baselines, SLC, geom_reference subfolders
inps.stack_folder = 'merged'
inps.dense_offsets_folder = 'dense_offsets'
# check if a sensor is defined and update if needed azimuth looks to give square pixels
ar=1
if inps.sensor:
if inps.sensor.lower() == "alos":
ar=4
print("Looks like " + inps.sensor.lower() + ", multi-look AR=" + str(ar))
elif inps.sensor.lower() == "envisat" or inps.sensor.lower() == "ers":
ar=5
print("Looks like " + inps.sensor.lower() + ", multi-look AR=" + str(ar))
else:
print("Sensor is not hard-coded (ers, envisat, alos), will keep default alks")
# sensor is not recognised, report to user and state default
inps.alks = str(int(inps.alks)*int(ar))
# getting the acquisitions
acquisitionDates, stackReferenceDate, secondaryDates = get_dates(inps)
configDir = os.path.join(inps.workDir,'configs')
os.makedirs(configDir, exist_ok=True)
runDir = os.path.join(inps.workDir,'run_files')
os.makedirs(runDir, exist_ok=True)
# check if a sensor is defined and update if needed azimuth looks to give square pixels
ar=1
if inps.sensor:
if inps.sensor.lower() == "alos":
ar=4
print("Looks like " + inps.sensor.lower() + ", multi-look AR=" + str(ar))
elif inps.sensor.lower() == "envisat" or inps.sensor.lower() == "ers":
ar=5
print("Looks like " + inps.sensor.lower() + ", multi-look AR=" + str(ar))
else:
print("Sensor is not hard-coded (ers, envisat, alos), will keep default alks")
# sensor is not recognised, report to user and state default
inps.alks = str(int(inps.alks)*int(ar))
if inps.sensor.lower() == 'uavsar_stack': # don't try to calculate baselines for UAVSAR_STACK data
pairs = selectPairs(inps,stackReferenceDate, secondaryDates, acquisitionDates,doBaselines=False)
else:
pairs = selectPairs(inps,stackReferenceDate, secondaryDates, acquisitionDates,doBaselines=True)
print ('number of pairs: ', len(pairs))
# getting the acquisitions
acquisitionDates, stackReferenceDate, secondaryDates = get_dates(inps)
configDir = os.path.join(inps.workDir,'configs')
os.makedirs(configDir, exist_ok=True)
runDir = os.path.join(inps.workDir,'run_files')
os.makedirs(runDir, exist_ok=True)
###If only a summary is requested quit after this
if inps.summary:
return
if inps.sensor and inps.sensor.lower() == 'uavsar_stack': # don't try to calculate baselines for UAVSAR_STACK data
pairs = selectPairs(inps,stackReferenceDate, secondaryDates, acquisitionDates,doBaselines=False)
else:
pairs = selectPairs(inps,stackReferenceDate, secondaryDates, acquisitionDates,doBaselines=True)
print ('number of pairs: ', len(pairs))
#if cropping is requested, then change the slc directory:
inps.fullFrameSlcDir = inps.slcDir
###If only a summary is requested quit after this
if inps.summary:
return
if inps.bbox:
inps.slcDir = inps.slcDir + "_crop"
#############################
#if cropping is requested, then change the slc directory:
inps.fullFrameSlcDir = inps.slcDir
if inps.workflow == 'slc':
slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False)
if inps.bbox:
inps.slcDir = inps.slcDir + "_crop"
#############################
elif inps.workflow == 'interferogram':
interferogramStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs)
if inps.workflow == 'slc':
slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False)
elif inps.workflow == 'interferogram':
interferogramStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs)
elif inps.workflow == 'ionosphere':
interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs)
return
elif inps.workflow == 'ionosphere':
interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs)
if __name__ == "__main__":
# Main engine
main()
# Main engine
main(sys.argv[1:])

View File

@ -110,7 +110,7 @@ class ConfigParser:
# Looks for string between $ sysmbols in the common subheading in config file
def __parseString(self, iString):
if iString is '':
if iString == '':
return iString
elif isinstance(self.common, (dict)):
# Case when "common" parameters are read from the configuration file

View File

@ -1,22 +1,25 @@
#!/usr/bin/env python3
import numpy as np
import re
import requests
import re
import os
import argparse
import datetime
from html.parser import HTMLParser
server = 'http://aux.sentinel1.eo.esa.int/'
server = 'https://scihub.copernicus.eu/gnss/'
orbitMap = [('precise', 'POEORB/'),
('restituted', 'RESORB/')]
orbitMap = [('precise', 'AUX_POEORB'),
('restituted', 'AUX_RESORB')]
datefmt = "%Y%m%dT%H%M%S"
queryfmt = "%Y-%m-%d"
queryfmt2 = "%Y/%m/%d/"
#Generic credentials to query and download orbit files
credentials = ('gnssguest', 'gnssguest')
def cmdLineParse():
'''
@ -55,38 +58,26 @@ def FileToTimeStamp(safename):
class MyHTMLParser(HTMLParser):
def __init__(self, satName, url):
def __init__(self,url):
HTMLParser.__init__(self)
self.fileList = []
self.in_td = False
self.in_a = False
self.in_table = False
self._url = url
self.satName = satName
def handle_starttag(self, tag, attrs):
if tag == 'td':
self.in_td = True
elif tag == 'a':
self.in_a = True
for name, val in attrs:
if name == "href":
if val.startswith("http"):
self._url = val.strip()
for name, val in attrs:
if name == 'href':
if val.startswith("https://scihub.copernicus.eu/gnss/odata") and val.endswith(")/"):
pass
else:
downloadLink = val.strip()
downloadLink = downloadLink.split("/Products('Quicklook')")
downloadLink = downloadLink[0] + downloadLink[-1]
self._url = downloadLink
def handle_data(self, data):
if self.in_td and self.in_a:
if self.satName in data:
self.fileList.append((self._url, data.strip()))
def handle_tag(self, tag):
if tag == 'td':
self.in_td = False
self.in_a = False
elif tag == 'a':
self.in_a = False
self._url = None
if data.startswith("S1") and data.endswith(".EOF"):
self.fileList.append((self._url, data.strip()))
def download_file(url, outdir='.', session=None):
'''
@ -96,9 +87,9 @@ def download_file(url, outdir='.', session=None):
if session is None:
session = requests.session()
path = os.path.join(outdir, os.path.basename(url))
path = outdir
print('Downloading URL: ', url)
request = session.get(url, stream=True, verify=False)
request = session.get(url, stream=True, verify=True, auth=credentials)
try:
val = request.raise_for_status()
@ -139,37 +130,29 @@ if __name__ == '__main__':
fileTS, satName, fileTSStart = FileToTimeStamp(inps.input)
print('Reference time: ', fileTS)
print('Satellite name: ', satName)
match = None
session = requests.Session()
for spec in orbitMap:
oType = spec[0]
if oType == 'precise':
end_date = fileTS + datetime.timedelta(days=20)
elif oType == 'restituted':
end_date = fileTS
else:
raise ValueError("Unexpected orbit type: '" + oType + "'")
end_date2 = end_date + datetime.timedelta(days=1)
urls = (server + spec[1] + end_date.strftime("%Y/%m/%d/") for end_date in (end_date, end_date2))
delta = datetime.timedelta(days=1)
timebef = (fileTS - delta).strftime(queryfmt)
timeaft = (fileTS + delta).strftime(queryfmt)
url = server + 'search?q=( beginPosition:[{0}T00:00:00.000Z TO {1}T23:59:59.999Z] AND endPosition:[{0}T00:00:00.000Z TO {1}T23:59:59.999Z] ) AND ( (platformname:Sentinel-1 AND filename:{2}_* AND producttype:{3}))&start=0&rows=100'.format(timebef,timeaft, satName,spec[1])
success = False
match = None
try:
for url in urls:
r = session.get(url, verify=False)
r.raise_for_status()
parser = MyHTMLParser(satName, url)
parser.feed(r.text)
for resulturl, result in parser.fileList:
tbef, taft, mission = fileToRange(os.path.basename(result))
if (tbef <= fileTSStart) and (taft >= fileTS):
match = os.path.join(resulturl, result)
r = session.get(url, verify=True, auth=credentials)
r.raise_for_status()
parser = MyHTMLParser(url)
parser.feed(r.text)
for resulturl, result in parser.fileList:
tbef, taft, mission = fileToRange(os.path.basename(result))
if (tbef <= fileTSStart) and (taft >= fileTS):
matchFileName = result
match = resulturl
if match is not None:
success = True
@ -180,8 +163,8 @@ if __name__ == '__main__':
break
if match is not None:
res = download_file(match, inps.outdir, session)
output = os.path.join(inps.outdir, matchFileName)
res = download_file(match, output, session)
if res is False:
print('Failed to download URL: ', match)
else:

View File

@ -48,7 +48,7 @@ def main(iargs=None):
inps=cmdLineParse(iargs)
from osgeo import ogr, osr
from osgeo import gdal, ogr, osr
import matplotlib
if inps.shapefile is not None:
matplotlib.use('Agg')
@ -138,11 +138,19 @@ def main(iargs=None):
lateNear = burst.orbit.rdr2geo(t1,r0)
ring = ogr.Geometry(ogr.wkbLinearRing)
ring.AddPoint(earlyNear[1], earlyNear[0])
ring.AddPoint(earlyFar[1], earlyFar[0])
ring.AddPoint(lateFar[1], lateFar[0])
ring.AddPoint(lateNear[1], lateNear[0])
ring.AddPoint(earlyNear[1], earlyNear[0])
from distutils.version import StrictVersion
if StrictVersion(gdal.__version__) >= StrictVersion("3.0"):
ring.AddPoint(earlyNear[0], earlyNear[1])
ring.AddPoint(earlyFar[0], earlyFar[1])
ring.AddPoint(lateFar[0], lateFar[1])
ring.AddPoint(lateNear[0], lateNear[1])
ring.AddPoint(earlyNear[0], earlyNear[1])
else:
ring.AddPoint(earlyNear[1], earlyNear[0])
ring.AddPoint(earlyFar[1], earlyFar[0])
ring.AddPoint(lateFar[1], lateFar[0])
ring.AddPoint(lateNear[1], lateNear[0])
ring.AddPoint(earlyNear[1], earlyNear[0])
feature = ogr.Feature(layer.GetLayerDefn())
feature.SetField('Name', 'IW{0}-{1}'.format(swath, ii))

View File

@ -20,8 +20,8 @@ propagate=0
[handler_fileHandler]
class=handlers.RotatingFileHandler
formatter=simpleFormatter
# Filename, file mode, maximum file size in bytes,number of backups to keep
args=('isce.log','a',1000048576,5)
# Filename, file mode, maximum file size in bytes,number of backups to keep, encoding, delay creation
args=('isce.log','a',1000048576,5,None,True)
[handler_consoleHandler]
class=StreamHandler

View File

@ -64,6 +64,7 @@ releases = (Tag('1.0.0', '739', '20120814'),
Tag('2.4.2', '', '20201116'),
Tag('2.5.0', '', '20210304'),
Tag('2.5.1', '', '20210305'),
Tag('2.5.2', '', '20210528'),
)

View File

@ -52,7 +52,7 @@ def generate(env):
# default flags for the NVCC compiler
env['STATICNVCCFLAGS'] = ''
env['SHAREDNVCCFLAGS'] = ''
env['ENABLESHAREDNVCCFLAG'] = '-std=c++11 -shared -Xcompiler -fPIC -I/opt/conda/include'
env['ENABLESHAREDNVCCFLAG'] = '-std=c++11 -shared -Xcompiler -fPIC'
# default NVCC commands
env['STATICNVCCCMD'] = '$NVCC -o $TARGET -c $NVCCFLAGS $STATICNVCCFLAGS $SOURCES'