Re: [netcdfgroup] API for removing data variables?

Tom Roche Sat, Feb 4, 2012 at 4:51 PM
>> I have a usecase which seems most easily satisfied by taking a
>> netCDF (classic) file and ripping out all but one data variable,
>> before adding a few layers to that datavar, and writing to a new
>> file. (All the data variables share the same coordinate variables
>> and their values, which are just integer indices.)

I should add that the files on which I'm working have considerable
metadata attributes, at both variable and global levels.

David William Pierce Sat, 4 Feb 2012 20:17:02 -0800
> Maybe it would be easier if you conceptualize the task instead as
> one of copying only a subset (one) variable from the source file to
> the destination file?

The task is *feasible* if so conceptualized, and in fact I'm so doing
it (and with ncdf4, surprisingly enough :-) But that requires one

ncdf4.pdf (formatted by me)
>>> to WRITE data to a new netCDF file, the procedure is to

>>> 1 define the dimensions your data array has

>>> 2 define the [data] variable

>>> 3 create the file.

plus copy the data to the variable, plus copy additional attributes.
Which a priori feels more difficult than

1 copy the file using system tools (e.g., `cp`)
2 remove undesired data variables from the copy

I anticipate how netCDF variable deletion might be difficult to
implement, and would appreciate explanations regarding exactly why.
But, frankly, from the user side, for the usecase above, I'm just
not "feeling the ease" from the presently-required procedure.

FWIW, Tom Roche <Tom_Roche@xxxxxxxxx>



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