[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20000310: trouble with unlimited dimensions in Java netCDF



> 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.