Re: 20000310: trouble with unlimited dimensions in Java netCDF

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


  • 2000 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: