in src/main/java/org/apache/sdap/ningester/datatiler/SliceFileByTilesDesired.java [45:71]
public List<String> generateSlices(File inputfile) throws IOException {
Integer timeLen = 0;
Map<String, Integer> dimensionNameToLength;
try (NetcdfDataset ds = NetcdfDataset.openDataset(inputfile.getAbsolutePath())) {
dimensionNameToLength = ds.getDimensions().stream()
.filter(dimension -> this.dimensions.contains(dimension.getShortName()))
.sorted(Comparator.comparing(Dimension::getShortName, Comparator.comparingInt(dim -> this.dimensions.indexOf(dim))))
.collect(Collectors.toMap(Dimension::getShortName, Dimension::getLength,
(v1, v2) -> {
throw new RuntimeException(String.format("Duplicate key for values %s and %s", v1, v2));
},
LinkedHashMap::new));
if (this.timeDimension != null) {
timeLen = ds.getDimensions().stream()
.filter(dimension -> this.timeDimension.equals(dimension.getShortName()))
.map(Dimension::getLength)
.collect(Collectors.toList()).get(0);
}
}
return addTimeDimension(generateChunkBoundrySlices(tilesDesired, dimensionNameToLength), timeLen);
}