def test_01(self): # three legs, returning TAS only Value = SS.gps2tas([178, 185, 188], [178, 82, 355]) Truth = 183.05 self.failUnless(RE(Value, Truth) <= 1e-4)
def test_04(self): # four legs, returning TAS only Value = SS.gps2tas([178, 185, 188, 184], [178, 82, 355, 265]) Truth = 183.73 self.failUnless(RE(Value, Truth) <= 1e-4)
def test_02(self): # three legs, returning TAS, wind speed and direction (TAS, (WS, Dir)) = SS.gps2tas([178, 185, 188], [178, 82, 355], 1) TAS_Truth = 183.05 WS_Truth = 5.26 Dir_Truth = 194.5 self.failUnless(RE(TAS, TAS_Truth) <= 1e-4) self.failUnless(RE(WS, WS_Truth) <= 1e-3) self.failUnless(RE(Dir, Dir_Truth) <= 1e-4) # four legs, returning TAS only Value = SS.gps2tas([178, 185, 188, 184], [178, 82, 355, 265]) Truth = 183.73 self.failUnless(RE(Value, Truth) <= 1e-4)
def test_05(self): # four legs, returning TAS and standard deviation (TAS, SD) = SS.gps2tas([178, 185, 188, 184], [178, 82, 355, 265], 1) TAS_Truth = 183.73 SD_Truth = 0.827 self.failUnless(RE(TAS, TAS_Truth) <= 1e-4) self.failUnless(RE(SD, SD_Truth) <= 1e-3)
def test_05(self): # four legs, returning TAS and standard deviation (TAS, SD) =SS.gps2tas([178, 185, 188, 184], [178, 82, 355, 265], 1) TAS_Truth = 183.73 SD_Truth = 0.827 self.failUnless(RE(TAS, TAS_Truth) <= 1e-4) self.failUnless(RE(SD, SD_Truth) <= 1e-3)
def gps2stall(GS, TK, Hp, T, temp_units='C', alt_units=default_alt_units, speed_units=default_speed_units, GPS_units=default_speed_units): """ Return the CAS at the stall, given four GPS ground speeds, GPS tracks, altitude and temperature. speed_units = CAS units. May be 'kt', 'mph', 'km/h', 'm/s' and 'ft/s'. GS_units = GPS ground speed units. 'kt', 'mph', 'km/h', 'm/s' and 'ft/s'. HP = pressure altitude. May be feet ('ft'), metres ('m'), kilometres ('km'), statute miles, ('sm') or nautical miles ('nm'). The temperature may be in deg C, F, K or R. If the units are not specified, the units in default_units.py are used. Conduct four stalls, in a four sided box pattern, with all stalls at the same pressure altitude. The data reduction algorithm calculates the TAS using Doug Gray's GPS to TAS method, using four different combinations of three legs. If the data quality is high, all four TAS values will be similar, with a low standard deviation. The TAS at the stall is converted to CAS, using pressure altitude and temperature. Returns CAS and standard deviation of the CAS value. Examples: >>> gps2stall([44, 104, 157, 131], [258, 29, 91, 150], 7000, 14, temp_units='F', GPS_units='km/h') (50.322235245211225, 0.6583323098888626) """ tas, std_dev = SSEC.gps2tas(GS, TK, verbose=1) tas = U.speed_conv(tas, from_units=GPS_units, to_units=speed_units) std_dev = U.speed_conv(std_dev, from_units=GPS_units, to_units=speed_units) cas = A.tas2cas(tas, Hp, T, temp_units=temp_units, alt_units=alt_units, speed_units=speed_units) std_dev = std_dev * cas / tas # factor standard deviation to reference CAS vs TAS return cas, std_dev
def test_03(self): # three legs, returning TAS, wind speed and direction and heading for each leg (TAS, (WS, Dir), (H0, H1, H2)) = SS.gps2tas([178, 185, 188], [178, 82, 355], 2) TAS_Truth = 183.05 WS_Truth = 5.26 Dir_Truth = 194.5 H0_T = 178.46 H1_T = 83.52 H2_T = 354.45 self.failUnless(RE(TAS, TAS_Truth) <= 1e-4) self.failUnless(RE(WS, WS_Truth) <= 1e-3) self.failUnless(RE(Dir, Dir_Truth) <= 1e-4) self.failUnless(RE(H0, H0_T) <= 1e-4) self.failUnless(RE(H1, H1_T) <= 1e-4) self.failUnless(RE(H2, H2_T) <= 1e-4)
def test_06(self): # four legs, returning TAS, standard deviation and four calculated winds (TAS, SD, ((W0, D0), (W1, D1), (W2, D2), (W3, D3))) = SS.gps2tas([178, 185, 188, 184], [178, 82, 355, 265], 2) TAS_Truth = 183.73 SD_Truth = 0.827 W0_T, D0_T = 5.26, 194.52 W1_T, D1_T = 3.58, 181.52 W2_T, D2_T = 5.15, 162.7 W3_T, D3_T = 6.44, 177.95 self.failUnless(RE(TAS, TAS_Truth) <= 1e-4) self.failUnless(RE(SD, SD_Truth) <= 1e-3) self.failUnless(RE(D0, D0_T) <= 1e-4) self.failUnless(RE(D1, D1_T) <= 1e-4) self.failUnless(RE(D2, D2_T) <= 1e-4) self.failUnless(RE(D3, D3_T) <= 1e-4) self.failUnless(RE(W0, W0_T) <= 1e-3) self.failUnless(RE(W1, W1_T) <= 1e-3) self.failUnless(RE(W2, W2_T) <= 1e-3) self.failUnless(RE(W3, W3_T) <= 1e-3)
def test_06(self): # four legs, returning TAS, standard deviation and four calculated winds (TAS, SD, ((W0, D0), (W1, D1), (W2, D2), (W3, D3))) = \ SS.gps2tas([178, 185, 188, 184], [178, 82, 355, 265], 2) TAS_Truth = 183.73 SD_Truth = 0.827 (W0_T, D0_T) = (5.26, 194.52) (W1_T, D1_T) = (3.58, 181.52) (W2_T, D2_T) = (5.15, 162.7) (W3_T, D3_T) = (6.44, 177.95) self.assertTrue(RE(TAS, TAS_Truth) <= 1e-4) self.assertTrue(RE(SD, SD_Truth) <= 1e-3) self.assertTrue(RE(D0, D0_T) <= 1e-4) self.assertTrue(RE(D1, D1_T) <= 1e-4) self.assertTrue(RE(D2, D2_T) <= 1e-4) self.assertTrue(RE(D3, D3_T) <= 1e-4) self.assertTrue(RE(W0, W0_T) <= 1e-3) self.assertTrue(RE(W1, W1_T) <= 1e-3) self.assertTrue(RE(W2, W2_T) <= 1e-3) self.assertTrue(RE(W3, W3_T) <= 1e-3)