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

Re: 20000127: modify an existing file, JAVA NetCDF (2 parts)



>To: address@hidden
>cc: address@hidden
>From: Nicole Chevalier <address@hidden>
>Subject: modify an existing file
>Organization: .
>Keywords: 200001271252.FAA16910

Hi Nicole,

> How can i add (or delete) a new variable in an existing file ?
> 
> To day
> 1/ i read the schema, all the variables and values
> 2/ i modify
> 3/ i create a new file
> 
> Is there any better solution ?

No, sorry, there's no better way with the Java interface.

With the C interface, it's possible when you create the file to
specify that some extra space should be reserved in the file header
(that contains the schema) so that later addition of a non-record
variable or dimension or attribute will not require copying all the
data.  This is done with the nc__enddef() function in C using the
"minfree" parameter:

     int nc__endef(int ncid, size_t  h_minfree,  size_t  v_align,
          size_t v_minfree, size_t r_align)
     ...

          The minfree parameters allow one to  control  costs  of
          future  calls  to nc_redef(), nc_enddef() by requesting
          that minfree bytes be available at the end of the  sec-
          tion.   The h_minfree parameter sets the pad at the end
          of the "header" section. The v_minfree  parameter  sets
          the  pad  at the end of the data section for fixed size
          variables.

but I don't there is any access to this functionality from the Java
interface.  And there is nothing in either interface that supports
deleting a variable from an existing netCDF file without creating a
new file and copying the data of all the other variables.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu