Example #1
0
 def getState(self):
     self.geoWidth = geocode.getGeoWidth_Py()
     self.geoLength = geocode.getGeoLength_Py()
     self.latitudeSpacing = geocode.getLatitudeSpacing_Py()
     self.longitudeSpacing = geocode.getLongitudeSpacing_Py()
     self.minimumGeoLatitude = geocode.getMinimumGeoLatitude_Py()
     self.minimumGeoLongitude = geocode.getMinimumGeoLongitude_Py()
     self.maximumGeoLatitude = geocode.getMaximumGeoLatitude_Py()
     self.maximumGeoLongitude = geocode.getMaxmumGeoLongitude_Py()
Example #2
0
    def geocode(self, demImage=None, inputImage=None, method=None):
        self.activateInputPorts()

        if demImage is not None:
            self.demImage = demImage
        if inputImage is not None:
            self.inputImage = inputImage
        if method is not None:
            self.method = method


        if self.referenceOrbit is None:
            raise Exception('No reference orbit provided for geocoding')

        self.setDefaults()
        self.createImages()
        self.allocateArray()
        self.setState()
        #this inits the image in the c++ bindings
        #allow geocoding for non float imaages
        if not self.inputImage.dataType.upper().count('FLOAT'):
            self.inputImage.setCaster('read','FLOAT')
        self.inputImage.createImage()


        self.demImage.setCaster('read','FLOAT')
        self.demImage.createImage()
        demAccessor = self.demImage.getImagePointer()

        inputAccessor = self.inputImage.getImagePointer()
        complexFlag = self.inputImage.dataType.upper().startswith('C')
        nBands = self.inputImage.getBands()

        #####Output cropped DEM for first band
        inband=0
        outband=0
        geocode.geocode_Py(demAccessor,
                           inputAccessor,
                           self.demCropAccessor,
                           self.losAccessor,
                           self.geoAccessor,inband,
                           outband,int(complexFlag),
                           int(self.interp_methods[self.method]))

        #####Supress cropped DEM output for other bands
        for kk in range(1,nBands):
            self.demImage.rewind()
            self.inputImage.rewind()
            self.demCropImage.rewind()
            self.geoImage.rewind()

            inband = kk
            outband = kk
            demCropAcc = 0
            geocode.geocode_Py(demAccessor, inputAccessor, demCropAcc,
                    self.losAccessor,
                    self.geoAccessor, inband, outband,
                    int(complexFlag), int(self.interp_methods[self.method]))

        self.getState()

        self.demImage.finalizeImage()
        self.inputImage.finalizeImage()
        self.deallocateArray()
        self.destroyImages()
        self.geoImage.setWidth(geocode.getGeoWidth_Py())
        self.geoImage.trueDataType = self.geoImage.getDataType()
#        self.geoImage.description = "DEM-flattened interferogram orthorectified to an equi-angular latitude, longitude grid"
        self.geoImage.coord2.coordDescription = 'Latitude'
        self.geoImage.coord2.coordUnits = 'degree'
        self.geoImage.coord2.coordStart = self.minimumGeoLatitude
        self.geoImage.coord2.coordDelta = self.deltaLatitude/self.numberPointsPerDemPost
        self.geoImage.coord1.coordDescription = 'Longitude'
        self.geoImage.coord1.coordUnits = 'degree'
        self.geoImage.coord1.coordStart = self.minimumGeoLongitude
        self.geoImage.coord1.coordDelta = self.deltaLongitude/self.numberPointsPerDemPost

        descr = self.inputImage.getDescription()
        if descr not in [None, '']:
            self.geoImage.addDescription(descr)

        self.geoImage.renderHdr()
        return None