Next: , Previous: , Up: Utility programs   [Index]


ncoffsets

ncoffsets prints the file offsets of variables defined in a given netCDF file. The print order is fixed-size variables first followed by record variables. The ending offsets reported are exclusive offsets, i.e. 1 byte more than the last byte occupied by the variable. In other words, the ending offset is equal to the sum of starting offset and the variable size. For record variables, only the offsets of first record are printed. Adding option -r prints the offsets of all records.

If no argument is given, command usage information is printed.

Note this utility checks only the file header and does not report any file offset violation against the CDF file format specifications. For validating a given netCDF file, use utility ncvalidator.

Synopsis

ncoffsets [-h] | [-x] | [-sgr] [-v var1[,...]]  file

Command-line Options

-v var1[,...]

The output include starting file offsets for the specified variables. One or more variables must be specified by names in a comma-delimited list following this option. The list must be a single argument to the command, hence cannot contain blanks or other white space characters. The named variables must be valid netCDF variables defined in the input file. The default, without this option is to print the starting offsets for all variables.

-s

Print the variable size in bytes. For record variables, only the size of one record is printed.

-g

Print the gap in bytes of a variable’s starting offset from its immediately previous variable. For the first defined variable, print the gap from the end of file header. For record variables, there is no gap between records.

-r

Output the offset information for all records of the selected record variables. Without this option, only the offsets of first record are printed.

-x

Check all fixed-size variable for file space gaps in between any two immediately adjacent variables. It prints "1" on stdout if gaps are found, "0" for otherwise. This option disables all other options.

-h

Print the available command-line options

Example

Print the file offset information for all variables in a netCDF file.

% ncoffsets -sg testfile.nc
netcdf test_double.nc {
//file format: CDF-1

file header:
        size   = 340 bytes
        extent = 340 bytes

dimensions:
        x = 100
        y = 100
        z = 100
        time = UNLIMITED // (100 currently)

fixed-size variables:
        double square(x, y):
               start file offset =         340
               end   file offset =       80340
               size in bytes     =       80000
               gap from prev var =           0
        double cube(x, y, z):
               start file offset =       80340
               end   file offset =     8080340
               size in bytes     =     8000000
               gap from prev var =           0

record variables:
        double time(time):
               start file offset =     8080340    (record 0)
               end   file offset =     8081140    (record 0)
               size in bytes     =           8    (of one record)
               gap from prev var =           0
        double xytime(time, x, y):
               start file offset =     8080348    (record 0)
               end   file offset =    16080348    (record 0)
               size in bytes     =       80000    (of one record)
               gap from prev var =           0
}

Check if there are gaps in between two adjacent fixed-size variables.

% ncoffsets -x testfile.nc
0

Next: , Previous: , Up: Utility programs   [Index]