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

Re: Fwd: Re: Using netCDF-Java to change an attribute value without rewriting the file



Ethan Davis wrote:
Changing attribute _names_ without re-writing the file?

Ethan

-------- Original Message --------
Subject: Re: Using netCDF-Java to change an attribute value without
rewriting the file
Date: Wed, 17 Feb 2010 12:27:45 -1000
From: Ted Habermann <address@hidden>
To: Ethan Davis <address@hidden>

Thanks Ethan, what about attribute names?

Ted

On Feb 17, 2010, at 11:55 AM, Ethan Davis <address@hidden>
wrote:

Hi Ted,

I just checked with John on this. The netCDF-Java library supports
changing attribute values on an existing netCDF file; there are two
situations where the file will NOT have to be rewritten:

1) The new attribute value is shorter than or equal in length to the old
attribute.

2) The netCDF file has enough padding at the end of the header section
to accommodate the extra length of the attribute value.

Otherwise, the entire file will need to be rewritten.

Ethan

on NetcdfFileWriteable:

 public Attribute renameVariableAttribute(String varName, String attName, 
String newName) {
 public Attribute renameGlobalAttribute(String oldName, String newName) {

the file must be rewritten when the header can no longer fit in the allocated 
space. One can reserve more space upon creation with

 /**
  * Set extra bytes to reserve in the header.
  * This can prevent rewriting the entire file on redefine.
  * Must be in define mode
  * @param extraHeaderBytes # bytes extra for the header
  */
 public void setExtraHeaderBytes(int extraHeaderBytes) {