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

Re: NetCDF & Matlab



> Nan,
>
> We still use the mexnc stuff to write NetCDF files from Matlab.
>
> There is capability to write NetCDF files using NetCDF Java, but they
> don't have the complete functionality of the C and Fortran interfaces.
>   One show stopper for us was that you can't open an existing file (in
> redefine mode) and modify or add attributes, change variable names,
> etc.  Russ argues that you have to write the whole file anyway when
> you add an attribute, and that is true.  So I guess you could write a
> matlab wrappers that would just do that.   But that's a pain.

Actually, the netCDF C interface only has to rewrite the whole file if
you modify an attribute in a way that takes more space than is available
in the file header, so it's efficient to just change the value of an
attribute in a way that takes no more space, or only a little more space
that's available in the header.  I believe it's also possible to add an
attribute, if there is extra space in the file header, which can be
reserved when the file is created by a call to nc__enddef().

> The Unidata guys did say at one point that they wanted to have the
> full  functionality of the C interface implemented in NetCDF Java, but
> I don't know whether that's one month or two years off.

It's still not there.  In netCDF-4, the "header" info is distributed
throughout the file, so the file never has to be rewritten to accommodate
a schema change, such as addition of new attributes, dimensions, or
variables.  But the only way writing netCDF-4 files will be available
anytime soon from the netCDF Java interface is through JNI wrappers that
call the C library.  An MIT developer is working on that now, but I
don't know when it will be available ...

> I trust Russ or Sachin will correct me here if I stated things incorrectly.
>
> -Rich
>
> On Fri, May 2, 2008 at 11:48 AM, Nan Galbraith <address@hidden> wrote:
> > Hi Rich -
> >
> >  I've been perusing your recent (February? ) COFDL presentation
> >  because I'm getting ready to add NetCDF output to our real-time
> >  processing system, and our newer computers don't have NetCDF
> >  functionality yet.
> >
> >  Can you give me a quick sketch of the system you're using to write
> >  NetCDF files? I was going to download a new copy of mexcdf -
> >  or whatever the new name is - but now it looks like there's an all-Java
> >  alternative. Is that what you use for writing NetCDF?
> >
> >  The unidata netcdf-java web site is pretty confusing, more than  link
> >  that "contains everything" and has "all other jar files you might need"
> >  so  it's not quite clear what you really want/need. Checking the recent
> >  posts on the mailing list doesn't show any specific advice on this - maybe
> >  I'll email John C directly and ask for clarification... unless you know.
> >
> >  We're running on Macs now,  just to keep things interesting. If you
> >  have experience with the java library for writing NetCDF (especially
> >  on a Mac), or if you know anyone who does, could you let me know?
> >
> >  Thanks!
> >  Nan
> >
> >
> >
> >  --
> >  *******************************************************
> >  * Nan Galbraith                        (508) 289-2444 *
> >  * Upper Ocean Processes Group            Mail Stop 29 *
> >  * Woods Hole Oceanographic Institution                *
> >  * Woods Hole, MA 02543                                *
> >  *******************************************************
> >
> >
> >
>
>
>
> --
> Dr. Richard P. Signell (508) 457-2229
> USGS, 384 Woods Hole Rd.
> Woods Hole, MA 02543-1598