Example #1
0
def medianPeg(pegList, planet):
    '''Computes the median of a given list of pegpoints.'''
    import numpy
    elp = planet.get_elp()
    medPeg = Peg()
    nPeg = len(peglist)
    for attribute in ['latitude', 'longitude', 'heading']:
        setattr(medPeg, attribute,numpy.median([getattr(pegPt, attribute) for pegPt in pegList]))

    medPeg.updateRadiusOfCurvature(elp)
    
    return medPeg 
Example #2
0
def averagePeg(pegList, planet):
    '''Computes the average of a given list of pegpoints.'''
    nPeg = len(pegList)
    elp = planet.get_elp()
    avgPeg = Peg()
    for attribute in ['latitude', 'longitude', 'heading']:
        setattr(avgPeg, attribute, sum([getattr(pegPt, attribute) for pegPt in pegList])/(1.0*nPeg))

    
    avgPeg.updateRadiusOfCurvature(elp)
    
    return avgPeg 
    def peg(self):
        if not self._peg:
            peg = [
                math.degrees(self.metadata['Peg Latitude']),
                math.degrees(self.metadata['Peg Longitude']),
                math.degrees(self.metadata['Peg Heading'])
            ]
            th = self.metadata['Global Average Terrain Height']

            if self.metadata['Mocomp II Applied'] is 'Y':
                self.elp.setSCH(peg[0], peg[1], peg[2], th)
            else:
                self.elp.setSCH(peg[0], peg[1], peg[2], 0)

            rc = self.elp.pegRadCur

            from isceobj.Location.Peg import Peg
            self._peg = Peg(latitude=peg[0],
                            longitude=peg[1],
                            heading=peg[2],
                            radiusOfCurvature=rc)

            self.logger.info(
                "UAVSAR_Polsar: peg radius of curvature = {}".format(
                    self.elp.pegRadCur))
            self.logger.info("UAVSAR_Polsar: terrain height = {}".format(th))
            self.logger.info("UAVSAR_Polsar: mocomp II applied = {}".format(
                self.metadata['Mocomp II Applied']))

        return self._peg
Example #4
0
    def _init(self):
        message = (("ISCE VERSION = %s, RELEASE_SVN_REVISION = %s," +
                    "RELEASE_DATE = %s, CURRENT_SVN_REVISION = %s") %
                   (isce.__version__, isce.release_svn_revision,
                    isce.release_date, isce.svn_revision))
        logger.info(message)

        print(message)
        #        print("self.sensorName = ", self.sensorName)
        #        print("self.correlation_method = ", self.correlation_method)
        #        print("self.use_dop = ", self.use_dop)
        #        print("self.geoPosting = ", self.geoPosting)
        #        print("self.posting = ", self.posting)
        #        print("self.rangeLooks = ", self.rangeLooks)
        #        print("self.azLooks = ", self.azLooks)
        #        print("self.offsetMethod = ", self.offsetMethod)
        #        print("self.grossRg, self.grossAz =  ", self.grossRg, self.grossAz )
        if (self.pegLat is not None and self.pegLon is not None
                and self.pegHdg is not None and self.pegRad is not None):
            from isceobj.Location.Peg import Peg
            self.peg = Peg(latitude=self.pegLat,
                           longitude=self.pegLon,
                           heading=self.pegHdg,
                           radiusOfCurvature=self.pegRad)


#            print("self.peg = ", self.peg)
        else:
            self.peg = None
        return None
Example #5
0
    def calculatePegPoint(self, frame, orbit, planet):
        """
        Calculate the peg point used as the origin of the SCH coordinate system during focusing.

        @param frame (\a isceobj.Scene.Frame) the Frame object describing the unfocused SAR data
        @param orbit (\a isceobj.Orbit.Orbit) the orbit along which to calculate the peg point
        @param planet (\a isceobj.Planet.Planet) the planet around which the satellite is orbiting
        @return (\a tuple) the peg point, and the height and velocity at mid-orbit
        """
        import math
        from isceobj.Location.Peg import Peg

        # First, get the orbit nadir location at mid-swath and the end of the scene
        midxyz = orbit.interpolateOrbit(frame.getSensingMid())
        endxyz = orbit.interpolateOrbit(frame.getSensingStop())
        # Next, calculate the satellite heading from the mid-point to the end of the scene
        ellipsoid = planet.get_elp()
        midllh = ellipsoid.xyz_to_llh(midxyz.getPosition())
        endllh = ellipsoid.xyz_to_llh(endxyz.getPosition())
        heading = ellipsoid.geo_hdg(midllh, endllh)
        # Then create a peg point from this data
        peg = Peg(latitude=midllh[0],
                  longitude=midllh[1],
                  heading=math.degrees(heading),
                  radiusOfCurvature=ellipsoid.get_a())
        self.logger.debug("Peg Point:\n%s" % peg)
        return peg, midllh[2], midxyz.getScalarVelocity()
