ncoffsets(1)

โœจ ncoffsets(1) โ€” the PnetCDF utilities era โœจ

okay bestie, welcome to ncoffsets(1) ๐Ÿ’– this is a PnetCDF utilities girlie whose whole job is spilling the tea on where your netCDF variables actually live in the file. yes we're talking file offsets, and honestly? iconic.


๐ŸŒธ NAME ๐ŸŒธ

ncoffsets โ€” print the starting/ending file offsets for netCDF variables ๐Ÿฆ‹


๐Ÿ’… SYNOPSIS ๐Ÿ’…

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

โœจ DESCRIPTION โœจ

so like, ncoffsets prints the file offsets info of the variables defined in a given netCDF file. that's the whole vibe. ๐ŸŽ€

about that ending offset โ€” it's an exclusive offset, meaning it's 1 byte more than the last byte actually occupied by the variable. in other words (fr fr), the ending offset = starting offset + the variable size. math is math. ๐Ÿงฎ

and for record variables? only the offsets of the first record get printed. if you want all the records, add option -r and she'll show you everything. no gatekeeping here. ๐Ÿ”ฅ

also, if no argument is given, command usage information is printed. simple as that. โœจ


๐Ÿ‘‘ OPTIONS ๐Ÿ‘‘

  • -v var1[,...] โ€” only shows you the offset info for the variables you named. you gotta hand over one or more variable names in a comma-delimited list, and bestie, that list must not contain blanks or any other white space characters, okay? the named variables also have to be valid netCDF variables in the input file, no fake ones ๐Ÿ’€. default (aka no -v at all) = offset info for all variables stored in the input file.
  • -s โ€” prints the variable size in bytes. for record variables, it's only the size of one record. one. single. record. ๐Ÿซถ
  • -g โ€” prints the gap in bytes from the previous variable. for the first defined variable, it prints the gap from the end of file header. and for record variables โ€” plot twist โ€” there's no gap between records. ๐ŸŒˆ
  • -r โ€” outputs the offset information for all records of the selected record variables. without this option, only the offsets of the first record are printed. that's the difference, periodt. ๐Ÿ’…
  • -x โ€” checks all fixed-size variables for file space gaps in between any two immediately adjacent variables. it prints "1" on stdout if gaps are found, and "0" otherwise. โš ๏ธ heads up though: this option disables all other options. she's a solo act.
  • -h โ€” prints the available command-line options. the lil help menu, yk? ๐Ÿ™ˆ

๐Ÿ“ EXAMPLES ๐Ÿ“

% ncoffsets -sg testfile.nc
netcdf testfile.nc {
// File format: CDF-1
// Number of dimensions: 4
// Number of variables: 4
// Number of global attributes: 0

file header:
    size   = 256 bytes
    extent = 512 bytes

dimensions:
    time = UNLIMITED // (101 currently)
    Z = 100
    Y = 100
    X = 100

fixed-size variables:
    float  square(Y, X):
           start file offset =         512
           end   file offset =       40512
           size in bytes     =       40000
           gap from prev var =         256
    double cube(Z, Y, X):
           start file offset =       40512
           end   file offset =     8040512
           size in bytes     =     8000000
           gap from prev var =           0

record variables:
    double time(time):
           start file offset =     8040512    (0th record)
           end   file offset =     8040520    (0th record)
           size in bytes     =           8    (of one record)
           gap from prev var =           0
    float  rec_var(time, Z, Y, X):
           start file offset =     8040520    (0th record)
           end   file offset =    12040520    (0th record)
           size in bytes     =     4000000    (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

๐Ÿ’œ SEE ALSO ๐Ÿ’œ


๐ŸŽ€ DATE ๐ŸŽ€

July 1, 2026


and that's the whole page, bestie ๐Ÿซถ this lil writeup lives in the PnetCDF utilities world โ€” it's from PnetCDF 1.15.0, and the printed copy you're looking at is stamped 2026-11-02. go forth and go find those offsets โœจ๐Ÿ’–๐Ÿฆ‹
๐Ÿ“ฆ where this page comes from