Exemple #1
0
    def test_set_timeseries(self, all_winds):
        """
        get_timeseries with default output format
        """

        # check get_time_value()

        wm = Wind(timeseries=all_winds['wind'].get_timeseries(),
                  format='r-theta', units='meter per second')
        gtime_val = wm.get_timeseries()
        x = gtime_val[:2]
        x['value'] = [(1, 10), (2, 20)]

        wm.set_timeseries(x, 'meter per second')  # default format is 'r-theta'

        assert np.allclose(wm.get_timeseries()['value'][:, 0], x['value'
                           ][:, 0], atol, rtol)  # only matches to 10^-14
        assert np.all(wm.get_timeseries()['time'] == x['time'])
Exemple #2
0
            20,
            10 + i,
            30,
            ) for i in range(len(dtv_rq) - 1)]
        Wind(timeseries=dtv_rq, units='meter per second')

    # exception raised since no units given for timeseries during init

    with pytest.raises(TypeError):
        Wind(timeseries=dtv)

    # no units during set_timeseries

    with pytest.raises(TypeError):
        wind = Wind(timeseries=dtv, units='meter per second')
        wind.set_timeseries(dtv)

    # invalid units

    with pytest.raises(unit_conversion.InvalidUnitError):
        wind = Wind(timeseries=dtv, units='met per second')


def test_read_file_init():
    """
    initialize from a long wind file
    """

    wm = Wind(filename=wind_file)
    print
    print '----------------------------------'