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

Re: 20040414: Attribute modification in Java2.1 NetCDF API



Steve Loch wrote:

John,

I think I was overly brief in my query. If the attribute doesn't
require additional space then it should, in my view, be possible to
update the file without regenerating from scratch. [I have always been
surprised that the APIs (or rather the part of the NetCDF APIs that are
documented for public consumption) don't allow the addition of free
space within the header at definition time which would ameliorate the
problem. Perhaps it's the complexities of garbage collection that led to
the simpler choice.]

i completely agree. the reason the java API doesnt allow it was a design agrument about immutability, by the implementor of the version 1 library (ucar.netcdf). the 2.1 version still depends on that for the actual reading of the file, and so cant allow it either. the 2.2 version will replace that code, and at that point will allow attribute modification.


If required the other language APIs will rewrite the file as and when
needed but in a manner which is largely transparent to the user.

the transparency can be problematic. i would probably design the API so that the user optionally can be notified, and possibly even veto, a change requiring a file rewrite. also, there would be a way to specify extra room in a file when the file is being written, when you know that you will be doing that.


In the BODC applications the attributes are normally fixed in size but,
inter alia, represent summary information and need to be updated.
Because of the immediacy of our requirements I'll need to hack the
source code as a temporary expedient. I have done this once before, for
other reasons,  with the C library (finding the address of the attribute
within the file) . Any hints (or code) gratefully accepted.

im afraid i dont have much guidance at this point, because i didnt write that code. good luck..


Regards, Steve Loch
BODC
http://www.bodc.ac.uk
Is there any prospect of a later release permitting the update of the
attributes within a NetCDF file without having to regenerate the
complete file?

The APIs I have used to date including Fortran, C and Matlab don't
have
this restriction.

Steve Loch
British Oceanographic Dta Centre




we will support attribute modification in the next version of netcdf-java (2.2), which may be ready by end of year (?)

as to whether that can be done without rewriting the file depends on
the file; we are constrained by the version 1 file format. what would you need in that regard?

netcdf-4 (on top of HDF5) should be able to modify attributes without rewriting entire file.