Example #6
0
 def setUp(self):
     ellipsoid = Ellipsoid(a=PlanetsData.ellipsoid['Earth']['WGS-84'][0],
                           e2=PlanetsData.ellipsoid['Earth']['WGS-84'][1])
     peg = Peg(latitude=30.0,
               longitude=60.0,
               heading=45.0,
               ellipsoid=ellipsoid)
     self.xyz = ellipsoid.llh_to_xyz([30.1, 59.5, 650000.0])
     self.sch = SCH(peg=peg)
    def peg(self):
        peg = [math.degrees(self.metadata['Peg Latitude']),
               math.degrees(self.metadata['Peg Longitude']),
               math.degrees(self.metadata['Peg Heading'])]

        platform = self.frame.getInstrument().getPlatform()
        elp = platform.getPlanet().get_elp()
        elp.setSCH(*peg)
        rc = elp.pegRadCur

        from isceobj.Location.Peg import Peg
        return Peg(latitude=peg[0], longitude=peg[1], heading=peg[2],
                   radiusOfCurvature=rc)
Example #8
0
    def estimatePeg(self):
        for port in self.inputPorts:
            port()
        self.allocateArrays()
        self.setState()
        getpeg.getpeg_Py()
        self.getState()
        self.deallocateArrays()
        self._peg = Peg(latitude=math.degrees(self.pegLatitude),
                        longitude=math.degrees(self.pegLongitude),
                        heading=math.degrees(self.pegHeading),
                        radiusOfCurvature=self.pegRadiusOfCurvature)

        return None
Example #9
0
    def _init(self):
        message = (("ISCE VERSION = %s, RELEASE_SVN_REVISION = %s," +
                    "RELEASE_DATE = %s, CURRENT_SVN_REVISION = %s") %
                   (isce.__version__, isce.release_svn_revision,
                    isce.release_date, isce.svn_revision))
        self.intromsg = message

        print(message)
        if (self.pegLat is not None and self.pegLon is not None
                and self.pegHdg is not None and self.pegRad is not None):
            self.peg = Peg(latitude=self.pegLat,
                           longitude=self.pegLon,
                           heading=self.pegHdg,
                           radiusOfCurvature=self.pegRad)
 def calculatePegPoint(self):
     self.logger.info("Parsing Raw Data")
     self.sensorObj.parse()
     frame = self.sensorObj.getFrame()
     # First, get the orbit nadir location at mid-swath and the end of the scene
     orbit = self.sensorObj.getFrame().getOrbit()
     midxyz = orbit.interpolateOrbit(frame.getSensingMid())
     endxyz = orbit.interpolateOrbit(frame.getSensingStop())
     # Next, calculate the satellite heading from the mid-point to the end of the scene
     ellipsoid = frame.getInstrument().getPlatform().getPlanet().get_elp()
     midllh = ellipsoid.xyz_to_llh(midxyz.getPosition())
     endllh = ellipsoid.xyz_to_llh(endxyz.getPosition())
     heading = ellipsoid.geo_hdg(midllh,endllh)
     # Then create a peg point from this data
     peg = Peg(latitude=midllh[0],longitude=midllh[1],heading=heading,ellipsoid=ellipsoid)
     self.logger.info("Peg Point:\n%s" % peg)
    def getXYZOrbit(self, orbit, peg, hdg):
        '''
        Convert an input SCH orbit to XYZ coords.
        '''
        llh = [peg.lat, peg.lon, peg.hgt]
        radius = self._planet.ellipsoid.radiusOfCurvature(llh, hdg=hdg)

        midPeg = Peg(latitude=peg.lat,
                     longitude=peg.lon,
                     heading=hdg,
                     radiusOfCurvature=radius)
        writer = create_writer("log", "", True, filename='orbit_extender.log')
        orbxyz = stdproc.createSch2orbit()
        orbxyz.radiusOfCurvature = radius
        orbxyz.setStdWriter(writer)
        orbxyz(planet=self._planet, orbit=orbit, peg=midPeg)
        return orbxyz.orbit
    def getSCHOrbit(self, orbit, peg, hdg):
        '''
        Accepts a WGS-84 orbit and converts it to SCH.
        '''
        writer = create_writer("log", "", True, filename='orbit_extender.log')
        llh = [peg.lat, peg.lon, peg.hgt]

        ####Local radius
        radius = self._planet.ellipsoid.radiusOfCurvature(llh, hdg=hdg)

        #midPeg is a Location.Peg object
        midPeg = Peg(latitude=peg.lat,
                     longitude=peg.lon,
                     heading=hdg,
                     radiusOfCurvature=radius)

        orbSch = stdproc.createOrbit2sch(averageHeight=peg.hgt)
        orbSch.setStdWriter(writer)
        orbSch(planet=self._planet, orbit=orbit, peg=midPeg)

        return orbSch.orbit
Example #13
0
    def peg(self):
        if not self._peg:
            peg = [
                math.degrees(self.metadata['Peg Latitude']),
                math.degrees(self.metadata['Peg Longitude']),
                math.degrees(self.metadata['Peg Heading'])
            ]
            th = self.metadata['Global Average Terrain Height']
            platform = self.frame.getInstrument().getPlatform()
            self.elp.setSCH(peg[0], peg[1], peg[2], th)
            rc = self.elp.pegRadCur

            from isceobj.Location.Peg import Peg
            self._peg = Peg(latitude=peg[0],
                            longitude=peg[1],
                            heading=peg[2],
                            radiusOfCurvature=rc)
            self.logger.info(
                "UAVSAR_Stack: peg radius of curvature = {}".format(
                    self.elp.pegRadCur))
            self.logger.info("UAVSAR_Stack: terrain height = {}".format(th))

        return self._peg