Re: [netcdfgroup] Fast interconversion between netCDF4 and netCDF-classic

Hi Aidan,

The only difference between a netCDF-4 file that uses only classic model
features and the equivalent netcdf-4 classic model file is the addition of
a global attribute named "_nc3_strict" in the root group, which is hidden
by the netCDF API, but is read when the file is later opened, and used to
ensure that no enhanced model features are written to the file.

Hence it is easy to efficiently mass convert files from netCDF-4 to
netCDF-4 classic model using a small program, although it's not
particularly safe. If you only add the extra attribute, without actually
checking that the file uses no enhanced netCDF-4 features such as groups,
strings, unsigned integer types, or user-defined types, you will end up
with a hybrid file that disguises itself as an innocent classic model file,
but is something different beneath its unassuming secret identity.

It's an optimization that the nccopy utility should be able to do safely,
however. The nccopy could add the extra attribute safely *after* checking
that the input file really doesn't violate the characteristics of the
classic data model, without copying (or even reading) any data. This seems
like a useful optimization, so we'll put it on our list. Thanks for the
suggestion!

--Russ


On Tue, Feb 17, 2015 at 5:58 PM, Aidan Heerdegen <aidan.heerdegen@xxxxxxxxxx
> wrote:

> Hi,
>
> We’ve got a LOT of data in netCDF4 format that we think, for a few reasons,
> we would probably like in netCDF4 Classic Model format.
>
> The data itself does not require any of the added features of netCDF4.
>
> Converting it all with nccopy would take a very very long time. I have a
> suspicion that under the hood there will be very little different between
> the files. I’ve done a test with a 400Mb test file, there are only 168
> bytes
> different between the netcdf4 and netcdf4-classic versions of the data.
>
> Is there a smart/fast/safe way to convert netCDF4 data “in-place” to
> netCDF4-classic?
>
> Thanks
>
> Aidan
>
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe,  visit:
> http://www.unidata.ucar.edu/mailing_lists/
>
>
  • 2015 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: