in src/main/java/org/apache/sdap/ningester/datatiler/NetCDFItemReader.java [81:117]
public void open(ExecutionContext executionContext) throws ItemStreamException {
File netCDFFile = null;
try {
netCDFFile = this.netCDFResource.getFile();
} catch (IOException e) {
throw new ItemStreamException(e);
}
//Every time we open the file we generate the tile specs according to the given file slicer
try {
this.tileSpecList = fileSlicer.generateSlices(netCDFFile);
} catch (IOException e) {
throw new ItemStreamException(e);
}
log.debug("Generated tile specifications for {}\nINDEX\tTILE SPECIFICATION\n{}", netCDFFile.getName(),
IntStream.range(0, this.tileSpecList.size())
.mapToObj(i -> i + "\t" + this.tileSpecList.get(i))
.collect(Collectors.joining("\n")));
if (!executionContext.containsKey(CURRENT_TILE_SPEC_INDEX_KEY)) {
//Start at index 0
this.currentTileSpecIndex = 0;
executionContext.putInt(CURRENT_TILE_SPEC_INDEX_KEY, this.currentTileSpecIndex);
} else {
//Start at index location from context
this.currentTileSpecIndex = executionContext.getInt(CURRENT_TILE_SPEC_INDEX_KEY);
}
//Open the resource
try {
this.ds = NetcdfDataset.openDataset(netCDFFile.getAbsolutePath());
} catch (IOException e) {
throw new ItemStreamException(e);
}
}