def test_vtrans_pass(self):
        """Test _vtrans function. Compare to MATLAB reference."""
        tc_track = TCTracks.from_processed_ibtracs_csv(TEST_TRACK)
        tc_track.equal_timestep()

        v_trans, _ = _vtrans(tc_track.data[0].lat.values,
                             tc_track.data[0].lon.values,
                             tc_track.data[0].time_step.values)

        to_kn = (1.0 * ureg.meter / ureg.second).to(ureg.knot).magnitude

        self.assertEqual(v_trans.size, tc_track.data[0].time.size)
        self.assertEqual(v_trans[0], 0)
        self.assertAlmostEqual(v_trans[1] * to_kn, 10.191466246)
Exemple #2
0
    def test_vtrans_pass(self):
        """ Test _vtrans function. Compare to MATLAB reference."""
        ureg = UnitRegistry()
        i_node = 1
        tc_track = TCTracks()
        tc_track.read_processed_ibtracs_csv(TEST_TRACK)
        tc_track.equal_timestep()

        v_trans = tc._vtrans(tc_track.data[0].lat.values, tc_track.data[0].lon.values,
                tc_track.data[0].time_step.values, ureg)

        to_kn = (1* ureg.meter / ureg.second).to(ureg.knot).magnitude

        self.assertEqual(v_trans.size, tc_track.data[0].time.size-1)
        self.assertAlmostEqual(v_trans[i_node-1]*to_kn, 10.191466256012880)