def test__vls_clean__altitude_none(self):
     altitude = None
     weight = np.ma.ones(10) * 160000
     result = self.vs._determine_vspeed('vls_clean',
                                        weight=weight,
                                        altitude=altitude)
     expected = np.ma.ones(10)
     expected.mask = True
     ma_test.assert_masked_array_equal(expected, result)
 def test__v2__minimum_speed(self):
     self.vs.minimum_speed = 125
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.v2('15', 100500), 125)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(100, 110, 2) * 1000
     weight[2] = np.ma.masked
     v2_15 = np.ma.array((125, 125, 125, 126, 127))
     v2_15[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.v2('15', weight), v2_15)
 def test__vls_clean__weight_none(self):
     altitude = np.ma.concatenate(
         (np.ma.ones(5) * 10000, np.ma.ones(5) * 20000))
     weight = None
     result = self.vs._determine_vspeed('vls_clean',
                                        weight=weight,
                                        altitude=altitude)
     expected = np.ma.ones(1)
     expected.mask = True
     ma_test.assert_masked_array_equal(expected, result)
 def test__v2__minimum_speed(self):
     self.vs.minimum_speed = 125
     # Test where weight argument is a single value:
     self.assertEquals(self.vs.v2('15', 100500), 125)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(100, 110, 2) * 1000
     weight[2] = np.ma.masked
     v2_15 = np.ma.array((125, 125, 125, 126, 127))
     v2_15[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.v2('15', weight), v2_15)
 def test__vls_clean__arrays(self):
     altitude = np.ma.concatenate(
         (np.ma.ones(5) * 10000, np.ma.ones(5) * 20000))
     weight = np.ma.ones(10) * 160000
     result = self.vs._determine_vspeed('vls_clean',
                                        weight=weight,
                                        altitude=altitude)
     expected = np.ma.concatenate(
         (np.ma.ones(5) * 171, np.ma.ones(5) * 182))
     ma_test.assert_masked_array_equal(expected, result)
 def test__vapp__minimum_speed(self):
     self.vs.minimum_speed = 112
     # Test where weight argument is a single value:
     self.assertEquals(self.vs.vapp('15', 100500), 112)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(100, 110, 2) * 1000
     weight[2] = np.ma.masked
     vapp_15 = np.ma.array((112, 112, 112, 113, 115))
     vapp_15[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.vapp('15', weight), vapp_15)
 def test__vapp__minimum_speed(self):
     self.vs.minimum_speed = 112
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.vapp('15', 100500), 112)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(100, 110, 2) * 1000
     weight[2] = np.ma.masked
     vapp_15 = np.ma.array((112, 112, 112, 113, 115))
     vapp_15[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.vapp('15', weight), vapp_15)
 def test__mmo__none(self):
     self.vs.tables['mmo'] = None
     # Test where altitude argument is a single value:
     self.assertIs(self.vs.mmo(00000), np.ma.masked)
     self.assertIs(self.vs.mmo(10000), np.ma.masked)
     self.assertIs(self.vs.mmo(20000), np.ma.masked)
     self.assertIs(self.vs.mmo(30000), np.ma.masked)
     self.assertIs(self.vs.mmo(40000), np.ma.masked)
     # Test where altitude argument is a masked array:
     altitude = np.ma.arange(0, 50, 10) * 1000
     mmo = np.ma.repeat(0, 5)
     mmo.mask = True
     ma_test.assert_masked_array_equal(self.vs.mmo(altitude), mmo)
 def test__mmo__none(self):
     self.vs.tables['mmo'] = None
     # Test where altitude argument is a single value:
     self.assertIs(self.vs.mmo(00000), np.ma.masked)
     self.assertIs(self.vs.mmo(10000), np.ma.masked)
     self.assertIs(self.vs.mmo(20000), np.ma.masked)
     self.assertIs(self.vs.mmo(30000), np.ma.masked)
     self.assertIs(self.vs.mmo(40000), np.ma.masked)
     # Test where altitude argument is a masked array:
     altitude = np.ma.arange(0, 50, 10) * 1000
     mmo = np.ma.repeat(0, 5)
     mmo.mask = True
     ma_test.assert_masked_array_equal(self.vs.mmo(altitude), mmo)
 def test__vapp__fallback__weight_fully_masked(self):
     self.assertTrue('20' in self.vs.tables['vapp'])
     self.assertTrue('20' in self.vs.fallback['vapp'])
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.vapp('20', np.ma.masked), 100)
     self.assertIsNot(self.vs.vapp('20', np.ma.masked), np.ma.masked)
     # Test where weight argument is a masked array:
     # Note: Array with fallback using weight array shape if fully masked.
     weight = np.ma.repeat(120, 6) * 1000
     weight.mask = True
     vapp_20 = np.ma.repeat(100, 6)
     vapp_20.mask = False
     ma_test.assert_masked_array_equal(self.vs.vapp('20', weight), vapp_20)
 def test__vapp__fallback__weight_not_recorded(self):
     self.assertTrue('20' in self.vs.tables['vapp'])
     self.assertTrue('20' in self.vs.fallback['vapp'])
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.vapp('20'), 100)
     self.assertIsNot(self.vs.vapp('20'), np.ma.masked)
     # Test where weight argument is a masked array:
     # Note: Pass in masked zeroed array of desired shape to get array.
     weight = np.ma.repeat(0, 6)
     weight.mask = True
     vapp_20 = np.ma.repeat(100, 6)
     vapp_20.mask = False
     ma_test.assert_masked_array_equal(self.vs.vapp('20', weight), vapp_20)
 def test__vapp__fallback__weight_not_recorded(self):
     self.assertTrue('20' in self.vs.tables['vapp'])
     self.assertTrue('20' in self.vs.fallback['vapp'])
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.vapp('20'), 100)
     self.assertIsNot(self.vs.vapp('20'), np.ma.masked)
     # Test where weight argument is a masked array:
     # Note: Pass in masked zeroed array of desired shape to get array.
     weight = np.ma.repeat(0, 6)
     weight.mask = True
     vapp_20 = np.ma.repeat(100, 6)
     vapp_20.mask = False
     ma_test.assert_masked_array_equal(self.vs.vapp('20', weight), vapp_20)
 def test__vapp__fallback__weight_fully_masked(self):
     self.assertTrue('20' in self.vs.tables['vapp'])
     self.assertTrue('20' in self.vs.fallback['vapp'])
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.vapp('20', np.ma.masked), 100)
     self.assertIsNot(self.vs.vapp('20', np.ma.masked), np.ma.masked)
     # Test where weight argument is a masked array:
     # Note: Array with fallback using weight array shape if fully masked.
     weight = np.ma.repeat(120, 6) * 1000
     weight.mask = True
     vapp_20 = np.ma.repeat(100, 6)
     vapp_20.mask = False
     ma_test.assert_masked_array_equal(self.vs.vapp('20', weight), vapp_20)
 def test__vapp__weight_scale__1000_lb(self):
     self.vs.weight_scale = 1000
     self.vs.weight_unit = ut.LB
     # Test where weight argument is a single value:
     self.assertIs(self.vs.vapp('20', 43091), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 88451), np.ma.masked)
     self.assertIsNot(self.vs.vapp('20', 54431), np.ma.masked)
     self.assertAlmostEqual(self.vs.vapp('20', 54431), 118, places=3)
     # Test where weight argument is a masked array:
     weight = np.ma.array((43091, 52163, 61239, 70307, 79379, 88451))
     vapp_15 = np.ma.array((0, 119, 130, 141, 154, 0))
     vapp_15[0] = np.ma.masked
     vapp_15[5] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.vapp('15', weight), vapp_15)
 def test__vapp__weight_scale__1000_lb(self):
     self.vs.weight_scale = 1000
     self.vs.weight_unit = ut.LB
     # Test where weight argument is a single value:
     self.assertIs(self.vs.vapp('20', 43091), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 88451), np.ma.masked)
     self.assertIsNot(self.vs.vapp('20', 54431), np.ma.masked)
     self.assertAlmostEqual(self.vs.vapp('20', 54431), 118, places=3)
     # Test where weight argument is a masked array:
     weight = np.ma.array((43091, 52163, 61239, 70307, 79379, 88451))
     vapp_15 = np.ma.array((0, 119, 130, 141, 154, 0))
     vapp_15[0] = np.ma.masked
     vapp_15[5] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.vapp('15', weight), vapp_15)
 def test__mmo__fixed(self):
     self.vs.tables['mmo'] = 0.850
     # Test where altitude argument is a single value:
     self.assertEqual(self.vs.mmo(00000), 0.850)
     self.assertEqual(self.vs.mmo(10000), 0.850)
     self.assertEqual(self.vs.mmo(20000), 0.850)
     self.assertEqual(self.vs.mmo(30000), 0.850)
     self.assertEqual(self.vs.mmo(40000), 0.850)
     # Test where altitude argument is a masked array:
     altitude = np.ma.arange(0, 50, 10) * 1000
     altitude[2] = np.ma.masked
     mmo = np.ma.repeat(0.850, 5)
     mmo.mask = False
     ma_test.assert_masked_array_equal(self.vs.mmo(altitude), mmo)
 def test__mmo__fixed(self):
     self.vs.tables['mmo'] = 0.850
     # Test where altitude argument is a single value:
     self.assertEqual(self.vs.mmo(00000), 0.850)
     self.assertEqual(self.vs.mmo(10000), 0.850)
     self.assertEqual(self.vs.mmo(20000), 0.850)
     self.assertEqual(self.vs.mmo(30000), 0.850)
     self.assertEqual(self.vs.mmo(40000), 0.850)
     # Test where altitude argument is a masked array:
     altitude = np.ma.arange(0, 50, 10) * 1000
     altitude[2] = np.ma.masked
     mmo = np.ma.repeat(0.850, 5)
     mmo.mask = False
     ma_test.assert_masked_array_equal(self.vs.mmo(altitude), mmo)
 def test__vapp__fallback__detent_not_available(self):
     del self.vs.tables['vapp']['20']
     del self.vs.fallback['vapp']['20']
     self.assertFalse('20' in self.vs.tables['vapp'])
     self.assertFalse('20' in self.vs.fallback['vapp'])
     # Test where weight argument is a single value:
     self.assertIs(self.vs.vapp('20'), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 100000), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 120000), np.ma.masked)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(100, 200, 10) * 1000
     weight[5] = np.ma.masked
     vapp_20 = np.ma.repeat(0, weight.size)
     vapp_20.mask = True
     ma_test.assert_masked_array_equal(self.vs.vapp('20', weight), vapp_20)
 def test__vapp__fallback__detent_not_available(self):
     del self.vs.tables['vapp']['20']
     del self.vs.fallback['vapp']['20']
     self.assertFalse('20' in self.vs.tables['vapp'])
     self.assertFalse('20' in self.vs.fallback['vapp'])
     # Test where weight argument is a single value:
     self.assertIs(self.vs.vapp('20'), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 100000), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 120000), np.ma.masked)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(100, 200, 10) * 1000
     weight[5] = np.ma.masked
     vapp_20 = np.ma.repeat(0, weight.size)
     vapp_20.mask = True
     ma_test.assert_masked_array_equal(self.vs.vapp('20', weight), vapp_20)
 def test__vapp__out_of_range(self):
     # Test where weight argument is a single value:
     self.assertIs(self.vs.vapp('20', 95000), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 99999), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 190001), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 195000), np.ma.masked)
     self.assertIsNot(self.vs.vapp('20', 100000), np.ma.masked)
     self.assertIsNot(self.vs.vapp('20', 190000), np.ma.masked)
     self.assertEquals(self.vs.vapp('20', 100000), 105)
     self.assertEquals(self.vs.vapp('20', 190000), 158)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(95, 200, 20) * 1000
     vapp_15 = np.ma.array((0, 119, 130, 140, 154, 0))
     vapp_15[0] = np.ma.masked
     vapp_15[5] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.vapp('15', weight), vapp_15)
 def test__vapp__out_of_range(self):
     # Test where weight argument is a single value:
     self.assertIs(self.vs.vapp('20', 95000), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 99999), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 190001), np.ma.masked)
     self.assertIs(self.vs.vapp('20', 195000), np.ma.masked)
     self.assertIsNot(self.vs.vapp('20', 100000), np.ma.masked)
     self.assertIsNot(self.vs.vapp('20', 190000), np.ma.masked)
     self.assertEqual(self.vs.vapp('20', 100000), 105)
     self.assertEqual(self.vs.vapp('20', 190000), 158)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(95, 200, 20) * 1000
     vapp_15 = np.ma.array((0, 119, 130, 140, 154, 0))
     vapp_15[0] = np.ma.masked
     vapp_15[5] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.vapp('15', weight), vapp_15)
 def test__v2__out_of_range(self):
     # Test where weight argument is a single value:
     self.assertIs(self.vs.v2('20', 95000), np.ma.masked)
     self.assertIs(self.vs.v2('20', 99999), np.ma.masked)
     self.assertIs(self.vs.v2('20', 190001), np.ma.masked)
     self.assertIs(self.vs.v2('20', 195000), np.ma.masked)
     self.assertIsNot(self.vs.v2('20', 100000), np.ma.masked)
     self.assertIsNot(self.vs.v2('20', 190000), np.ma.masked)
     self.assertEqual(self.vs.v2('20', 100000), 118)
     self.assertEqual(self.vs.v2('20', 190000), 164)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(95, 200, 20) * 1000
     v2_15 = np.ma.array((0, 131, 142, 152, 162, 0))
     v2_15[0] = np.ma.masked
     v2_15[5] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.v2('15', weight), v2_15)
 def test__v2__out_of_range(self):
     # Test where weight argument is a single value:
     self.assertIs(self.vs.v2('20', 95000), np.ma.masked)
     self.assertIs(self.vs.v2('20', 99999), np.ma.masked)
     self.assertIs(self.vs.v2('20', 190001), np.ma.masked)
     self.assertIs(self.vs.v2('20', 195000), np.ma.masked)
     self.assertIsNot(self.vs.v2('20', 100000), np.ma.masked)
     self.assertIsNot(self.vs.v2('20', 190000), np.ma.masked)
     self.assertEquals(self.vs.v2('20', 100000), 118)
     self.assertEquals(self.vs.v2('20', 190000), 164)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(95, 200, 20) * 1000
     v2_15 = np.ma.array((0, 131, 142, 152, 162, 0))
     v2_15[0] = np.ma.masked
     v2_15[5] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.v2('15', weight), v2_15)
 def test__mmo__stepped(self):
     self.vs.tables['mmo'] = {
         'altitude': (    0, 20000, 20000, 40000),
            'speed': (0.850, 0.850, 0.800, 0.800),
     }
     # Test where altitude argument is a single value:
     self.assertEqual(self.vs.mmo(00000), 0.850)
     self.assertEqual(self.vs.mmo(19999), 0.850)
     self.assertEqual(self.vs.mmo(20000), 0.800)
     self.assertEqual(self.vs.mmo(20001), 0.800)
     self.assertEqual(self.vs.mmo(40000), 0.800)
     # Test where altitude argument is a masked array:
     altitude = np.ma.arange(0, 50, 10) * 1000
     altitude[2] = np.ma.masked
     mmo = np.ma.array([0.850] * 2 + [0.800] * 3)
     mmo[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.mmo(altitude), mmo)
 def test__vapp__fallback__no_weight_based_table(self):
     del self.vs.tables['vapp']
     self.assertFalse('vapp' in self.vs.tables)
     self.assertTrue('20' in self.vs.fallback['vapp'])
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.vapp('20'), 100)
     self.assertIsNot(self.vs.vapp('20'), np.ma.masked)
     self.assertEqual(self.vs.vapp('20', 100000), 100)
     self.assertIsNot(self.vs.vapp('20', 100000), np.ma.masked)
     self.assertEqual(self.vs.vapp('20', 120000), 100)
     self.assertIsNot(self.vs.vapp('20', 120000), np.ma.masked)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(100, 200, 10) * 1000
     weight[5] = np.ma.masked
     vapp_20 = np.ma.repeat(100, weight.size)
     vapp_20.mask = False
     ma_test.assert_masked_array_equal(self.vs.vapp('20', weight), vapp_20)
 def test__vmo__interpolated(self):
     self.vs.tables['vmo'] = {
         'altitude': (  0, 20000, 40000),
            'speed': (350,   330,   310),
     }
     # Test where altitude argument is a single value:
     self.assertEqual(self.vs.vmo(00000), 350)
     self.assertEqual(self.vs.vmo(10000), 340)
     self.assertEqual(self.vs.vmo(20000), 330)
     self.assertEqual(self.vs.vmo(30000), 320)
     self.assertEqual(self.vs.vmo(40000), 310)
     # Test where altitude argument is a masked array:
     altitude = np.ma.arange(0, 50, 10) * 1000
     altitude[2] = np.ma.masked
     vmo = np.ma.arange(350, 300, -10)
     vmo[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.vmo(altitude), vmo)
 def test__vapp__fallback__no_weight_based_table(self):
     del self.vs.tables['vapp']
     self.assertFalse('vapp' in self.vs.tables)
     self.assertTrue('20' in self.vs.fallback['vapp'])
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.vapp('20'), 100)
     self.assertIsNot(self.vs.vapp('20'), np.ma.masked)
     self.assertEqual(self.vs.vapp('20', 100000), 100)
     self.assertIsNot(self.vs.vapp('20', 100000), np.ma.masked)
     self.assertEqual(self.vs.vapp('20', 120000), 100)
     self.assertIsNot(self.vs.vapp('20', 120000), np.ma.masked)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(100, 200, 10) * 1000
     weight[5] = np.ma.masked
     vapp_20 = np.ma.repeat(100, weight.size)
     vapp_20.mask = False
     ma_test.assert_masked_array_equal(self.vs.vapp('20', weight), vapp_20)
 def test__mmo__interpolated(self):
     self.vs.tables['mmo'] = {
         'altitude': (    0, 20000, 40000),
            'speed': (0.860, 0.830, 0.800),
     }
     # Test where altitude argument is a single value:
     self.assertEqual(self.vs.mmo(00000), 0.860)
     self.assertEqual(self.vs.mmo(10000), 0.845)
     self.assertEqual(self.vs.mmo(20000), 0.830)
     self.assertEqual(self.vs.mmo(30000), 0.815)
     self.assertEqual(self.vs.mmo(40000), 0.800)
     # Test where altitude argument is a masked array:
     altitude = np.ma.arange(0, 50, 10) * 1000
     altitude[2] = np.ma.masked
     mmo = np.ma.arange(860, 785, -15) / 1000.0
     mmo[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.mmo(altitude), mmo)
 def test__vmo__interpolated(self):
     self.vs.tables['vmo'] = {
         'altitude': (0, 20000, 40000),
         'speed': (350, 330, 310),
     }
     # Test where altitude argument is a single value:
     self.assertEqual(self.vs.vmo(00000), 350)
     self.assertEqual(self.vs.vmo(10000), 340)
     self.assertEqual(self.vs.vmo(20000), 330)
     self.assertEqual(self.vs.vmo(30000), 320)
     self.assertEqual(self.vs.vmo(40000), 310)
     # Test where altitude argument is a masked array:
     altitude = np.ma.arange(0, 50, 10) * 1000
     altitude[2] = np.ma.masked
     vmo = np.ma.arange(350, 300, -10)
     vmo[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.vmo(altitude), vmo)
 def test__vref__fallback__detent_in_fallback_only(self):
     del self.vs.tables['vref']['20']
     self.assertFalse('20' in self.vs.tables['vref'])
     self.assertTrue('20' in self.vs.fallback['vref'])
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.vref('20'), 100)
     self.assertIsNot(self.vs.vref('20'), np.ma.masked)
     self.assertEqual(self.vs.vref('20', 100000), 100)
     self.assertIsNot(self.vs.vref('20', 100000), np.ma.masked)
     self.assertEqual(self.vs.vref('20', 120000), 100)
     self.assertIsNot(self.vs.vref('20', 120000), np.ma.masked)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(100, 200, 10) * 1000
     weight[5] = np.ma.masked
     vref_20 = np.ma.repeat(100, weight.size)
     vref_20.mask = False
     ma_test.assert_masked_array_equal(self.vs.vref('20', weight), vref_20)
 def test__vref__fallback__detent_in_fallback_only(self):
     del self.vs.tables['vref']['20']
     self.assertFalse('20' in self.vs.tables['vref'])
     self.assertTrue('20' in self.vs.fallback['vref'])
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.vref('20'), 100)
     self.assertIsNot(self.vs.vref('20'), np.ma.masked)
     self.assertEqual(self.vs.vref('20', 100000), 100)
     self.assertIsNot(self.vs.vref('20', 100000), np.ma.masked)
     self.assertEqual(self.vs.vref('20', 120000), 100)
     self.assertIsNot(self.vs.vref('20', 120000), np.ma.masked)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(100, 200, 10) * 1000
     weight[5] = np.ma.masked
     vref_20 = np.ma.repeat(100, weight.size)
     vref_20.mask = False
     ma_test.assert_masked_array_equal(self.vs.vref('20', weight), vref_20)
 def test__mmo__interpolated(self):
     self.vs.tables['mmo'] = {
         'altitude': (0, 20000, 40000),
         'speed': (0.860, 0.830, 0.800),
     }
     # Test where altitude argument is a single value:
     self.assertEqual(self.vs.mmo(00000), 0.860)
     self.assertEqual(self.vs.mmo(10000), 0.845)
     self.assertEqual(self.vs.mmo(20000), 0.830)
     self.assertEqual(self.vs.mmo(30000), 0.815)
     self.assertEqual(self.vs.mmo(40000), 0.800)
     # Test where altitude argument is a masked array:
     altitude = np.ma.arange(0, 50, 10) * 1000
     altitude[2] = np.ma.masked
     mmo = np.ma.arange(860, 785, -15) / 1000.0
     mmo[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.mmo(altitude), mmo)
 def test__mmo__stepped(self):
     self.vs.tables['mmo'] = {
         'altitude': (0, 20000, 20000, 40000),
         'speed': (0.850, 0.850, 0.800, 0.800),
     }
     # Test where altitude argument is a single value:
     self.assertEqual(self.vs.mmo(00000), 0.850)
     self.assertEqual(self.vs.mmo(19999), 0.850)
     self.assertEqual(self.vs.mmo(20000), 0.800)
     self.assertEqual(self.vs.mmo(20001), 0.800)
     self.assertEqual(self.vs.mmo(40000), 0.800)
     # Test where altitude argument is a masked array:
     altitude = np.ma.arange(0, 50, 10) * 1000
     altitude[2] = np.ma.masked
     mmo = np.ma.array([0.850] * 2 + [0.800] * 3)
     mmo[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.mmo(altitude), mmo)
 def test__v2(self):
     # Test where weight argument is a single value:
     self.assertEquals(self.vs.v2('5', 165000), 164)
     self.assertEquals(self.vs.v2('15', 120000), 134)
     self.assertEquals(self.vs.v2('20', 145000), 142)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(120, 130, 2) * 1000
     weight[2] = np.ma.masked
     v2_05 = np.ma.array((139, 140, 141, 143, 144))
     v2_15 = np.ma.array((134, 135, 136, 137, 138))
     v2_20 = np.ma.array((129, 130, 131, 132, 133))
     v2_05[2] = np.ma.masked
     v2_15[2] = np.ma.masked
     v2_20[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.v2('5', weight), v2_05)
     ma_test.assert_masked_array_equal(self.vs.v2('15', weight), v2_15)
     ma_test.assert_masked_array_equal(self.vs.v2('20', weight), v2_20)
 def test__v2(self):
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.v2('5', 165000), 164)
     self.assertEqual(self.vs.v2('15', 120000), 134)
     self.assertEqual(self.vs.v2('20', 145000), 142)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(120, 130, 2) * 1000
     weight[2] = np.ma.masked
     v2_05 = np.ma.array((139, 140, 141, 143, 144))
     v2_15 = np.ma.array((134, 135, 136, 137, 138))
     v2_20 = np.ma.array((129, 130, 131, 132, 133))
     v2_05[2] = np.ma.masked
     v2_15[2] = np.ma.masked
     v2_20[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.v2('5', weight), v2_05)
     ma_test.assert_masked_array_equal(self.vs.v2('15', weight), v2_15)
     ma_test.assert_masked_array_equal(self.vs.v2('20', weight), v2_20)
 def test__vapp(self):
     # Test where weight argument is a single value:
     self.assertEquals(self.vs.vapp('5', 120000), 128)
     self.assertEquals(self.vs.vapp('15', 120000), 122)
     self.assertEquals(self.vs.vapp('20', 145000), 132)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(120, 130, 2) * 1000
     weight[2] = np.ma.masked
     vapp_05 = np.ma.array((128, 129, 130, 132, 133))
     vapp_15 = np.ma.array((122, 123, 125, 126, 128))
     vapp_20 = np.ma.array((118, 119, 120, 122, 123))
     vapp_05[2] = np.ma.masked
     vapp_15[2] = np.ma.masked
     vapp_20[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.vapp('5', weight), vapp_05)
     ma_test.assert_masked_array_equal(self.vs.vapp('15', weight), vapp_15)
     ma_test.assert_masked_array_equal(self.vs.vapp('20', weight), vapp_20)
 def test__vapp(self):
     # Test where weight argument is a single value:
     self.assertEqual(self.vs.vapp('5', 120000), 128)
     self.assertEqual(self.vs.vapp('15', 120000), 122)
     self.assertEqual(self.vs.vapp('20', 145000), 132)
     # Test where weight argument is a masked array:
     weight = np.ma.arange(120, 130, 2) * 1000
     weight[2] = np.ma.masked
     vapp_05 = np.ma.array((128, 129, 130, 132, 133))
     vapp_15 = np.ma.array((122, 123, 125, 126, 128))
     vapp_20 = np.ma.array((118, 119, 120, 122, 123))
     vapp_05[2] = np.ma.masked
     vapp_15[2] = np.ma.masked
     vapp_20[2] = np.ma.masked
     ma_test.assert_masked_array_equal(self.vs.vapp('5', weight), vapp_05)
     ma_test.assert_masked_array_equal(self.vs.vapp('15', weight), vapp_15)
     ma_test.assert_masked_array_equal(self.vs.vapp('20', weight), vapp_20)