This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
> John, > What I am trying to do is incrementally create a netcdf file. I am > getting my data from a network call and I don't know all the variables > or sizes at the beginning. I could read through all the data > twice, but > since this is over a network it would be very inefficient. So > what I am > trying to is create an netcdffile with a empty schema and then > incrementally > add protovariables and data. Can I do this at all? How? > I had failed to note that the add function is private so I > can't use it. > Thanks. Hmmm, unfortunately, the Java netcdf API doesnt allow you to incrementally update the Schema; the Schema in a NetcdfFile is considered immutable. Kinda lame, but I think thats the way it is. You could 1) read the data twice, accumulating the scheme on the first pass, or 2) write seperate files for each Variable, then merge at the end. Probably some other options, but you can probably figure them out based on your situation.