Exemple #1
0
    def test_velocity(self):
        vel_a = atm_velocity(55000., 2.4)
        vel_b = atm_velocity(55000., 2.4)
        vel_c = atm_velocity(55000., 2.0)

        self.assertAlmostEqual(vel_a, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_b, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_a, vel_b)
        self.assertAlmostEqual(vel_c, 1935.8, delta=0.1)

        self.assertRaises(TypeError, atm_velocity, 55000, [2.4])
        #self.assertRaises(AtmosphereError, atm_velocity, 55000, None)
        #-----
        vel_a = atm_velocity2(55000., 2.4, alt_units='ft', velocity_units='ft/s')
        vel_b = atm_velocity2(55000., 2.4, alt_units='ft', velocity_units='ft/s')
        vel_c = atm_velocity2(55000., 2.0, alt_units='ft', velocity_units='ft/s')

        self.assertAlmostEqual(vel_a, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_b, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_a, vel_b)
        self.assertAlmostEqual(vel_c, 1935.8, delta=0.1)

        vel_a = atm_velocity2(55., 2.4, alt_units='kft', velocity_units='ft/s')
        vel_b = atm_velocity2(55., 2.4, alt_units='kft', velocity_units='ft/s')
        vel_c = atm_velocity2(55., 2.0, alt_units='kft', velocity_units='ft/s')

        self.assertAlmostEqual(vel_a, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_b, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_a, vel_b)
        self.assertAlmostEqual(vel_c, 1935.8, delta=0.1)
Exemple #2
0
    def test_velocity(self):
        """tests velocity at various altitudes"""
        vel_a = atm_velocity(55000., 2.4)
        vel_b = atm_velocity(55000., 2.4)
        vel_c = atm_velocity(55000., 2.0)

        self.assertAlmostEqual(vel_a, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_b, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_a, vel_b)
        self.assertAlmostEqual(vel_c, 1935.8, delta=0.1)

        self.assertRaises(TypeError, atm_velocity, 55000, [2.4])
        #self.assertRaises(AtmosphereError, atm_velocity, 55000, None)
        #-----
        vel_a = atm_velocity2(55000.,
                              2.4,
                              alt_units='ft',
                              velocity_units='ft/s')
        vel_b = atm_velocity2(55000.,
                              2.4,
                              alt_units='ft',
                              velocity_units='ft/s')
        vel_c = atm_velocity2(55000.,
                              2.0,
                              alt_units='ft',
                              velocity_units='ft/s')

        self.assertAlmostEqual(vel_a, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_b, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_a, vel_b)
        self.assertAlmostEqual(vel_c, 1935.8, delta=0.1)

        vel_a = atm_velocity2(55., 2.4, alt_units='kft', velocity_units='ft/s')
        vel_b = atm_velocity2(55., 2.4, alt_units='kft', velocity_units='ft/s')
        vel_c = atm_velocity2(55., 2.0, alt_units='kft', velocity_units='ft/s')

        self.assertAlmostEqual(vel_a, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_b, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_a, vel_b)
        self.assertAlmostEqual(vel_c, 1935.8, delta=0.1)
Exemple #3
0
    def test_velocity(self):
        """tests velocity at various altitudes"""
        vel_fts_55_2p4 = atm_velocity(55000., 2.4)
        #vel_fts_55_2 = atm_velocity(55000., 2.0)
        vel_fts_55_2b = atm_velocity(55000.,
                                     2.0,
                                     alt_units='ft',
                                     velocity_units='ft/s')
        vel_fts_55_2c = atm_velocity(55.,
                                     2.0,
                                     alt_units='kft',
                                     velocity_units='ft/s')
        vel_ins_55_2c = atm_velocity(55.,
                                     2.0,
                                     alt_units='kft',
                                     velocity_units='in/s')
        assert np.allclose(vel_fts_55_2p4, 2323.05516639), vel_fts_55_2p4
        assert np.allclose(vel_fts_55_2b, 1935.87930533), vel_fts_55_2b
        assert np.allclose(vel_fts_55_2c, 1935.87930533), vel_fts_55_2c
        assert np.allclose(vel_fts_55_2b, vel_ins_55_2c / 12.)

        #vel_fts_55_2b   = atm_velocity(55000., 2.0, alt_units='ft', velocity_units='ft/s')
        vel_knots_55_2b = atm_velocity(55000.,
                                       2.0,
                                       alt_units='ft',
                                       velocity_units='knots')
        vel_ms_55_2b = atm_velocity(55000.,
                                    2.0,
                                    alt_units='ft',
                                    velocity_units='m/s')
        assert np.allclose(vel_knots_55_2b, 1146.977130662127), vel_knots_55_2b
        assert np.allclose(vel_ms_55_2b, 590.0560122641932), vel_ms_55_2b

        with self.assertRaises(RuntimeError):
            atm_velocity(55000., 2.0, alt_units='ft', velocity_units='bad')

        self.assertAlmostEqual(vel_fts_55_2p4, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_fts_55_2p4, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_fts_55_2p4, vel_fts_55_2p4)
        self.assertAlmostEqual(vel_fts_55_2b, 1935.8, delta=0.1)

        with self.assertRaises(TypeError):
            atm_velocity(55000, [2.4])
        #self.assertRaises(AtmosphereError, atm_velocity, 55000, None)
        #-----
        vel_a = atm_velocity(55000.,
                             2.4,
                             alt_units='ft',
                             velocity_units='ft/s')
        vel_b = atm_velocity(55000.,
                             2.4,
                             alt_units='ft',
                             velocity_units='ft/s')
        vel_c = atm_velocity(55000.,
                             2.0,
                             alt_units='ft',
                             velocity_units='ft/s')

        self.assertAlmostEqual(vel_a, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_b, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_a, vel_b)
        self.assertAlmostEqual(vel_c, 1935.8, delta=0.1)

        vel_a = atm_velocity(55., 2.4, alt_units='kft', velocity_units='ft/s')
        vel_b = atm_velocity(55., 2.4, alt_units='kft', velocity_units='ft/s')
        vel_c = atm_velocity(55., 2.0, alt_units='kft', velocity_units='ft/s')

        self.assertAlmostEqual(vel_a, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_b, 2323.0, delta=0.1)
        self.assertAlmostEqual(vel_a, vel_b)
        self.assertAlmostEqual(vel_c, 1935.8, delta=0.1)