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.
Thanks for your response. Sorry I've taken so long to reply but I had to leave town unexpectedly. I tried your suggestion of not setting the length of the unlimited dimension but I still get the same exception. Below, you ask " how do you know its not calling UnlimitedDimension.equals() ?" I actually put a breakpoint into DimensionDictionary.put and then stepped into equals and I get the equals in Dimension not UnlimitedDimension. Does this give you any clues as to what I might be doing wrong? oz On Fri, 10 Mar 2000, John Caron wrote: > > > I'm reading a netCDF file using the Java version of netCDF. This file has > > an unlimited time dimension. I am reading the file into my own data > > structures and then turming around and creating and writing a new netCDF > > file. For lots of my files (mostly PMEL EPIC files), I'm able to fully > > reproduce the structure and data of my input files. However, I'm stymied > > by trying to set the time axis as an unlimited axis. When I explicitly > > set the dimension to an instance of UnlimitedDimension an > > IllegalArgumentException (Duplicate dimension name) is thrown from put in > > DimensionDictionary when I try to create the ProtoVariable. This > > exception is thrown because the line: > > > > if(found.equals(dim)) > > > > is returning false. It seem odd that the "equals" method called is in the > > Dimension class not in the override "equals" method in the > > UnlimitedDimension class. > > how do you know its not calling UnlimitedDimension.equals() ? > > if in fact it is, that would probably explain the Exception, since its > comparing lengths as well as the name, and so the problem would come > down to finding why it was calling Dimension.equals() instead of > UnlimitedDimension.equals(). this assumes that the names are indeed the > same (have you verified that?) > > Im also surprised that you can call setLength() on an > UnlimitedDimension. The length should only be determined by the actuall > writes to the file. The comment in the code says "should be pakage > private, so I suspect you shouldnt be calling it. you could quickly try > rerunning without that call. >