NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
I have two Netcdf-4 files. Both are for the same region and same time interval. The first contains two variables U and V. The second variables S and T. I need to generate third Netcdf-4 file with four variables U, V, S, T. I had an idea to make copy of the first file and add additional variables to the copy. What i did: - NetcdfFile fileUV = NetcdfFiles.open(fnameUV); // file with U and V - NetcdfFile fileST = NetcdfFiles.open(fnameST); // file with S and T - Nc4Chunking chunker = Nc4ChunkingStrategy.factory(type, deflateLevel, shuffle); - NetcdfFormatWriter.Builder builder = NetcdfFormatWriter.createNewNetcdf4(NetcdfFileFormat.NETCDF4, outName, chunker); - NetcdfCopier copier = NetcdfCopier.create(fileUV, builder); // copier UV-file -> outfile - NetcdfFile ncfileOut = copier.write(null); // do copy - NetcdfFormatWriter writer = builder.build(); - ImmutableList<Variable> vST = fileST.getVariables(); // variables S and T - for(var v : vST) writer.write(v, null); // add vriables to outfile String 7 generates the exception java.lang.IllegalStateException: Group was already built. May be it is impossible to use the same builder for copying and adding variables? Could anyone help me to solve my task correctly? Thanks in advance Andreas Lieta
netcdf-java
archives: