NETCDF(3)
๐ฆ NETCDF(3) โ UNIDATA LIBRARY FUNCTIONS ๐ฆ
okay so bestie, sit down, hydrate, because we're about to talk about the Unidata Network Common Data Form โ yes, the netCDF-2 library, the C one, the vintage one. This is part one of a whole saga, so buckle up and don't you dare skip the boring bits, because every single flag matters. ๐
๐ NAME ๐
netcdfโ Unidata Network Common Data Form (netCDF-2) library โจ
๐ WARNING ๐
GIRL. The interface described here is obsolete, but it's included because the perl module still use it. That's the whole reason. Do not build your whole personality on this API. It's giving vintage. ๐ซถ
โจ SYNOPSIS โจ
Here's the whole cast list, verbatim, no cap:
#include <netcdf.h>
int nccreate(const char* path, int cmode)
int ncopen(const char* path, int mode)
int ncredef(int ncid)
int ncsetfill(int ncid, int fillmode)
int ncendef(int ncid)
int ncclose(int ncid)
int ncinquire(int ncid, int* ndims, int* nvars, int* natts, int* recdim)
int ncsync(int ncid)
int ncabort(int ncid)
int ncdimdef(int ncid, const char* name, long length)
int ncdimid(int ncid, const char* name)
int ncdiminq(int ncid, int dimid, char* name, long* length)
int ncdimrename(int ncid, int dimid, const char* name)
int ncvardef(int ncid, const char* name, nc_type datatype, int ndims,
const int dimids[])
int ncvarid(int ncid, const char* name)
int ncvarinq(int ncid, int varid, char* name, nc_type* datatype,
int* ndims, int dimids[], int* natts)
int ncvarput1(int ncid, int varid, const long coords[], const
void* value)
int ncvarget1(int ncid, int varid, const long coords[], void* value)
int ncvarput(int ncid, int varid, const long start[], const
long count[], const void* value)
int ncvarget(int ncid, int varid, const long start[], const
long count[], void* value)
int ncvarputg(int ncid, int varid, const long start[], const
long count[], const long stride[], const long imap[], const
void* value)
int ncvargetg(int ncid, int varid, const long start[], const
long count[], const long stride[], const long imap[], void* value)
int ncrecput(int ncid, long recnum, void* const valuep[])
int ncrecget(int ncid, long recnum, void* valuep[])
int ncrecinq(int ncid, int* nrvars, int rvarids[], long rsizes[])
int ncvarrename(int ncid, int varid, const char* name)
int ncattput(int ncid, int varid, const char* name, nc_type datatype,
int len, const void* value)
int ncattinq(int ncid, int varid, const char* name, nc_type* datatype,
int* len)
int ncattget(int ncid, int varid, const char* name, void* value)
int ncattcopy(int inncid, int invar, const char* name, int outncid,
int outvar)
int ncattname(int ncid, int varid, int attnum, char* name)
int ncattrename(int ncid, int varid, const char* name, const
char* newname)
int ncattdel(int ncid, int varid, const char* name)
int nctypelen(nc_type datatype)
๐ฅ FUNCTION DESCRIPTIONS ๐ฅ
okay so these routines implement the Unidata netCDF data-access interface for the C programming language. Only those arguments which are unique to the function being described are documented in this section. ๐ See the section "COMMON ARGUMENT DESCRIPTIONS" for descriptions of the other arguments โ yes, that's a real section, and yes, you're gonna need it.
๐ธ int nccreate(const char* path, int cmode)
Creates the new netCDF file, returning a netCDF ID that can subsequently be used to refer to the netCDF file. ๐ The new netCDF file is placed in define mode. The mode parameter, cmode, should be either NC_CLOBBER or NC_NOCLOBBER.
NC_CLOBBERโ means that even if the file already exists, you want to create a new file with the same name, erasing the old file's contents. ๐ bye bye data.NC_NOCLOBBERโ means you want to create a new netCDF file only if the given file name does not refer to a file that already exists. safe queen behavior. ๐ซถ
If an error occurs, this function returns -1.
๐ฆ int ncopen(const char* path, int mode)
Opens the existing netCDF file for access. The mode parameter, mode, should be either NC_WRITE, to open the file for writing, or NC_NOWRITE, to open the file read-only. ๐
"Writing" means any kind of change to the file, including appending or changing data, adding or renaming dimensions, variables, or attributes, or deleting attributes. So like, it's not just "writing" as in writing values, bestie. It's everything. ๐ญ
If an error occurs, this function returns -1.
โจ int ncredef(int ncid)
Puts an open netCDF file into define mode, so dimensions, variables, and attributes can be added or renamed and attributes can be deleted. ๐ ๏ธ If an error occurs, this function returns -1.
๐ int ncsetfill(int ncid, int fillmode)
Determines whether or not variable prefilling will be done (see VARIABLE PREFILLING below โ yes there's a whole section about it). The netCDF file shall be writable. ๐
fillmodeis eitherNC_FILLto enable prefilling (the default) orNC_NOFILLto disable prefilling.
This function returns the previous setting or -1 if an error occurs. It's giving "here's what it was before, you're welcome." ๐
๐ฅ int ncendef(int ncid)
Takes an open netCDF file out of define mode. The changes made to the netCDF file while it was in define mode are checked and committed to disk if no problems occurred. ๐พ
In particular, non-record variables are filled with their fill-values unless ncsetfill() has been called with the argument NC_NOFILL. The netCDF file is then placed in data mode, so that variable data can be read or written. If an error occurs, this function returns -1.
๐ int ncclose(int ncid)
Closes an open netCDF file. If the file is in define mode, ncendef() will be called before closing. (In this case, if ncendef() returns an error, ncabort() will automatically be called to restore the file to the consistent state before define mode was last entered.) ๐จ
After an open netCDF file is closed, its netCDF ID will be reassigned to the next netCDF file that is opened or created. Yes, the ID gets recycled. Not me losing track of which file is which. ๐ญ
If an error occurs, this function returns -1.
๐ int ncinquire(int ncid, int* ndims, int* nvars, int* natts, int* recdim)
Returns information about an open netCDF file. Upon successful return:
ndimswill contain the number of dimensions defined for this netCDF filenvarswill contain the number of variablesnattswill contain the number of attributesrecdimwill contain the ID of the unlimited dimension if one exists, or-1otherwise
If any of the return parameters is a NULL pointer, then the corresponding information will not be returned; hence, no space need be allocated for it. ๐ If an error occurs, this function returns -1.
โญ int ncsync(int ncid)
Updates a writable netCDF file. The netCDF file must be in data mode. A netCDF file in define mode is synchronized to disk only when ncendef() is called.
It can be expensive in computer resources to always synchronize to disk after every write of variable data or change of an attribute value. ๐ฎโ๐จ
There are two reasons you might want to synchronize after writes:
- to minimize data loss in case of abnormal termination ๐
- to make data available to other processes for reading immediately after it is written ๐
Data is automatically synchronized to disk when a netCDF file is closed, or whenever you leave define mode. If an error occurs, this function returns -1.
๐
int ncabort(int ncid)
Closes or deletes a netCDF file. Here's the vibe breakdown:
- If the netCDF file isn't in define mode, then the file is closed.
- If the file is being created and is still in define mode, the file is deleted. ๐๏ธ
- If define mode was entered by a call to
ncredef(), the netCDF file is restored to its state before definition mode was entered and the file is closed.
The main reason for calling ncabort() is to restore the netCDF to a known consistent state in case anything goes wrong during the definition of new dimensions, variables, or attributes. ๐ซถ This function is called automatically if ncclose() is called from define mode and the call to leave define mode before closing fails. If an error occurs, this function returns -1.
๐ธ int ncdimdef(int ncid, const char* name, long length)
Adds a new dimension to an open netCDF file, which must be in define mode. name is the dimension name. If an error occurs, this function returns -1.
๐ฆ int ncdimid(int ncid, const char* name)
Returns the ID of a netCDF dimension, given the name of the dimension. If an error occurs, this function returns -1.
๐ int ncdiminq(int ncid, int dimid, char* name, long* size)
Returns the name and size of a dimension, given its ID. If either the name parameter or size parameter is a NULL pointer, the associated information will not be returned, so no space needs to be allocated. โจ
For the unlimited dimension, the returned size is the current maximum value used for writing any record variables, (i.e. the maximum record number). If an error occurs, this function returns -1.
๐ int ncdimrename(int ncid, int dimid, const char* name)
Renames an existing dimension in an open netCDF file. If the new name is longer than the old name, the netCDF must be in define mode. ๐จ You cannot rename a dimension to have the same name as another dimension. If an error occurs, this function returns -1.
๐ฅ int ncvardef(int ncid, const char* name, nc_type datatype, int ndims, const int dimids[])
Adds a new variable to an open netCDF file in define mode. It returns a netCDF variable ID. ๐ If an error occurs, this function returns -1.
โญ int ncvarid(int ncid, const char* name)
Returns the ID of a netCDF variable, given its name. If an error occurs, this function returns -1.
๐ int ncvarinq(int ncid, int varid, char* name, nc_type* datatype, int* ndims, int dimids[], int* natts)
Returns information about a netCDF variable, given its ID. If any of the return parameters (name, datatype, ndims, dimids, or natts) is a NULL pointer, then the corresponding information will not be returned; hence, no space need be allocated for it. ๐
If an error occurs, this function returns -1.
๐ธ int ncvarput1(int ncid, int varid, const long coords[], const void* value)
Puts a single data value into a variable of an open netCDF file that is in data mode. If an error occurs, this function returns -1.
๐ฆ int ncvarget1(int ncid, int varid, const long coords[], void* value)
Gets a single data value from a variable of an open netCDF file that is in data mode. If an error occurs, this function returns -1.
๐ int ncvarput(int ncid, int varid, const long start[], const long count[], const void* value)
Writes a hyperslab of values into a netCDF variable of an open netCDF file, which must be in data mode. If an error occurs, this function returns -1.
๐ int ncvarget(int ncid, int varid, const long start[], const long count[], void* value)
Reads a hyperslab of values from a netCDF variable of an open netCDF file, and bestie, it must be in data mode. If an error occurs, this function returns -1.
ncvarputg โ writes a general hyperslab ๐
int ncvarputg(int ncid, int varid, const long start[], const long count[], const long stride[], const long imap[], const void* value)
Okay so this one writes a general hyperslab of values into a netCDF variable of an open netCDF file, and it must be in data mode. The locations of the memory-resident data values can be arbitrary, but they're constrained to have a regular structure. Plus, the values of the netCDF variable can be accessed using non-unity strides. If an error occurs, it returns -1.
ncvargetg โ reads a general hyperslab ๐ฆ
int ncvargetg(int ncid, int varid, const long start[], const long count[], const long stride[], const long imap[], void* value)
This one reads a general hyperslab of values from a netCDF variable of an open netCDF file, and it must be in data mode. The locations of the memory-resident data values can be arbitrary, but they're constrained to have a regular structure. Also, the values of the netCDF variable can be accessed using non-unity strides. If an error occurs, it returns -1.
ncrecput โ writes a record (or subset) ๐
int ncrecput(int ncid, long recnum, const void* valuep[])
Writes a record (or a subset of a record) of values into the record variables of an open netCDF file, which must be in data mode. The record number, recnum, must be a nonnegative number that specifies which record (which value of the unlimited or record dimension) to write. The array of pointers to blocks of data to be written, valuep, should have one pointer for each record variable. The pointer to the data to be written to the n-th record variable, valuep[n], points to one record's worth of data of the appropriate type to be written into the recnum-th record of that netCDF variable. If the pointer for any record variable is the NULL pointer, no data is written for that variable. Hence any subset of record variables may be written by specifying non-NULL pointers for the desired record variables. Invoking this function is equivalent to a sequence of invocations of ncvarput() for all record variables for which a non-NULL pointer is specified. If an error occurs, this function returns -1.
ncrecget โ reads a record (or subset) ๐
int ncrecget(int ncid, long recnum, void* valuep[])
Reads a record (or a subset of a record) of values from the record variables of an open netCDF file, which must be in data mode. The record number, recnum, must be a nonnegative number that specifies which record to read. The array of pointers to blocks of data to be read, valuep, should have one pointer for each record variable. The pointer to the data to be read for the n-th record variable, valuep[n], shall point to enough space to hold one record's worth of data of the appropriate type for that netCDF record variable. If the pointer for any record variable is the NULL pointer, no data is read from that variable. Hence any subset of record variables may be read by specifying non-NULL pointers for only the desired record variables. Invoking this function is equivalent to a sequence of invocations of ncvarget() for all record variables for which a non-NULL pointer is specified. If an error occurs, this function returns -1.
ncrecinq โ record variable info ๐
int ncrecinq(int ncid, int* nrvars, int rvarids[], long rsizes[])
Returns information about the record variables (variables that use the unlimited dimension) of an open netCDF file. Upon successful return, nrvars will contain the number of record variables, rvarids will contain the variable IDs of those record variables, and rsizes will contain the size in bytes for a record's worth of data for each record variable. If any of the return parameters (nrvars, rvarids, or rsizes) is a NULL pointer, the specified information will not be returned; hence no space needs to be allocated for it. If an error occurs, this function returns -1.
ncvarrename โ rename a variable โจ
int ncvarrename(int ncid, int varid, const char* name)
Changes the name of a netCDF variable in an open netCDF. If the new name is longer than the old name, the netCDF must be in define mode. You cannot rename a variable to have the name of any existing variable. If an error occurs, this function returns -1.
ncattput โ add or change an attribute ๐
int ncattput(int ncid, int varid, const char* name, nc_type datatype, int len, const void* value)
Adds or changes a variable attribute or global attribute of an open netCDF file. If this attribute is new, or if the space required to store the attribute is greater than before, the netCDF file must be in define mode. If an error occurs, this function returns -1.
ncattinq โ attribute info ๐ธ
int ncattinq(int ncid, int varid, const char* name, nc_type* datatype, int* len)
Returns information about a netCDF attribute, given its variable ID and name. The information returned is the type and length of the attribute. If either of the return parameters is a NULL pointer, the specified information will not be returned; hence no space needs to be allocated for it. If an error occurs, this function returns -1.
ncattget โ get attribute value(s) ๐ง
int ncattget(int ncid, int varid, const char* name, void* value)
Gets the value(s) of a netCDF attribute, given its variable ID and name. All elements of the vector of attribute values are returned, so you must allocate enough space to hold them. If you don't know how much space to reserve, call ncattinq() first to find out the length of the attribute. If an error occurs, this function returns -1.
ncattcopy โ copy an attribute ๐
int ncattcopy(int inncid, int invar, const char* name, int outncid, int outvar)
Copies an attribute from one open netCDF file to another. It can also be used to copy an attribute from one variable to another within the same netCDF. inncid is the netCDF ID of an input netCDF file from which the attribute will be copied. invar is the ID of the variable in the input netCDF file from which the attribute will be copied, or NC_GLOBAL for a global attribute. name is the name of the attribute in the input netCDF file to be copied. outncid is the netCDF ID of the output netCDF file to which the attribute will be copied. It is permissible for the input and output netCDF IDs to be the same. The output netCDF file should be in define mode if the attribute to be copied does not already exist for the target variable, or if it would cause an existing target attribute to grow. outvar is the ID of the variable in the output netCDF file to which the attribute will be copied, or NC_GLOBAL to copy to a global attribute. If an error occurs, this function returns -1.
ncattname โ get attribute name by number ๐ข
int ncattname(int ncid, int varid, int attnum, char* name)
Gets the name of an attribute, given its variable ID and number as an attribute of that variable. This function is useful in generic applications that need to get the names of all the attributes associated with a variable, since attributes are accessed by name rather than number in all other attribute functions. The number of an attribute is more volatile than the name, since it can change when other attributes of the same variable are deleted. This is why an attribute number is not called an attribute ID. attnum is the number of the attribute. The attributes for each variable are numbered from 0 (the first attribute) to nvatts-1, where nvatts is the number of attributes for the variable, as returned from a call to ncvarinq(). If the name parameter is a NULL pointer, no name will be returned and no space need be allocated. If an error occurs, this function returns -1.
ncattrename โ rename an attribute ๐ท๏ธ
int ncattrename(int ncid, int varid, const char* name, const char* newname)
Changes the name of an attribute. If the new name is longer than the original name, the netCDF must be in define mode. You cannot rename an attribute to have the same name as another attribute of the same variable. name is the original attribute name. newname is the new name to be assigned to the specified attribute. If the new name is longer than the old name, the netCDF file must be in define mode. If an error occurs, this function returns -1.
ncattdel โ delete an attribute ๐๏ธ
int ncattdel(int ncid, int varid, const char* name)
Deletes a netCDF attribute from an open netCDF file. The netCDF file must be in define mode. If an error occurs, this function returns -1.
nctypelen โ bytes in a data type ๐
int nctypelen(nc_type datatype)
Returns the number of bytes in a netCDF data type. If an error occurs, this function returns -1.
๐ COMMON ARGUMENT DESCRIPTIONS (the cast of characters ๐ )
okay bestie, before we get into the functions themselves, you gotta meet the arguments. like, these show up everywhere, so learn them once and you're set. no cap.
char* nameโ this is the name of a dimension, a variable, or an attribute. It shall start with an alphabetic character, and then zero or more alphanumeric characters after it, underscore (_) counts as alphanumeric, iykyk. Case is significant โFooandfooare not the same girl. When it's an input argument, it shall be a pointer to a 0-terminated string; when it's an output argument, it shall be the address of a buffer where such a string gets to live. The max allowable number of characters (not counting the terminating 0) isMAX_NC_NAME. Oh and heads up: attribute names that begin with an underscore (_) are reserved for use by the netCDF interface โ that's not your name to take, periodt.char* pathโ the pathname of a netCDF file. Absolute or relative, dealer's choice, she's flexible. ๐int ncidโ the netCDF ID that a previous, successful call toncopen()ornccreate()handed back to you. Like a little receipt. ๐งพint dimids[]โ a vector of dimension ID's that defines the shape of a netCDF variable. The size of this vector shall be greater than or equal to the rank (that's the number of dimensions) of the variable, akandims. And here's the iconic part: the vector shall be ordered by the speed with which a dimension varies โ sodimids[ndims-1]is the dimension ID of the most rapidly varying dimension, anddimids[0]is the ID of the most slowly varying one. Consequently (yes, consequently, we're fancy), if the variable is a record variable, thendimids[0]shall be the dimension ID of the record dimension. The maximum possible number of dimensions for a variable is given by the symbolic constantMAX_VAR_DIMS.int dimidโ the ID of a netCDF dimension. netCDF dimension ID's are allocated sequentially from the non-negative integers, starting at 0. Count with me: 0, 1, 2... ๐int lenโ the number of values associated with an attribute. Lowkey important detail: if the attribute is of typeNC_CHAR, then this is one more than the string length, because the terminating 0 is stored too. She's extra like that.int ndimsโ either the total number of dimensions in a netCDF dataset, or the rank (number of dimensions) of a netCDF variable. The value shall not be negative, and shall not be greater than the symbolic constantMAX_VAR_DIMS.int varidโ the ID of a netCDF variable, or (for the attribute-access functions) the symbolic constantNC_GLOBAL, which is what you use to reference global attributes. netCDF variable ID's are allocated sequentially from the non-negative integers beginning with 0. Same deal as dimids, cute and orderly. โจint nattsโ the number of global attributes in a netCDF dataset, for thencinquire()function; or the number of attributes associated with a netCDF variable, for thencvarinq()function. Depends who's asking, bestie.long imap[]โ okay this one's the โจmain characterโจ. It's the index mapping vector that specifies how data values associated with a netCDF variable are arranged in memory. The offset, in bytes, from the memory location pointed to by thevalueargument to a particular datum is given by the inner (dot) product of the index mapping vector with the coordinates of the datum. For example, on a machine wheresizeof(float) == 4, the index mapping vector for the arrayfloat u[3][5];islong imap[2] = {20,4}.
And now the wild part: the index mapping vector can be used to access memory-resident data values in a manner that differs radically from the nominal structure of the associated netCDF variable. For example, these definitions:
struct vel {
int flags;
float u;
float v;
} vel[NX][NY];
long imap[2] = {
sizeof(struct vel),
sizeof(struct vel)*NY};
can be used to access the memory-resident values of the netCDF variable, u[NY][NX], even though the dimensions are transposed and the data is contained in a 2-D array of structures rather than a 2-D array of floating-point values. She's doing a little shapeshifting, we love her for it. ๐ฆ
The index mapping vector may contain negative values if the value argument is appropriately set. And a NULL index mapping vector argument obtains the default behavior, in which the memory-resident values are assumed to have the same structure as the associated netCDF variable.
long coords[]โ specifies the indicial coordinates of the netCDF data value to be accessed. The indices are relative to 0; so, for example, the first data value of a two-dimensional variable is (0,0). The size of the vector shall be at least the rank of the associated netCDF variable, and its elements shall correspond, in order, to the variable's dimensions. Consequently, if the variable is a record variable, then the first index is the record number. ๐long count[]โ specifies the number of data values to be accessed, in terms of the lengths of the sides of the hyperslab. So to access a single value, for example, specifycountas (1, 1, ..., 1). Note that, for generalized hyperslab I/O, this argument must be adjusted to be compatible with thestrideandstartarguments, so that the interaction of the three does not attempt to access an invalid data co-ordinate. For example, to access everystride(i)'th datum along dimension i beginning with pointstart(i),counts(i)should be1+(npts(i)-1-start(i))/stride(i)โ wherenpts(i)is the size of dimension i. The size of thecountvector shall be at least the rank of the associated netCDF variable, and its elements shall correspond, in order, to the variable's dimensions. Consequently, if the variable is a record variable, then the first element ofcountis the number of records to access. Math girlies rise ๐งlong lengthโ the size of a netCDF dimension. As an input argument, it shall be a positive integer or the symbolic constantNC_UNLIMITED. At most one such unlimited size dimension, called the record dimension, shall be defined in a netCDF dataset. As an output argument, it shall be a positive integer. One unlimited dimension only, bestie, we don't do chaos here (well, we do, but not this kind).long start[]โ specifies the starting point for accessing a netCDF variable's data values, in terms of the indicial coordinates of the corner of the hyperslab. The indices are relative to 0; so the first data value of a variable is (0, 0, ..., 0). The size of the vector shall be at least the rank of the associated netCDF variable, and its elements shall correspond, in order, to the variable's dimensions. Consequently, if the variable is a record variable, then the first index is the starting record number for accessing the netCDF variable's data values. ๐long stride[]โ specifies, for each dimension, the interval between the accessed values of a netCDF variable. The size of the vector shall be at least the rank of the associated netCDF variable, and its elements shall correspond, in order, to the variable's dimensions. A value of 1 accesses adjacent values of the netCDF variable in the corresponding dimension; a value of 2 accesses every other value in the corresponding dimension; and so on, you get the vibe. Attempting to access a data value that lies outside the defined data space of a variable is an error. ANULLstrideargument obtains the default behavior, in which adjacent values are accessed along each dimension.nc_type datatypeโ specifies the data type of a netCDF variable, and is one of the following:NC_BYTE,NC_CHAR,NC_SHORT,NC_LONG,NC_FLOAT, orNC_DOUBLE. Pick your fighter. ๐void* valueโ points to the start of the memory-resident data values to be accessed. The pointer is declared to be of typevoid*because it can point to data of any of the basic netCDF types. The data should be of the appropriate type for the netCDF variable:
netCDF Type C Type
NC_BYTE unsigned char
NC_CHAR char
NC_SHORT short
NC_LONG nclong
NC_FLOAT float
NC_DOUBLE double
NOTE: The C type corresponding to the netCDF type NC_LONG is nclong. This type is defined in the netCDF header file and is guaranteed to hold at least 32 bits. It is defined as either a C int or a C long โ depending on the platform. So don't @ her about which one it is, it's platform's choice. ๐
Warning: neither the compiler nor the netCDF software can detect if the wrong type of data is used. Like, nothing will stop you. Nothing will warn you. It'll just be wrong. Be careful, bestie, for real. ๐
๐ธ VARIABLE PREFILLING (aka the fill-value situation)
By default, the netCDF interface sets the values of all newly-defined variables of finite length (i.e. not having an unlimited, record dimension) to the type-dependent fill-value associated with each variable. This is done when ncendef() is called. The fill-value for a variable may be changed from the default value by defining the attribute _FillValue for the variable. This attribute must have the same type as the variable and be of length one. Just one. That's it. ๐ค
Variables with an unlimited record dimension are also prefilled, but on an as needed basis. For example, if the first write of a record variable is to position 5, then positions 0 through 4 (and no others) would be set to the fill-value at the same time. She fills in the blanks as she goes, efficient queen ๐
This default prefilling of data values may be disabled by calling the function ncsetfill() with the argument NC_NOFILL. Note the timing, this part matters: for non-record variables, this call must be made before ncendef(); whereas for record-variables, this call may be made at any time. โฐ
One can obtain increased performance of the netCDF interface by using this feature, but only at the expense of requiring the application to set every single data value. Every one. All of them. No skipping. That's the trade, babe. ๐ฅ
๐ GLOBAL OPTIONS
The global variable ncopts, which is defined in netcdf.h, affects the actions of the netCDF interface. It may be set by the user to the bitwise OR of any of the following, non-zero, symbolic bit-values:
NC_VERBOSEโ Print error-messages on standard error.NC_FATALโ Abort. Callexit()with an error-condition if an error occurs. She's dramatic, but valid.
By default, ncopts is NC_VERBOSE | NC_FATAL. So yeah, out of the box she's loud and she will absolutely exit on you. ๐ญ
๐ฆ ENVIRONMENT VARIABLES
NETCDF_FFIOSPECโ Specifies the Flexible File I/O buffers for netCDF I/O when executing under the UNICOS operating system (this variable is ignored on other operating systems, so don't stress if you've never heard of her). An appropriate specification can greatly increase the efficiency of netCDF I/O โ to the extent that it can actually surpass FORTRAN binary I/O. Yes, really. The default specification isbufa:336:2. See UNICOS Flexible File I/O for more information. โญ
๐ MAILING-LISTS ๐
Okay bestie, so there's both a mailing list and a digest for talking about the netCDF interface, plus announcements about netCDF bugs, fixes and enhancements. Two whole vibes. Pick your fighter. โจ
To start (or change) your subscription to either the mailing-list or the digest, you send one of the following in the body of an email message โ not the subject line, okay? the subject line is NOT it โ to "Majordomo@unidata.ucar.edu". And obvi you swap in your own email address wherever it says jdoe@host.inst.domain. ๐
To subscribe to the netCDF mailing list:
subscribe netcdfgroup jdoe@host.inst.domain
To unsubscribe from the netCDF mailing list:
unsubscribe netcdfgroup jdoe@host.inst.domain
To subscribe to the netCDF digest:
subscribe netcdfdigest jdoe@host.inst.domain
To unsubscribe from the netCDF digest:
unsubscribe netcdfdigest jdoe@host.inst.domain
To retrieve the general introductory information for the mailing list:
info netcdfgroup
To get a synopsis of other majordomo commands:
help
๐ซถ Pro tip from your girl: body, not subject. I said what I said. Majordomo does not read the subject line and it will simply not perceive you. ๐ญ
๐ SEE ALSO
ncdump(1)โ the one that dumps your data so you can see it, iconic behaviorncgen(1)โ the one that generates netCDF files from CDL, king shitnetcdf(3f)โ the Fortran interface, she's here too ๐
And if you want the full lore, there's the netCDF User's Guide, published by the Unidata Program Center, University Corporation for Atmospheric Research, located in Boulder, Colorado. Very "mountain views, big data" energy. ๐โฐ๏ธ
And that's the whole page, bestie!! ๐ This iconic little document is from the NETCDF(3) source, dated 26 February 1993, and it says it was printed 126.10.12 โ which, yeah, that date format is giving absolutely nothing, but we respect the archive. ๐ซถ Go read some arrays. Slay. โจ๐๐ฆ
๐ฆ where this page comes from
- fedora 43: netcdf-perl 1.2.4-56.fc43 ยท BSD-3-Clause
- fedora 44: netcdf-perl 1.2.4-58.fc44 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms