Re: Matlab, NetCDF-C and NetCDF Java?

Hi Rich,

On 9/24/06, Rich Signell <rsignell@xxxxxxxx> asked:
> Could NetCDF-Java be used to mimic each function in the NetCDF-3 C API
> or are there certain functions that just can't be accomplished in the
> NetCDF Java API.  Like reentering define mode.

There are currently things you can do in the in the netCDF-3 C or
Fortran API that can't be accomplished with NetCDF Java.  Reentering
define mode is one, and another more basic example is modifying
attribute values or deleting attributes.  In netCDF Java, attributes
are considered immutable.  In fact, the file schema is considered
immutable, as the User's Guide says:

  A new NetCDF file is created with the createNew factory method. The
  structural metadata (groups, dimensions, attributes and variables)
  can only be added at creation time. Thus, when a file is first
  opened, it is in define mode where these may be added. Once create()
  is called, the dataset structure is immutable. After create() has
  been called you can then write the data values. See example in the
  Appendix.

Permitting the equivalent of define mode in which variables,
dimensions, and attributes can be added to an existing netCDF file, is
a convenience available in the C and Fortran modes.  But this
convenience comes at a cost: a user can easily cause all the data in
the file to be copied with an innocent looking operation such as
adding a variable or assigning a new value to an attribute for which
space is not available in the file header.

To make such expensive operations more visible, the Java interface
doesn't hide the underlying mechanisms.  If doing something will
require essentially copying the file, the Java interface requires that
you explicitly copy the file, so you are aware of the performance
implications of calling methods.

When we first decided to make the file schema immutable in the Java
interface, I argued on the other side, that we should exactly
duplicate all the functionality of the C interface.  But I think I've
been proven wrong, because we have gotten very few requests for
operations not permitted in the Java interface, like renaming
variables with a longer name or adding new attributes.  The single
exception is changing attribute values.  There have been enough
requests for this capability that we may add it to netCDF Java.  

(John Caron may provide corrections if I've gotten any of the details
wrong, but he's away from his email for the next week or so.)

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
russ@xxxxxxxxxxxxxxxx                     http://www.unidata.ucar.edu

==============================================================================
To unsubscribe netcdf-java, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================


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