Skip to content

Commit b2619ad

Browse files
committed
New test for h5ex_d.
1 parent f99583e commit b2619ad

33 files changed

Lines changed: 598 additions & 2400 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ hdf5/*/*.h5
4040
/bouml/
4141
/src/main/resources/h5ex_t/*.h5
4242
/src/main/resources/h5ex_t/att/*.h5
43+
/src/main/resources/h5ex_tutr/*.h5
44+
/src/main/resources/h5ex_d/*.h5
45+
/src/main/resources/h5ex_d/*.data

Read File Flow.mmd

Lines changed: 0 additions & 18 deletions
This file was deleted.

Read File Flow.png

-425 KB
Binary file not shown.

hdf5/notes.txt

Lines changed: 22 additions & 2363 deletions
Large diffs are not rendered by default.

src/main/java/org/hdf5javalib/dataclass/HdfFixedPoint.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public byte[] getBytes() {
124124
* @return true if the value is undefined, false otherwise
125125
*/
126126
public boolean isUndefined() {
127+
if (datatype.isSigned()) return false;
127128
for (byte b : bytes) {
128129
if (b != (byte) 0xFF) {
129130
return false;

src/main/java/org/hdf5javalib/examples/HDF5Examples/ArrayAttributeRead.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
package org.hdf5javalib.examples.HDF5Examples;
22

3-
import org.hdf5javalib.dataclass.HdfData;
43
import org.hdf5javalib.datasource.TypedDataSource;
54
import org.hdf5javalib.hdfjava.HdfDataset;
65
import org.hdf5javalib.hdfjava.HdfFileReader;
7-
import org.hdf5javalib.utils.HdfDataHolder;
86

97
import java.nio.channels.SeekableByteChannel;
108
import java.nio.file.Files;
119
import java.nio.file.Path;
1210
import java.nio.file.StandardOpenOption;
13-
import java.util.Arrays;
1411

1512
import static org.hdf5javalib.utils.HdfDisplayUtils.displayAttributes;
1613
import static org.hdf5javalib.utils.HdfReadUtils.getResourcePath;

src/main/java/org/hdf5javalib/examples/HDF5Examples/ExamplesRead.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
package org.hdf5javalib.examples.HDF5Examples;
22

33
import org.hdf5javalib.datasource.TypedDataSource;
4-
import org.hdf5javalib.hdfjava.HdfDataset;
5-
import org.hdf5javalib.hdfjava.HdfFileReader;
64

75
import java.io.IOException;
86
import java.net.URISyntaxException;
9-
import java.nio.channels.SeekableByteChannel;
107
import java.nio.file.Files;
118
import java.nio.file.Path;
129
import java.nio.file.Paths;
13-
import java.nio.file.StandardOpenOption;
1410

15-
import static org.hdf5javalib.utils.HdfDisplayUtils.displayData;
1611
import static org.hdf5javalib.utils.HdfDisplayUtils.displayFile;
1712

1813
/**
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package org.hdf5javalib.examples.h5ex_d;
2+
3+
import org.hdf5javalib.datasource.TypedDataSource;
4+
5+
import java.io.IOException;
6+
import java.net.URISyntaxException;
7+
import java.nio.file.Files;
8+
import java.nio.file.Path;
9+
import java.nio.file.Paths;
10+
import java.util.Objects;
11+
import java.util.stream.Stream;
12+
13+
import static org.hdf5javalib.utils.HdfDisplayUtils.displayFile;
14+
15+
/**
16+
* Demonstrates reading and processing compound data from an HDF5 file.
17+
* <p>
18+
* The {@code CompoundRead} class serves as an example application that reads
19+
* a compound dataset from an HDF5 file, processes it using a {@link TypedDataSource},
20+
* and displays the results. It showcases filtering and mapping operations on the
21+
* dataset, as well as conversion to a custom Java class.
22+
* </p>
23+
*/
24+
public class h5ex_d_read {
25+
/**
26+
* Entry point for the application.
27+
*
28+
* @param args command-line arguments (not used)
29+
*/
30+
public static void main(String[] args) {
31+
new h5ex_d_read().run();
32+
}
33+
34+
/**
35+
* Executes the main logic of reading and displaying compound data from an HDF5 file.
36+
*/
37+
private void run() {
38+
try {
39+
// List all .h5 files in HDF5Examples resources directory
40+
Path dirPath = Paths.get(Objects.requireNonNull(h5ex_d_read.class.getClassLoader().getResource("h5ex_d")).toURI());
41+
try ( Stream<Path> streamList = Files.list(dirPath) ) {
42+
streamList.filter(p -> p.toString().endsWith(".h5"))
43+
.forEach(p -> {
44+
System.out.println("Running " + p.getFileName());
45+
displayFile(p);
46+
});
47+
48+
}
49+
} catch (URISyntaxException | IOException e) {
50+
throw new RuntimeException(e);
51+
}
52+
}
53+
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package org.hdf5javalib.examples.h5ex_tutr.h5ex_d;
2+
3+
import org.hdf5javalib.datasource.TypedDataSource;
4+
5+
import java.io.IOException;
6+
import java.net.URISyntaxException;
7+
import java.nio.file.Files;
8+
import java.nio.file.Path;
9+
import java.nio.file.Paths;
10+
import java.util.Objects;
11+
import java.util.stream.Stream;
12+
13+
import static org.hdf5javalib.utils.HdfDisplayUtils.displayFile;
14+
15+
/**
16+
* Demonstrates reading and processing compound data from an HDF5 file.
17+
* <p>
18+
* The {@code CompoundRead} class serves as an example application that reads
19+
* a compound dataset from an HDF5 file, processes it using a {@link TypedDataSource},
20+
* and displays the results. It showcases filtering and mapping operations on the
21+
* dataset, as well as conversion to a custom Java class.
22+
* </p>
23+
*/
24+
public class h5ex_tutr_read {
25+
/**
26+
* Entry point for the application.
27+
*
28+
* @param args command-line arguments (not used)
29+
*/
30+
public static void main(String[] args) {
31+
new h5ex_tutr_read().run();
32+
}
33+
34+
/**
35+
* Executes the main logic of reading and displaying compound data from an HDF5 file.
36+
*/
37+
private void run() {
38+
try {
39+
// List all .h5 files in HDF5Examples resources directory
40+
Path dirPath = Paths.get(Objects.requireNonNull(h5ex_tutr_read.class.getClassLoader().getResource("h5ex_tutr")).toURI());
41+
try ( Stream<Path> streamList = Files.list(dirPath) ) {
42+
streamList.filter(p -> p.toString().endsWith(".h5"))
43+
.forEach(p -> {
44+
System.out.println("Running " + p.getFileName());
45+
displayFile(p);
46+
});
47+
48+
}
49+
} catch (URISyntaxException | IOException e) {
50+
throw new RuntimeException(e);
51+
}
52+
}
53+
54+
}

src/main/java/org/hdf5javalib/hdffile/dataobjects/messages/DataLayoutMessage.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.hdf5javalib.hdffile.infrastructure.HdfBTreeV1;
88
import org.hdf5javalib.hdffile.infrastructure.HdfChunkBTreeEntry;
99
import org.hdf5javalib.hdfjava.HdfDataFile;
10+
import org.hdf5javalib.utils.HdfDisplayUtils;
1011
import org.hdf5javalib.utils.HdfReadUtils;
1112
import org.hdf5javalib.utils.HdfWriteUtils;
1213

@@ -414,8 +415,8 @@ public HdfFixedPoint getDataSize() {
414415
@Override
415416
public String toString() {
416417
return "ContiguousStorage{" +
417-
", address=" + dataAddress +
418-
", elementSize=" + dataSize +
418+
", address=" + (dataAddress.isUndefined()? HdfDisplayUtils.UNDEFINED :dataAddress) +
419+
", dataSize=" + (dataSize.isUndefined()?HdfDisplayUtils.UNDEFINED:dataSize) +
419420
'}';
420421
}
421422

0 commit comments

Comments
 (0)