コード例 #1
0
def test_numpy_timelike_column_with_null(dsn, configuration):
    fill_value = 0;

    with open_cursor(configuration) as cursor:
        with query_fixture(cursor, configuration, 'INSERT TIMESTAMP') as table_name:
            cursor.execute('INSERT INTO {} VALUES (?)'.format(table_name), [None])
            cursor.execute('SELECT a FROM {}'.format(table_name))
            results = cursor.fetchallnumpy()
            expected = MaskedArray([42], mask=[1], dtype='datetime64[us]')
            assert_equal(results[_fix_case(configuration, 'a')].filled(fill_value),
                         expected.filled(fill_value))
コード例 #2
0
def test_numpy_timelike_column_with_null(dsn, configuration):
    fill_value = 0;

    with open_cursor(configuration) as cursor:
        with query_fixture(cursor, configuration, 'INSERT TIMESTAMP') as table_name:
            cursor.execute('INSERT INTO {} VALUES (?)'.format(table_name), [None])
            cursor.execute('SELECT a FROM {}'.format(table_name))
            results = cursor.fetchallnumpy()
            expected = MaskedArray([42], mask=[1], dtype='datetime64[us]')
            assert_equal(results[_fix_case(configuration, 'a')].filled(fill_value),
                         expected.filled(fill_value))
コード例 #3
0
def test_numpy_timelike_column_with_null(dsn, configuration):
    fill_value = 0

    with open_cursor(configuration) as cursor:
        with query_fixture(cursor, configuration,
                           "INSERT TIMESTAMP") as table_name:
            cursor.execute(f"INSERT INTO {table_name} VALUES (?)", [None])
            cursor.execute(f"SELECT a FROM {table_name}")
            results = cursor.fetchallnumpy()
            expected = MaskedArray([42], mask=[1], dtype="datetime64[us]")
            assert_equal(
                results[_fix_case(configuration, "a")].filled(fill_value),
                expected.filled(fill_value),
            )
コード例 #4
0
def _plot_bar_data(ax, data: ma.MaskedArray, time: ndarray):
    """Plots 1D variable as bar plot.

    Args:
        ax (obj): Axes object.
        data (maskedArray): 1D data array.
        time (ndarray): 1D time array.

    """
    # TODO: unit change somewhere else
    ax.plot(time, data / 1000, color="navy")
    ax.bar(time,
           data.filled(0) / 1000,
           width=1 / 120,
           align="center",
           alpha=0.5,
           color="royalblue")
    pos = ax.get_position()
    ax.set_position([pos.x0, pos.y0, pos.width * 0.965, pos.height])