NetCDF
4.9.2
|
In C, Fortran 77, and Fortran 90, netCDF objects are identified by an integer: the ID.
NetCDF functions use this ID to identify the object. It's helpful for the programmer to understand these IDs.
Open data files, dimensions, variables, and attributes, and used-defined types are each numbered independently, and are always numbered in the order in which they were defined. (They also appear in this order in ncdump output.) Numbering starts with 0 in C, and 1 in Fortran 77/90.
For example, the first variable defined in a file will have an ID of 0 in C programs, and 1 in Fortran programs, and functions that apply to a variable will need to know the ID of the variable you mean.
IDs for netCDF dimensions and variables are persistent, but deleting an attribute changes subsequent attribute numbers.
Although netCDF refers to everything by an integer id (varid, dimid, attnum), there are inquiry functions which, given a name, will return an ID. For example, nc_inq_varid() will take a character string (the name), and give back the ID of the variable of that name. The variable ID is then used in subsequent calls (to read the data, for example).
The ncid used to identify a file in the classic model, or a group within that file in the enhanced model (see The NetCDF Data Model), or a user-defined type, are not permanently associated with the file. They may change the next time the file is opened.