Ejemplo n.º 1
0
    def test_combine_along_y(self, tmpdir_factory, bout_xyt_example_files):
        path = bout_xyt_example_files(tmpdir_factory, nxpe=1, nype=3, nt=1,
                                      syn_data_type='stepped')
        actual, metadata = _auto_open_mfboutdataset(datapath=path)

        bout_ds = create_bout_ds
        expected = concat([bout_ds(0), bout_ds(1), bout_ds(2)], dim='y')
        xrt.assert_equal(actual.load(), expected.drop(METADATA_VARS))
Ejemplo n.º 2
0
    def test_combine_along_xy(self, tmpdir_factory, bout_xyt_example_files):
        path = bout_xyt_example_files(tmpdir_factory, nxpe=4, nype=3, nt=1,
                                      syn_data_type='stepped')
        actual, metadata = _auto_open_mfboutdataset(datapath=path)

        bout_ds = create_bout_ds
        line1 = concat([bout_ds(0), bout_ds(1), bout_ds(2), bout_ds(3)], dim='x')
        line2 = concat([bout_ds(4), bout_ds(5), bout_ds(6), bout_ds(7)], dim='x')
        line3 = concat([bout_ds(8), bout_ds(9), bout_ds(10), bout_ds(11)], dim='x')
        expected = concat([line1, line2, line3], dim='y')
        xrt.assert_equal(actual.load(), expected.drop(METADATA_VARS))
Ejemplo n.º 3
0
    def test_multiple_files_along_x(self):
        var = 'n'
        expected = collect(var,
                           path='./tests/data/dump_files/',
                           prefix='BOUT.dmp',
                           xguards=False)

        ds, metadata = _auto_open_mfboutdataset(
            './tests/data/dump_files/BOUT.dmp.*.nc')
        actual = ds[var].values

        assert expected.shape == actual.shape
        npt.assert_equal(actual, expected)
Ejemplo n.º 4
0
    def test_single_file(self):
        var = 'n'
        expected = collect(var,
                           path='./tests/data/dump_files/single',
                           prefix='equilibrium',
                           xguards=False)

        ds, metadata = _auto_open_mfboutdataset(
            './tests/data/dump_files/single/equilibrium.nc')
        print(ds)
        actual = ds[var].values

        assert expected.shape == actual.shape
        npt.assert_equal(actual, expected)
Ejemplo n.º 5
0
 def test_single_file(self, tmpdir_factory, bout_xyt_example_files):
     path = bout_xyt_example_files(tmpdir_factory, nxpe=1, nype=1, nt=1)
     actual, metadata = _auto_open_mfboutdataset(datapath=path)
     expected = create_bout_ds()
     xrt.assert_equal(actual.load(), expected.drop(METADATA_VARS))