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

[netCDF #RNO-270084]: convert 64-bit offset to classic netcdf



Hi Matthias,

> At present I am working with an IDL version which does not suppor
> thet 64-bit netcdf files. Unfortunately I can not change IDL
> version, So I was wondering if it is possible to convert from a
> 64-bit offset netcdf to a classic netcdf file? In this respect I can
> also not work with the netcdf4 format, as my IDL version doesn't
> support HDF5.

If the files you are using actually make use of the 64-bit offsets
because the variables or records are very large, then the data cannot
be easily represented in a classic netCDF file, becasue there is no
place in the file format to store offsets to the beginning of
variables that require more than 32 bits.

However, if the files and variables are actually small enough to fit
in a netCDF classic file, then there are ways to convert from a 64-bit
offset file to a netCDF classic file.

For a relatively small 64-bit offset file, say "small64.c", you can
use the ncdump and ncgen utilities to create an equivalent netCDF-3
file named "small3.nc" as follows:

  ncdump small64.nc > small64.cdl
  ncgen -o small3.nc small64.cdl

The above ncdump/ncgen method is impractical for larger files. 
In this case, any of the following can be used: 

1.  The benchmark program nc_test4/bm_file, from the netCDF-4 source
    distribution, built if you configure with --enable-benchmarks. To
    convert a large 64-bit offfset netCDF file named "large64.nc" to a
    netCDF-3 classic format file "large3.nc", use

      bm_file -o large3.nc -f 1 large64.nc

2.  If you have installed NCO 

      http://www.unidata.ucar.edu/netcdf/docs/software.html#NCO

    the NCO utility "ncks" can be used to accomplish the same tasks,
    as follows:

      ncks -a --fl_fmt=classic large64.nc large3.nc

There will be a new nccopy utility in version 4.1 of netCDF that can 
also be used, when that version is released.

--Russ

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



Ticket Details
===================
Ticket ID: RNO-270084
Department: Support netCDF
Priority: Normal
Status: Closed