in src/main/java/org/apache/sdap/ningester/datatiler/SliceFileByStepSize.java [42:64]
public List<String> generateSlices(File inputfile) throws IOException {
Map<String, Integer> dimensionNameToLength;
try (NetcdfDataset ds = NetcdfDataset.openDataset(inputfile.getAbsolutePath())) {
List<String> dimensionNames = ds.getDimensions().stream().map(Dimension::getShortName).collect(Collectors.toList());
assert dimensionNames.containsAll(dimensionToStepSize.keySet()) : String
.format("Slice by dimensions must be present in dataset. Dimensions in dataset are %s. Dimensions provided %s",
dimensionNames, dimensionToStepSize.keySet());
dimensionNameToLength = ds.getDimensions().stream()
.filter(dimension -> this.dimensionToStepSize.keySet().contains(dimension.getShortName()))
.sorted(Comparator.comparing(Dimension::getShortName, Comparator.comparingInt(dim -> this.orderedDimensions.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));
}
return generateChunkBoundrySlices(dimensionNameToLength);
}