Heiko Klein wrote:
192050
I just found the problem, and it was in my own source:
My copy function did the following:
List<Variable> variables = ncIn.getRootGroup().getVariables();
for (Variable var : variables) {
// copy dims and attributes
ncOut.addVariable(ncOut.getRootGroup(), var);
}
ncOut.create();
for (Variable var : variables) {
try {
ncOut.write(var.getName(), var.read());
} catch (InvalidRangeException ire) {
throw new IOException(ire.toString());
}
}
ncOut.flush();
The line 'ncOut.addVariable(ncOut.getRootGroup(), var)' modified the
variable which got read afterwards. Modifying this line to
Variable outVar = new Variable(var);
ncOut.getRootGroup().addVariable(outVar);
solved the problem.
Sorry for bothering you with a self-generated error.
Best regards
No problem.
You may want to look at or use ucar.nc2.FileWriter.java for these purposes.
John