def test_memmap():
    with TempDirectory() as directory:
        io = npyjson.NpyJsonIO(directory.path, memmap=True)
        original = utilities.fake_time_ordered_stream()
        name = 'stream'
        io.write(original, name)
        assert original == io.read(name)
def test_read_write_time_ordered_stream_array():
    with TempDirectory() as directory:
        filename = 'test.nc'
        io = netcdf.NetcdfIO(os.path.join(directory.path, filename))
        original = utilities.fake_time_ordered_stream()
        name = 'stream_array'
        io.write(original, name)
        assert original == io.read(name)
def test_eq_array():
    m1 = utilities.fake_time_ordered_stream()
    m2 = measurements.TimeOrderedStream(
        **dict([(k, copy.copy(v)) for k, v in m1.__dict__.items()
                if not k.startswith('_')]))
    assert m1 == m2
    index = np.random.random_integers(0, m1.data.size)
    m2.data[index] += 1
    assert m1 != m2
    m1.data[index] = m2.data[index] = np.nan
    assert m1 == m2