示例#1
0
    def testSCHDOT(self):
        elp = Planet("Earth").get_elp()

        elp.setSCH(0., 0., 90.)
        sch = [0., 0., 0.]
        schdot = [0., 0., 10.]
        xyz, xyzdot = elp.schdot_to_xyzdot(sch, schdot)
        ans = [10.0, 0.0, 0.0]
        for (x, x1) in zip(xyzdot, ans):
            self.assertAlmostEqual(x, x1, places=3)

        xyz = [elp.a, 0., 0.]
        sch1, schdot1 = elp.xyzdot_to_schdot(xyz, xyzdot)
        for (s, s1) in zip(schdot, schdot1):
            self.assertAlmostEqual(s, s1, places=3)

        elp.setSCH(30., 60., 30.)
        sch = [0., 0., 0.]
        schdot = [10., 0., 0.]
        xyz, xyzdot = elp.schdot_to_xyzdot(sch, schdot)
        ans = [-6.495190528383289, -1.2499999999999996, 7.500000000000001]
        for (x, x1) in zip(xyzdot, ans):
            self.assertAlmostEqual(x, x1, places=3)
        xyz = elp.sch_to_xyz(sch)
        sch1, schdot1 = elp.xyzdot_to_schdot(xyz, xyzdot)
        for (s, s1) in zip(schdot, schdot1):
            self.assertAlmostEqual(s, s1, places=3)
示例#2
0
    def testConvertSCHdot(self):
        elp = Planet("Earth").get_elp()
        elp.setSCH(66.0, -105.0, 36.0)

        #From for_ellipsoid_test.F
        #convert_schdot_to_xyzdot, sch_to_xyz
        r_sch = [1468.0, -234.0, 7000.0]
        r_schdot = [800.0, -400.0, 100.0]
        r_xyz = [-672788.46258740244, -2514950.4839521507, 5810769.7976823179]
        r_xyzdot = [853.73728655948685, 118.98447071885982, 258.79594191185748]
        posXYZ, velXYZ = elp.schdot_to_xyzdot(r_sch, r_schdot)
        for (a, b) in zip(r_xyz, posXYZ):
            self.assertAlmostEqual(a, b, places=3)
        for (a, b) in zip(r_xyzdot, velXYZ):
            self.assertAlmostEqual(a, b, places=3)

        #convert_schdot_to_xyzdot, xyz_to_sch
        r_xyz = [-672100.0, -2514000.0, 5811000.0]
        r_xyzdot = [800.0, -400.0, 100.0]
        r_sch = [2599.1237664792707, 70.396218844576666, 6764.7576835183427]
        r_schdot = [
            415.39842327248573, -781.28909619852459, 164.41258499283407
        ]
        posSCH, velSCH = elp.xyzdot_to_schdot(r_xyz, r_xyzdot)
        for (a, b) in zip(r_sch, posSCH):
            self.assertAlmostEqual(a, b, places=3)
        for (a, b) in zip(r_schdot, velSCH):
            self.assertAlmostEqual(a, b, delta=0.1)
    def numberOfLooks(self, frame, posting,  azlooks, rglooks):
        '''
        Compute relevant number of looks.
        '''
        from isceobj.Planet.Planet import Planet
        from isceobj.Constants import SPEED_OF_LIGHT
        import numpy as np

        azFinal = None
        rgFinal = None

        if azlooks is not None:
            azFinal = azlooks

        if rglooks is not None:
            rgFinal = rglooks

        if (azFinal is not None) and (rgFinal is not None):
            return (azFinal, rgFinal)

        if posting is None:
            raise Exception('Input posting is none. Either specify (azlooks, rglooks) or posting in input file')


        elp = Planet(pname='Earth').ellipsoid

        ####First determine azimuth looks
        tmid = frame.sensingMid
        sv = frame.orbit.interpolateOrbit( tmid, method='hermite') #.getPosition()
        llh = elp.xyz_to_llh(sv.getPosition())


        if azFinal is None:
            hdg = frame.orbit.getENUHeading(tmid)
            elp.setSCH(llh[0], llh[1], hdg)
            sch, vsch = elp.xyzdot_to_schdot(sv.getPosition(), sv.getVelocity())
            azFinal = max(int(np.round(posting * frame.PRF / vsch[0])), 1)

        if rgFinal is None:
            pulseLength = frame.instrument.pulseLength
            chirpSlope = frame.instrument.chirpSlope

            #Range Bandwidth
            rBW = np.abs(chirpSlope)*pulseLength

            # Slant Range resolution
            rgres = abs(SPEED_OF_LIGHT / (2.0 * rBW))
            
            r0 = frame.startingRange
            rmax = frame.getFarRange()
            rng =(r0+rmax)/2 

            Re = elp.pegRadCur
            H = sch[2]
            cos_beta_e = (Re**2 + (Re + H)**2 -rng**2)/(2*Re*(Re+H))
            sin_bet_e = np.sqrt(1 - cos_beta_e**2)
            sin_theta_i = sin_bet_e*(Re + H)/rng
            print("incidence angle at the middle of the swath: ", np.arcsin(sin_theta_i)*180.0/np.pi)
            groundRangeRes = rgres/sin_theta_i
            print("Ground range resolution at the middle of the swath: ", groundRangeRes)
            rgFinal = max(int(np.round(posting/groundRangeRes)),1)

        return azFinal, rgFinal