Пример #1
0
            public void ResizeDatasetChecksRank(long[] new_dims)
            {
                using (var container = new TempH5FileContainer())
                {
                    H5Group ROOT = container.Content().Root;

                    int rank    = 2;
                    var dims    = new long[] { 2, 3 };
                    var maxdims = new long[] { 5, 6 };

                    using (H5DataSet DSET = ROOT.CreateDataset("resizable", rank, dims, typeof(double), maxdims))
                    {
                        Assert.NotNull(DSET);
                        Assert.Equal(dims, DSET.Dims);

                        if (H5Library.LibVersion == "1.8.12")
                        {
                            Assert.NotEqual(maxdims, DSET.MaxDims);
                            Assert.Equal(dims, DSET.MaxDims);
                            Assert.Throws <NotImplementedException>(() => DSET.Resize(maxdims));
                        }
                        else
                        {
                            Assert.Throws <RankException>(() => DSET.Resize(new_dims));
                        }
                    }
                }
            }
Пример #2
0
            public void LocateDatasetWith2DProperties(string key)
            {
                using (H5File hf = H5File.Open(demodata + "test_link_exists.h5", mode: "r"))
                {
                    H5DataSet dset = hf.Root[key];

                    Assert.Equal(2, dset.Rank);
                    Assert.Equal(49L, dset.Length);
                    Assert.Equal(new long[] { 7, 7 }, dset.Dims);
                }
            }
Пример #3
0
            public void LocateDataset()
            {
                using (H5File hf = H5File.Open(demodata + "test_link_exists.h5", mode: "r"))
                {
                    H5DataSet dset = hf.Root["level1/dset1"];
                    Assert.NotNull(dset);

                    H5DataSet dset_clone = hf.Root.SubGroup("level1")["dset1"];
                    Assert.NotNull(dset_clone);

                    H5DataSet dset_link = hf.Root["level1/level2/dset1_link"];
                    Assert.NotNull(dset_link);
                }
            }
Пример #4
0
            public void Properties()
            {
                using (H5File hf = H5File.Open(testfile, mode: "r"))
                {
                    H5DataSet DSET = hf.Root["datasets/float2d"];

                    Assert.NotNull(DSET);

                    Assert.Equal(2, DSET.Rank);
                    Assert.Equal(Edge, DSET.Dims[0]);
                    Assert.Equal(Edge, DSET.Dims[1]);
                    Assert.Equal(Edge, DSET.MaxDims[0]);
                    Assert.Equal(Edge, DSET.MaxDims[1]);
                    Assert.Equal(Square, DSET.Length);
                    Assert.Equal(typeof(float), DSET.PrimitiveType);

                    DSET.Dispose();
                }
            }