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.
> >> I didn't (and still don't) see how ArrayAbstract relates to a > >> nc2 Variable. Can you enlighten me? ;-) > > > >sorry: you do a Variable.read() to get an Array, which you cast to an > >AbstractArray. > > This doesn't seem intuitively obvious. I understand your comments about > different ways of implementing Array, but looking over the javadocs, it > doesn't say anywhere that Variable is implemented with an AbstractArray > underneath. Since nc2.Variable is not an interface, then perhaps the > read should specify that it returns an AbsractArray. Otherwise, it seems > like Array should have the copyTo1DJavaArray() method. That could be > implemented regardless of the backing store. i agree that its not obvious, and i will think about these issues. there are various levels of exposing the underlying implementation. in some ways copyTo1DJavaArray() might be considered implementation, but perhaps it should be a service provided by any Array. right now, to implement these ideas, my thoughts would be to add: Object copyTo1DJavaArray(); Object copyTo1DJavaArray(Class); // type conversion i suppose it would also be nice to have Object copyToNDJavaArray(); // N = rank Object copyToNDJavaArray(Class); // type conversion Should these be added to Array or AbstractArray? As more services are added to Array, its less likely there will be any implementations other than AbstractArray. So i have to think if thats ok, and if the Array interface is still useful. Other opinions are welcome. Also, to clarify: Variable implements MultiArray: to get an Array, you must do a read(). this is an important difference in design from ucar.multiarray. given that you found out the hard way that theres a factor of 6 (or more?) i continue to think its the correct design.