NETCDF(3)
π NETCDF(3) β Unidata Library Functions π
okay bestie, welcome to the netCDF glow-up. this is the UNIDATA LIBRARY FUNCTIONS corner of your terminal, and we're about to make data access feel like a vibe. π¦
β¨ NAME β¨
netcdf β Unidata's Network Common Data Form (netCDF) library interface
like, it's the interface. the moment. the main character. π
πΈ SYNOPSIS πΈ
#include "netcdf.h"
cc ... -lnetcdf -lhdf5_hl -lhdf5 -lz -lm
fr fr, that's the whole incantation. include the header, link the libs, and you're in. π«Ά
Complete documentation for the netCDF libraries can be found at the netCDF website: https://www.unidata.ucar.edu/software/netcdf/ β yes, the complete docs, the extended cut, the director's commentary. go there when you want more. π
π LIBRARY VERSION π
This document describes versions 3 and 4 of Unidata netCDF data-access interface for the C programming language. so like, both eras. both slay. β
const char* nc_inq_libvers()β Returns a string identifying the version of the netCDF library, and when it was built, like:"3.1a of Aug 22 1996 12:57:47 $".
The RCS ident(1) command will find a string like "$Id: @(#) netcdf library version 3.1a of Sep 6 1996 15:56:26 $" in the library. The SCCS what(1) command will find a string like "netcdf library version 3.1a of Aug 23 1996 16:07:40 $".
not me digging through a binary looking for a little string to find out what version i'm running π but like. it works. iconic behaviour honestly.
π¦ RETURN VALUES π¦
All netCDF functions (except nc_inq_libvers() and nc_strerror()) return an integer status. yes, everybody gets a lil number. π
If this returned status value is not equal to NC_NOERR (zero), it indicates that an error occurred. so like, zero = good, anything else = we have a situation. π The possible status values are defined in system include file <errno.h> and in "netcdf.h".
const char* nc_strerror(int status)β Returns a string textual translation of the status value, like"Attribute or variable name contains illegal characters"or"No such file or directory".
so when your code comes back with a weird number, you hand that number to nc_strerror() and it tells you what's actually wrong, in words, like a bestie translating a cryptic text. obsessed with her honestly. π
β¨ FILE OPERATIONS β¨
int nc_create(const char path[], int cmode, int* ncid)
Makes you a brand new netCDF dataset at path, and hands you back a netCDF ID in ncid. Bestie, this is literally the birth of a file. π
The cmode argument can be a bitwise-or of these flags:
NC_NOCLOBBERβ protects datasets that already exist. (Without it? The default just silently blows them away. No warning, no nothing. π)NC_SHAREβ synchronous dataset updates for classic format files (the default is to buffer accesses).
When a netCDF dataset is created, is is opened NC_WRITE. The new netCDF dataset is in define mode. NC_64BIT_OFFSET to create a file in the 64-bit offset format (as opposed to classic format, which is the default). NC_TRUE to create a netCDF-4/HDF5 file, and NC_CLASSIC_MODEL to guarantee that netCDF-4/HDF5 files maintain compatibility with the netCDF classic data model.
int nc__create(const char path[], int cmode, size_t initialsize, size_t* chunksize, int* ncid)
Same energy as nc_create() but it also has extra performance tuning parameters. β¨
The initialsize argument sets the initial size of the file at creation time.
For what chunksize even means, scroll down to nc__open() β it's explained there.
int nc_open(const char path[], int mode, int* ncid)
(Corresponds to ncopen() in version 2)
Opens an existing netCDF dataset at path and gives you a netCDF ID in ncid. The type of access is described by the mode parameter, which may include the bitwise-or of these flags:
NC_WRITEβ read-write access (the default is read-only).NC_SHAREβ synchronous dataset updates (the default is to buffer accesses).NC_LOCKβ not yet implemented. π
As of NetCDF version 4.1, and if TRUE support was enabled when the NetCDF library was built, the path parameter may specify a TRUE URL. In that case, the access mode is forced to be read-only.
int nc__open(const char path[], int mode, size_t* chunksize, int* ncid)
Like nc_open() but with one extra performance tuning parameter.
The argument referenced by chunksize controls a space versus time tradeoff β memory allocated in the netcdf library versus number of system calls. Because of internal requirements, the value may not be set to exactly the value requested. The actual value chosen is returned by reference. Using the value NC_SIZEHINT_DEFAULT causes the library to choose a default. How the system choses the default depends on the system. On many systems, the "preferred I/O block size" is available from the stat() system call, struct stat member st_blksize. If this is available it is used. Lacking that, twice the system pagesize is used. Lacking a call to discover the system pagesize, we just set default chunksize to 8192.
The chunksize is a property of a given open netcdf descriptor ncid, it is not a persistent property of the netcdf dataset. Just so we're clear. π
As with nc__open(), the path parameter may specify a TRUE URL, but the tuning parameters are ignored.
int nc_redef(int ncid)
(Corresponds to ncredef() in version 2)
Puts an open netCDF dataset into define mode, so dimensions, variables, and attributes can be added or renamed and attributes can be deleted. It's giving "let me redecorate my room" energy. π
int nc_enddef(int ncid)
(Corresponds to ncendef() in version 2)
Takes an open netCDF dataset out of define mode. The changes made to the netCDF dataset while it was in define mode are checked and committed to disk if no problems occurred. Some data values may be written as well β see "VARIABLE PREFILLING" below. After a successful call, variable data can be read or written to the dataset.
int nc__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align)
Like nc_enddef() but with extra performance tuning parameters. Fancy. β¨
Caution: this function exposes internals of the netcdf version 1 file format. It may not be available on future netcdf implementations.
The current netcdf file format has three sections: the "header" section, the data section for fixed size variables, and the data section for variables which have an unlimited dimension (record variables). The header begins at the beginning of the file. The index (offset) of the beginning of the other two sections is contained in the header. Typically, there is no space between the sections. This causes copying overhead to accrue if one wishes to change the size of the sections, as may happen when changing names of things, text attribute values, adding attributes or adding variables. Also, for buffered i/o, there may be advantages to aligning sections in certain ways.
The minfree parameters allow one to control costs of future calls to nc_redef(), nc_enddef() by requesting that minfree bytes be available at the end of the section. The h_minfree parameter sets the pad at the end of the "header" section. The v_minfree parameter sets the pad at the end of the data section for fixed size variables.
The align parameters allow one to set the alignment of the beginning of the corresponding sections. The beginning of the section is rounded up to an index which is a multiple of the align parameter. The flag value NC_ALIGN_CHUNK tells the library to use the chunksize (see above) as the align parameter. The v_align parameter controls the alignment of the beginning of the data section for fixed size variables. The r_align parameter controls the alignment of the beginning of the data section for variables which have an unlimited dimension (record variables).
The file format requires mod 4 alignment, so the align parameters are silently rounded up to multiples of 4. The usual call, nc_enddef(ncid) is equivalent to nc__enddef(ncid, 0, 4, 0, 4).
The file format does not contain a "record size" value, this is calculated from the sizes of the record variables. This unfortunate fact prevents us from providing minfree and alignment control of the "records" in a netcdf file. If you add a variable which has an unlimited dimension, the third section will always be copied with the new variable added. π
int nc_sync(int ncid)
(Corresponds to ncsync() in version 2)
Unless the NC_SHARE bit is set in nc_open() or nc_create(), accesses to the underlying netCDF dataset are buffered by the library. This function synchronizes the state of the underlying dataset and the library. This is done automatically by nc_close() and nc_enddef(). So like, you don't have to, but it's there. π«Ά
int nc_abort(int ncid)
(Corresponds to ncabort() in version 2)
You don't need to call this function. This function is called automatically by nc_close() if the netCDF was in define mode and something goes wrong with the commit. If the netCDF dataset isn't in define mode, then this function is equivalent to nc_close(). If it is called after nc_redef(), but before nc_enddef(), the new definitions are not committed and the dataset is closed. If it is called after nc_create() but before nc_enddef(), the dataset disappears. π
int nc_close(int ncid)
(Corresponds to ncclose() in version 2)
Closes an open netCDF dataset. If the dataset is in define mode, nc_enddef() will be called before closing. After a dataset is closed, its ID may be reassigned to another dataset. Recycle, reuse, iconic. π
int nc_inq(int ncid, int* ndims, int* nvars, int* natts, int* unlimdimid)
int nc_inq_ndims(int ncid, int* ndims)
int nc_inq_nvars(int ncid, int* nvars)
int nc_inq_natts(int ncid, int* natts)
int nc_inq_unlimdim(int ncid, int* unlimdimid)
int nc_inq_format(int ncid, int* formatn)
Use these functions to find out what is in a netCDF dataset. Upon successful return, ndims will contain the number of dimensions defined for this netCDF dataset, nvars will contain the number of variables, natts will contain the number of attributes, and unlimdimid will contain the dimension ID of the unlimited dimension if one exists, or -1 otherwise. formatn will contain the version number of the dataset <format>, one of NC_FORMAT_CLASSIC, NC_FORMAT_64BIT_OFFSET, NC_FORMAT_NETCDF4, or NC_FORMAT_NETCDF4_CLASSIC. 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. Efficient queen behavior. π
int nc_def_dim(int ncid, const char name[], size_t len, int* dimid)
(Corresponds to ncdimdef() in version 2)
Adds a new dimension to an open netCDF dataset, which must be in define mode. name is the dimension name. If dimid is not a NULL pointer then upon successful completion dimid will contain the dimension ID of the newly created dimension. β¨
π USER DEFINED TYPES π
okay bestie, so β users many define types for a netCDF-4/HDF5 file (unless NC_CLASSIC_MODEL was used when the file was created, in which case nope, sorry, that door is locked π
). You can define compound types, variable length arrays, enumeration types, and opaque types. literally so much power.
int nc_def_compound(int ncid, size_t size, const char name[], int* typeidp)
Define a compound type. π
int nc_insert_compound(int ncid, nc_type , const char name[], size_t offset, nc_type field_typeid)
Insert an element into a compound type.
β οΈ May not be done after the type has been used, or after the type has been written by an enddef. so like... get it in early, bestie, that's the vibe check π«Ά
int nc_insert_array_compound(int ncid, nc_type , const char name[], size_t offset, nc_type field_typeid, int ndims, const int dim_sizes[])
Insert an array into a compound type.
int nc_inq_type(int ncid, nc_type , char name[], size_t* sizep)
Learn about a type. π
int nc_inq_compound(int ncid, nc_type , char name[], size_t* sizep, size_t* nfieldsp)
int nc_inq_compound_name(int ncid, nc_type , char name[])
int nc_inq_compound_size(int ncid, nc_type , size_t* sizep)
int nc_inq_compound_nfields(int ncid, nc_type , size_t* nfieldsp)
int nc_inq_compound_fieldname(int ncid, nc_type , int fieldid, char name[])
int nc_inq_compound_fieldindex(int ncid, nc_type , const char name[], int* fieldidp)
int nc_inq_compound_fieldoffset(int ncid, nc_type , int fieldid, size_t* offsetp)
int nc_inq_compound_fieldtype(int ncid, nc_type , int fieldid, nc_type* field_typeid)
int nc_inq_compound_fieldndims(int ncid, nc_type , int fieldid, int* ndims)
int nc_inq_compound_fielddim_sizes(int ncid, nc_type , int fieldid, int dim_sizes[])
Learn about a compound type. the whole little squad of inquiry functions up there π all doing their detective thing π
int nc_def_vlen(int ncid, const char name[], nc_type base_typeid, nc_type* xtypep)
Create a variable length array type. β¨
int nc_inq_vlen(int ncid, nc_type , char name[], size_t* datum_sizep, nc_type* base_nc_typep)
Learn about a variable length array type.
int nc_free_vlen(nc_vlen_t *vl)
Free memory consumed by reading data of a variable length array type. give it back, girl πΈ
int nc_put_vlen_element(int ncid, nc_type , void * vlen_element, size_t len, void * data)
Write one VLEN.
int nc_get_vlen_element(int ncid, nc_type , void ** vlen_element, size_t len, void ** data)
Read one VLEN.
int nc_free_string(size_t len, char **data)
Free memory consumed by reading data of a string type.
int nc_inq_user_type(int ncid, nc_type , char name[], size_t* , nc_type* , size_t* , int* )
Learn about a user define type.
int nc_def_enum(int ncid, nc_type base_typeid, const char name[], nc_type* typeidp)
Define an enumeration type. π
int nc_insert_enum(int ncid, nc_type base_typeid, const char name[], const void *value)
Insert a name-value pair into enumeration type.
int nc_inq_enum_member(int ncid, nc_type xtype, int idx, char name[], void *value)
int nc_inq_enum_ident(int ncid, nc_type xtype, int idx, long long value, char identifier[])
Learn about a name-value pair into enumeration type. π
int nc_def_opaque(int ncid, size_t size, const char name[], nc_type* xtypep)
Create an opaque type.
int nc_inq_opaque(int ncid, nc_type xtype, char name[], size_t* sizep)
Learn about opaque type. lowkey mysterious, highkey iconic π¦
πΈ GROUPS πΈ
Users may organize data into hierarchical groups in netCDF-4/HDF5 files (unless NC_CLASSIC_MODEL was used when creating the file β again, classic model said no groups for you π).
int nc_inq_grps(int ncid, int* numgrps, int ncids[])
Learn how many groups (and their ncids) are available from the group represented by ncid. counting the girlies π
int nc_inq_grpname(int ncid, char name[])
int nc_inq_grpname_full(int ncid, size_t* len, char name[])
int nc_inq_grpname_len(int ncid, size_t* len)
int nc_inq_grp_parent(int ncid, int* ncid)
int nc_inq_grp_ncid(int ncid, char name[], int* ncid)
int nc_inq_full_ncid(int ncid, char name[], int* ncid)
Learn about a group. π
int nc_inq_varids(int ncid, int* nvars, int* )
Get the varids in a group.
int nc_inq_dimids(int ncid, int* ndims, int* dimids, int include_parents)
Get the dimids in a group and (potentially) its parents. family tree energy fr fr π³
int nc_inq_typeids(int ncid, int* ntypes, int typeids[])
Get the typeids of user-defined types in a group.
int nc_def_grp(int ncid, char name[], int* ncid)
Create a group. slay, you're a parent now π«Ά
β¨ DIMENSIONS β¨
int nc_inq_dimid(int ncid, const char name[], int* dimid)
(Corresponds to ncdimid() in version 2)
Given a dimension name, returns the ID of a netCDF dimension in dimid. π
int nc_inq_dim(int ncid, int dimid, char name[], size_t* len)
int nc_inq_dimname(int ncid, int dimid, char name[])
int nc_inq_dimlen(int ncid, int dimid, size_t* len)
Use these functions to find out about a dimension. π« If either the name argument or len argument is a NULL pointer, then the associated information will not be returned β so like, no space needed, no info given, that's the deal. Otherwise, name should be big enough (NC_MAX_NAME) to hold the dimension name, because the name will be copied into your storage. The length return parameter, len, will contain the size of the dimension. For the unlimited dimension, the returned length is the current maximum value used for writing into any of the variables which use the dimension. π
int nc_rename_dim(int ncid, int dimid, const char name[])
(Corresponds to ncdimrename() in version 2)
Renames an existing dimension in an open netCDF dataset. If the new name is longer than the old name, the netCDF dataset must be in define mode. You cannot rename a dimension to have the same name as another dimension. no name-stealing in this house π«π
π VARIABLES π
int nc_def_var(int ncid, const char name[], nc_type xtype, int ndims, const int dimids[], int* varid)
(Corresponds to ncvardef() in version 2)
Adds a new variable to a netCDF dataset. The netCDF must be in define mode. If not NULL, then varid will be set to the netCDF variable ID. π
int nc_inq_varid(int ncid, const char name[], int* varid)
(Corresponds to ncvarid() in version 2)
Returns the ID of a netCDF variable in varid given its name.
int nc_inq_var(int ncid, int varid, char name[], nc_type* xtype, int* ndims, int dimids[], int* natts)
int nc_inq_varname(int ncid, int varid, char name[])
int nc_inq_vartype(int ncid, int varid, nc_type* xtype)
int nc_inq_varndims(int ncid, int varid, int* ndims)
int nc_inq_vardimid(int ncid, int varid, int dimids[])
int nc_inq_varnatts(int ncid, int varid, int* natts)
Returns information about a netCDF variable, given its ID. If any of the return parameters (name, xtype, ndims, dimids, or natts) is a NULL pointer, then the corresponding information will not be returned; hence, no space need be allocated for it. efficient queen π
int nc_rename_var(int ncid, int varid, const char name[])
(Corresponds to ncvarrename() in version 2)
Changes the name of a netCDF variable. 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. again with the no name-stealing rule π«
π¦ VARIABLES in NETCDF-4 FILES π¦
The following functions may only be used on variables in a netCDF-4/HDF5 data file. These functions must be called after the variable is defined, but before an enddef call. so like, timing is everything bestie β°β¨
int nc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int deflate_level)
Turn on compression and/or shuffle filter. (Shuffle filter is only useful for integer data.) ποΈ
int nc_inq_var_deflate(int ncid, int varid, int* shufflep, int* deflatep, int* deflate_levelp)
Learn about a variable's deflate settings.
int nc_def_var_fletcher32(int ncid, int varid, int fletcher32)
Turn on checksumming for a variable.
int nc_inq_var_fletcher32(int ncid, int varid, int* fletcher32)
Learn about checksumming for a variable. π
int nc_def_var_chunking(int ncid, int varid, int storage, const size_t chunksizesp[])
Set chunksizes for a variable.
int nc_inq_var_chunking(int ncid, int varid, int* storagep, size_t chunksizesp[])
Learn about chunksizes for a variable.
int nc_def_var_fill(int ncid, int varid, int no_fill, const size_t chunksizesp[])
Set a fill value for a variable.
int nc_inq_var_fill(int ncid, int varid, int* storagep, size_t chunksizesp[])
Learn the fill value for a variable. π
int nc_def_var_endian(int ncid, int varid, int endian)
Set endianness of variable.
int nc_inq_var_endian(int ncid, int varid, int* endianp)
Learn the endianness of a variable. big-endian or little-endian, both valid, both cute π
π WRITING AND READING WHOLE VARIABLES π
okay bestie, this is the whole vibe β you want the ENTIRE variable, every single value, no crumbs left behind. here's the put squad:
int nc_put_var_text(int ncid, int varid, const char out[])
int nc_put_var_uchar(int ncid, int varid, const unsigned char out[])
int nc_put_var_schar(int ncid, int varid, const signed char out[])
int nc_put_var_short(int ncid, int varid, const short out[])
int nc_put_var_int(int ncid, int varid, const int out[])
int nc_put_var_long(int ncid, int varid, const long out[])
int nc_put_var_float(int ncid, int varid, const float out[])
int nc_put_var_double(int ncid, int varid, const double out[])
int nc_put_var_ubyte(int ncid, int varid, const unsigned char out[])
int nc_put_var_ushort(int ncid, int varid, const unsigned short out[])
int nc_put_var_uint(int ncid, int varid, const unsigned int out[])
int nc_put_var_int64(int ncid, int varid, const long long out[])
int nc_put_var_uint64(int ncid, int varid, const unsigned long long
out[])
int nc_put_var_string(int ncid, int varid, const char * out[])
so what do these icons actually DO? they write an entire netCDF variable β like, all the values, the whole thing, periodt. π
- the netCDF dataset has to be open and in data mode, no exceptions bestie.
- the type of the data is right there in the function name (iykyk), and it gets converted to the external type of the variable you specified β if possible. if it's not possible? boom,
NC_ERANGEerror, and you get nothing. - π¨ lowkey important: rounding is NOT performed during the conversion. none. zero. floating point numbers are truncated when converted to integers. so
3.9is not becoming4, it's becoming3. that's just how it is fr fr.
and now the get side, the receiving energy π«Ά:
int nc_get_var_text(int ncid, int varid, char in[])
int nc_get_var_uchar(int ncid, int varid, unsigned char in[])
int nc_get_var_schar(int ncid, int varid, signed char in[])
int nc_get_var_short(int ncid, int varid, short in[])
int nc_get_var_int(int ncid, int varid, int in[])
int nc_get_var_long(int ncid, int varid, long in[])
int nc_get_var_float(int ncid, int varid, float in[])
int nc_get_var_double(int ncid, int varid, double in[])
int nc_get_var_ubyte(int ncid, int varid, unsigned char in[])
int nc_get_var_ushort(int ncid, int varid, unsigned short in[])
int nc_get_var_uint(int ncid, int varid, unsigned int in[])
int nc_get_var_int64(int ncid, int varid, long long in[])
int nc_get_var_uint64(int ncid, int varid, unsigned long long in[])
int nc_get_var_string(int ncid, int varid, char * in[])
these ones read an entire netCDF variable β again, all the values, the full send. π
- netCDF dataset: open β , data mode β .
- the data gets converted from the external type of the variable you specified to the type in the function name β if necessary.
- if that conversion isn't possible? you already know.
NC_ERANGEerror. π
β¨ WRITING AND READING ONE DATUM β¨
sometimes you don't want the whole buffet, you want one little snack. one value. a single datum. very demure, very mindful. π
the put-one squad:
int nc_put_var1_text(int ncid, int varid, const size_t index[], char
*out)
int nc_put_var1_uchar(int ncid, int varid, const size_t index[], unsigned char *out)
int nc_put_var1_schar(int ncid, int varid, const size_t index[], signed
char *out)
int nc_put_var1_short(int ncid, int varid, const size_t index[], short
*out)
int nc_put_var1_int(int ncid, int varid, const size_t index[], int *out)
int nc_put_var1_long(int ncid, int varid, const size_t index[], long
*out)
int nc_put_var1_float(int ncid, int varid, const size_t index[], float
*out)
int nc_put_var1_double(int ncid, int varid, const size_t index[], double
*out)
int nc_put_var1_ubyte(int ncid, int varid, const size_t index[], unsigned char *out)
int nc_put_var1_ushort(int ncid, int varid, const size_t index[], unsigned short *out)
int nc_put_var1_uint(int ncid, int varid, const size_t index[], unsigned
int *out)
int nc_put_var1_int64(int ncid, int varid, const size_t index[], long
long *out)
int nc_put_var1_uint64(int ncid, int varid, const size_t index[], unsigned long long *out)
int nc_put_var1_string(int ncid, int varid, const size_t index[], char *
*out)
so the deal: these put a single data value into a variable, at the position given by index, in an open netCDF dataset that's in data mode.
- the type of the data is in the function name, and it's converted to the external type of the specified variable if possible.
- if it's not possible β
NC_ERANGEerror. classic. π
and the get-one squad, catching that single value:
int nc_get_var1_text(int ncid, int varid, const size_t index[], char*
in)
int nc_get_var1_uchar(int ncid, int varid, const size_t index[], unsigned char* in)
int nc_get_var1_schar(int ncid, int varid, const size_t index[], signed
char* in)
int nc_get_var1_short(int ncid, int varid, const size_t index[], short*
in)
int nc_get_var1_int(int ncid, int varid, const size_t index[], int* in)
int nc_get_var1_long(int ncid, int varid, const size_t index[], long*
in)
int nc_get_var1_float(int ncid, int varid, const size_t index[], float*
in)
int nc_get_var1_double(int ncid, int varid, const size_t index[], double* in)
int nc_get_var1_ubyte(int ncid, int varid, const size_t index[], unsigned char* in)
int nc_get_var1_ushort(int ncid, int varid, const size_t index[], unsigned short* in)
int nc_get_var1_uint(int ncid, int varid, const size_t index[], unsigned
int* in)
int nc_get_var1_int64(int ncid, int varid, const size_t index[], long
long* in)
int nc_get_var1_uint64(int ncid, int varid, const size_t index[], unsigned long long* in)
int nc_get_var1_string(int ncid, int varid, const size_t index[], char
** in)
these get a single data value from a variable at the position index, from an open netCDF dataset in data mode. πΈ
- data is converted from the external type of the specified variable, if necessary, to the type in the function name.
- conversion not possible? you guessed it bestie β
NC_ERANGEerror.
π¦ WRITING AND READING AN ARRAY π¦
middle ground era!! not one value, not the whole variable β just a slice. a lil section. the start and count vectors are giving coordinates, and honestly? iconic. π
put the array section:
int nc_put_vara_text(int ncid, int varid, const size_t start[], const
size_t count[], const char out[])
int nc_put_vara_uchar(int ncid, int varid, const size_t start[], const
size_t count[], const unsigned char out[])
int nc_put_vara_schar(int ncid, int varid, const size_t start[], const
size_t count[], const signed char out[])
int nc_put_vara_short(int ncid, int varid, const size_t start[], const
size_t count[], const short out[])
int nc_put_vara_int(int ncid, int varid, const size_t start[], const
size_t count[], const int out[])
int nc_put_vara_long(int ncid, int varid, const size_t start[], const
size_t count[], const long out[])
int nc_put_vara_float(int ncid, int varid, const size_t start[], const
size_t count[], const float out[])
int nc_put_vara_double(int ncid, int varid, const size_t start[], const
size_t count[], const double out[])
int nc_put_vara_ubyte(int ncid, int varid, const size_t start[], const
size_t count[], const unsigned char out[])
int nc_put_vara_ushort(int ncid, int varid, const size_t start[], const
size_t count[], const unsigned short out[])
int nc_put_vara_uint(int ncid, int varid, const size_t start[], const
size_t count[], const unsigned int out[])
int nc_put_vara_int64(int ncid, int varid, const size_t start[], const
size_t count[], const long long out[])
int nc_put_vara_uint64(int ncid, int varid, const size_t start[], const
size_t count[], const unsigned long long out[])
int nc_put_vara_string(int ncid, int varid, const size_t start[], const
size_t count[], const char * out[])
these write an array section of values into a netCDF variable of an open netCDF dataset, which β say it with me β must be in data mode. β¨
- the array section is specified by the
startandcountvectors, which give the starting index and the count of values along each dimension of the specified variable. sostartsays where we begin,countsays how many we're grabbing per dimension. got it? got it. π - the type of the data is in the function name and gets converted to the external type of the specified variable if possible.
- if not possible β
NC_ERANGEerror. every time. no cap.
and finally, reading that section back out:
int nc_get_vara_text(int ncid, int varid, const size_t start[], const
size_t count[], char in[])
int nc_get_vara_uchar(int ncid, int varid, const size_t start[], const
size_t count[], unsigned char in[])
int nc_get_vara_schar(int ncid, int varid, const size_t start[], const
size_t count[], signed char in[])
int nc_get_vara_short(int ncid, int varid, const size_t start[], const
size_t count[], short in[])
int nc_get_vara_int(int ncid, int varid, const size_t start[], const
size_t count[], int in[])
int nc_get_vara_long(int ncid, int varid, const size_t start[], const
size_t count[], long in[])
int nc_get_vara_float(int ncid, int varid, const size_t start[], const
size_t count[], float in[])
int nc_get_vara_double(int ncid, int varid, const size_t start[], const
size_t count[], double in[])
int nc_get_vara_ubyte(int ncid, int varid, const size_t start[], const
size_t count[], unsigned char in[])
int nc_get_vara_ushort(int ncid, int varid, const size_t start[], const
size_t count[], unsigned short in[])
int nc_get_vara_uint(int ncid, int varid, const size_t start[], const
size_t count[], unsigned int in[])
int nc_get_vara_int64(int ncid, int varid, const size_t start[], const
size_t count[], long long in[])
int nc_get_vara_uint64(int ncid, int varid, const size_t start[], const
size_t count[], unsigned long long in[])
int nc_get_vara_string(int ncid, int varid, const size_t start[], const
size_t count[], char * in[])
these read an array section of values from a netCDF variable of an open netCDF dataset, which must be in data mode. π§
- the section is specified by the
startandcountvectors: starting index and count of values along each dimension of the specified variable. same duo, different direction. π«Ά - the data is converted from the external type of the specified variable, if necessary, to the type specified in the function name.
- if conversion is not possible β
NC_ERANGEerror, bestie. that's the rule and it is not going anywhere. π
β¨ WRITING AND READING A SLICED ARRAY β¨
Okay bestie, this is the strided era and honestly? It's a glow-up of the array section stuff you already know. π
Here's the whole put-side roster, every single flavor, no cap:
int nc_put_vars_text(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const char out[])
int nc_put_vars_uchar(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const unsigned char out[])
int nc_put_vars_schar(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const signed char out[])
int nc_put_vars_short(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const short out[])
int nc_put_vars_int(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const int out[])
int nc_put_vars_long(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const long out[])
int nc_put_vars_float(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const float out[])
int nc_put_vars_double(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const double out[])
int nc_put_vars_ubyte(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const unsigned char out[])
int nc_put_vars_ushort(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const unsigned short out[])
int nc_put_vars_uint(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const unsigned int out[])
int nc_put_vars_int64(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const long long out[])
int nc_put_vars_uint64(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const unsigned long long out[])
int nc_put_vars_string(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], const char * out[])
These cuties do strided output. π And what is strided output, you ask? It's literally the array section output we talked about above, except now you also get to say the sampling stride β aka the interval between the values you're actually touching β for each dimension. So you're not grabbing a solid block, you're grabbing every n-th thing. Sampling era. π¦
Want the full breakdown of the sampling stride vector? It lives in COMMON ARGUMENTS DESCRIPTIONS below, go read it, it's giving very important. π
Now the get side, the reading half of the equation, equally iconic:
int nc_get_vars_text(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], char in[])
int nc_get_vars_uchar(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], unsigned char in[])
int nc_get_vars_schar(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], signed char in[])
int nc_get_vars_short(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], short in[])
int nc_get_vars_int(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], int in[])
int nc_get_vars_long(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], long in[])
int nc_get_vars_float(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], float in[])
int nc_get_vars_double(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], double in[])
int nc_get_vars_ubyte(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], unsigned char in[])
int nc_get_vars_ushort(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], unsigned short in[])
int nc_get_vars_uint(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], unsigned int in[])
int nc_get_vars_int64(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], long long in[])
int nc_get_vars_uint64(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], unsigned long long in[])
int nc_get_vars_string(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], char * in[])
These are the strided input girlies. Same energy as the array section input from above, just with that sampling stride β the interval between accessed values β specified for every dimension. π
Yeah yeah, the sampling stride vector explanation is in COMMON ARGUMENTS DESCRIPTIONS below. Same place as before. Consistency queen. π
π WRITING AND READING A MAPPED ARRAY π
Mapped output is where it gets spicy, bestie. πΆοΈ Observe, the full put collection:
int nc_put_varm_text(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const char out[])
int nc_put_varm_uchar(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const unsigned char out[])
int nc_put_varm_schar(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const signed char out[])
int nc_put_varm_short(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const short out[])
int nc_put_varm_int(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const int out[])
int nc_put_varm_long(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const long out[])
int nc_put_varm_float(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const float out[])
int nc_put_varm_double(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const double out[])
int nc_put_varm_ubyte(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const unsigned char out[])
int nc_put_varm_ushort(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const unsigned short out[])
int nc_put_varm_uint(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const unsigned int out[])
int nc_put_varm_int64(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const long long out[])
int nc_put_varm_uint64(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const unsigned long long out[])
int nc_put_varm_string(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, const char * out[])
These do mapped output. π
It's exactly like the strided output up above β except β you also hand over an extra index mapping vector, and that vector is what tells the library how your data values are arranged in memory. Like, the file says one thing, your RAM says another, and imap is the translator. π§
Wanna know the whole index mapping vector situation? COMMON ARGUMENTS DESCRIPTIONS below. You know the drill. π«Ά
And finally, mapped input, the last of the mapped girlies, and look at them all:
int nc_get_varm_text(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, char in[])
int nc_get_varm_uchar(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, unsigned char in[])
int nc_get_varm_schar(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, signed char in[])
int nc_get_varm_short(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, short in[])
int nc_get_varm_int(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, int in[])
int nc_get_varm_long(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, long in[])
int nc_get_varm_float(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, float in[])
int nc_get_varm_double(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, double in[])
int nc_get_varm_ubyte(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, unsigned char in[])
int nc_get_varm_ushort(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, unsigned short in[])
int nc_get_varm_uint(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, unsigned int in[])
int nc_get_varm_int64(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, long long in[])
int nc_get_varm_uint64(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, unsigned long long in[])
int nc_get_varm_string(int ncid, int varid, const size_t start[], const size_t count[], const size_t stride[], imap, char * in[])
Mapped input. Same deal as the strided input above, except β again, the plot twist β there's that extra index mapping vector so you can spell out the in-memory arrangement of the data values. π¦β¨
And yes, the index mapping vector gets fully explained in COMMON ARGUMENTS DESCRIPTIONS below. Go, run, don't walk. πββοΈπ¨
π ATTRIBUTES π
okay bestie, this is the part where we talk about the lil metadata gremlins that hang off your variables (and your whole file). they're called attributes and they're iconic. here's the whole put/get family:
int nc_put_att_text(int ncid, int varid, const char name[], nc_type xtype, size_t len, const char out[])
int nc_put_att_uchar(int ncid, int varid, const char name[], nc_type xtype, size_t len, const unsigned char out[])
int nc_put_att_schar(int ncid, int varid, const char name[], nc_type xtype, size_t len, const signed char out[])
int nc_put_att_short(int ncid, int varid, const char name[], nc_type xtype, size_t len, const short out[])
int nc_put_att_int(int ncid, int varid, const char name[], nc_type xtype, size_t len, const int out[])
int nc_put_att_long(int ncid, int varid, const char name[], nc_type xtype, size_t len, const long out[])
int nc_put_att_float(int ncid, int varid, const char name[], nc_type xtype, size_t len, const float out[])
int nc_put_att_double(int ncid, int varid, const char name[], nc_type xtype, size_t len, const double out[])
int nc_put_att_ubyte(int ncid, int varid, const char name[], nc_type xtype, size_t len, const unsigned char out[])
int nc_put_att_ushort(int ncid, int varid, const char name[], nc_type xtype, size_t len, const unsigned short out[])
int nc_put_att_uint(int ncid, int varid, const char name[], nc_type xtype, size_t len, const unsigned int out[])
int nc_put_att_int64(int ncid, int varid, const char name[], nc_type xtype, size_t len, const long long out[])
int nc_put_att_uint64(int ncid, int varid, const char name[], nc_type xtype, size_t len, const unsigned long long out[])
int nc_put_att_string(int ncid, int varid, const char name[], nc_type xtype, size_t len, const char * out[])
int nc_put_att(int ncid, int varid, const char name[], nc_type xtype, size_t len, void * ip)
int nc_get_att(int ncid, int varid, const char name[], void ** ip)
so here's the tea: attributes do NOT get separate define-y and write-y functions like variables do. this whole family just defines a brand new attribute with a value or changes the value of one that already exists. one function, both jobs, multitasking queen π .
if the attribute is new, or if the space needed to store the attribute value is bigger than it was before, then the netCDF dataset has to be in define mode. no define mode, no growth, sorry bestie.
the len param is the number of values from out that get transferred. usually it's just one, except for nc_put_att_text() where it'll usually be strlen(out). yes, the classic.
for all of these, the type part of the function name is about the in-memory type of the value, while the xtype argument is about the external type used for storing it. and if a conversion between those two types is literally not possible, you get an NC_ERANGE error. in that case the value gets represented with the appropriate fill-value for the associated external type. so you get something, just not what you asked for π« .
next up, the vibes-detective:
int nc_inq_attname(int ncid, int varid, int attnum, char name[])
this one gets you the name of an attribute, if you hand it the variable ID and the attribute number. it's a lifesaver for generic applications that need to scoop up the names of every attribute on a variable, because β plot twist β every other attribute function accesses attributes by name, not by number. the number of an attribute is way more volatile than its name, since it can shift around when other attributes of the same variable get deleted π. attributes for each variable are numbered from 0 (the first attribute) to nvatts-1, where nvatts is the number of attributes for that variable, as returned from a call to nc_inq_varnatts(). and if the name parameter is a NULL pointer? no name gets returned and you don't need to allocate any space. free of charge β¨.
now the info desk squad:
int nc_inq_att(int ncid, int varid, const char name[], nc_type* xtype, size_t* len)
int nc_inq_attid(int ncid, int varid, const char name[], int* attnum)
int nc_inq_atttype(int ncid, int varid, const char name[], nc_type* xtype)
int nc_inq_attlen(int ncid, int varid, const char name[], size_t* len)
these return info about a netCDF attribute, given its variable ID and name. what you get back is the external type in xtype and the number of elements in the attribute as len. and if any of the return arguments is a NULL pointer, that particular piece of info just doesn't come back. no biggie.
okay, copying time:
int nc_copy_att(int ncid, int varid_in, const char name[], int ncid_out, int varid_out)
this copies an attribute from one netCDF dataset to another. and yes, it can also copy an attribute from one variable to another within the same netCDF, which is lowkey so useful. ncid_in is the netCDF ID of the input dataset you're copying from. varid_in is the ID of the variable in that input dataset you're copying from, or NC_GLOBAL for a global attribute. name is the name of the attribute in the input dataset that's getting copied.
ncid_out is the netCDF ID of the output dataset you're copying to. and honestly it's totally permissible for the input and output netCDF ID's to be the same π. the output dataset should be in define mode if the attribute being copied doesn't already exist for the target variable, or if it would cause an existing target attribute to grow. varid_out is the ID of the variable in the output dataset you're copying to, or NC_GLOBAL to copy to a global attribute.
renaming next:
int nc_rename_att(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. and heads up bestie: 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 getting assigned to that specified attribute. if the new name is longer than the old name, the netCDF dataset must be in define mode. (yes it says that twice, we love a double reminder π)
and deleting:
int nc_del_att(int ncid, int varid, const char name[])
deletes an attribute from a netCDF dataset. the dataset must be in define mode. that's the whole thing. bye attribute π.
and now the getter gang, aka reading your attributes back:
int nc_get_att_text(int ncid, int varid, const char name[], char in[])
int nc_get_att_uchar(int ncid, int varid, const char name[], unsigned char in[])
int nc_get_att_schar(int ncid, int varid, const char name[], signed char in[])
int nc_get_att_short(int ncid, int varid, const char name[], short in[])
int nc_get_att_int(int ncid, int varid, const char name[], int in[])
int nc_get_att_long(int ncid, int varid, const char name[], long in[])
int nc_get_att_float(int ncid, int varid, const char name[], float in[])
int nc_get_att_double(int ncid, int varid, const char name[], double in[])
int nc_get_att_ubyte(int ncid, int varid, const char name[], unsigned char in[])
int nc_get_att_ushort(int ncid, int varid, const char name[], unsigned short in[])
int nc_get_att_uint(int ncid, int varid, const char name[], unsigned int in[])
int nc_get_att_int64(int ncid, int varid, const char name[], long long in[])
int nc_get_att_uint64(int ncid, int varid, const char name[], unsigned long long in[])
int nc_get_att_string(int ncid, int varid, const char name[], char * in[])
these get the value(s) of a netCDF attribute, given its variable ID and name. they convert from the external type to the type named in the function, if that's possible β and if it's not, you get an NC_ERANGE error. all elements of the vector of attribute values come back, so you've gotta allocate enough space to hold them all. if you don't know how much space to reserve? call nc_inq_attlen() first to find out the length of the attribute. future you says thank you π«Ά.
β¨ COMMON ARGUMENT DESCRIPTIONS β¨
okay so before we get into the FUNCTION DESCRIPTIONS, bestie, we gotta define the little guys that show up EVERYWHERE. these are the shared vocab of the whole netCDF friend group π«Ά
int ncidβ it's the netCDF ID, and you only get it from a previous, successful call tonc_open()ornc_create(). no ID, no vibes.char name[]β the name of a dimension, variable, or attribute. these names are made of arbitrary sequences of alphanumeric characters (plus underscore'_', period'.'and hyphen'-'), and they have to begin with a letter or an underscore. BUT β names that start with underscore are reserved for system use, so hands off π. case is significant in netCDF names (soTempandtempare NOT the same girl). a zero-length name is not allowed. as an input argument it's a pointer to a 0-terminated string; as an output argument it's the address of a buffer to hold such a string. the max number of characters you can have (not counting that terminating 0) isNC_MAX_NAME.nc_type xtypeβ tells you the external data type of a netCDF variable or attribute, and it's one of these:NC_BYTE,NC_CHAR,NC_SHORT,NC_INT,NC_FLOAT, orNC_DOUBLE. in order those mean 8-bit integers, characters, 16-bit integers, 32-bit integers, 32-bit IEEE floating point numbers, and 64-bit IEEE floating-point numbers. (and yes,NC_INTcorresponds toNC_LONGin version 2, where it specifies a 32-bit integer β history, iconic.)int dimids[]β a vector of dimension ID's that defines the shape of a netCDF variable. the size of this vector must be greater than or equal to the rank (that's the number of dimensions,ndims) of the variable. and it's ordered by how fast a dimension varies:dimids[ndims-1]is the most rapidly varying dimension anddimids[0]is the most slowly varying one. the max possible number of dimensions for a variable is the symbolic constantNC_MAX_VAR_DIMS.int dimidβ the ID of a netCDF dimension. dimension ID's get allocated sequentially from the non-negative integers, starting at 0. πint ndimsβ either the total number of dimensions in a netCDF dataset, or the rank (number of dimensions) of a netCDF variable. it can't be negative and it can't be greater than the symbolic constantNC_MAX_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. variable ID's are also allocated sequentially from the non-negative integers starting at 0. so organized, so slay.int* nattsβ the number of global attributes in a netCDF dataset for thenc_inquire()function, or the number of attributes associated with a netCDF variable for thenc_varinq()function.const size_t index[]β the indicial coordinates of the netCDF data value you wanna access. indices start at 0, so for example the first data value of a two-dimensional variable is(0,0). the vector's size must be at least the rank of the associated netCDF variable, and its elements correspond, in order, to the variable's dimensions.const size_t start[]β the starting point for accessing a netCDF variable's data values, expressed as the indicial coordinates of the corner of the array section. indices start at 0, so the first data value of a variable is(0, 0, ..., 0). size must be at least the rank of the associated netCDF variable, elements correspond in order to the variable's dimensions.const size_t count[]β how many indices are selected along each dimension of the array section. so to grab a single value you'd specify count as(1, 1, ..., 1). heads up though: for strided I/O this argument has to be adjusted to be compatible with thestrideandstartarguments so that the three of them interacting don't try to access an invalid data co-ordinate π¨. the elements of the count vector correspond, in order, to the variable's dimensions.const size_t stride[]β the sampling interval along each dimension of the netCDF variable. the elements correspond in order to the netCDF variable's dimensions, andstride[0]gives the sampling interval along the most slowly varying dimension. sampling intervals are in type-independent units of elements (a value of 1 selects consecutive elements along that dimension, 2 selects every other element, etc.). aNULLstride argument is treated as(1, 1, ... , 1).imapβ the mapping between the dimensions of a netCDF variable and the in-memory structure of the internal data array. the elements of the index mapping vector correspond in order to the netCDF variable's dimensions, andimap[0]gives the distance between elements of the internal array corresponding to the most slowly varying dimension. distances are in type-independent units of elements (so the distance between internal elements sitting in adjacent memory locations is 1 β not the element's byte-length like it was in netCDF 2, ok bestie, glow-up). aNULLpointer means the memory-resident values have the same structure as the associated netCDF variable.
πΈ VARIABLE PREFILLING πΈ
so by default, the netCDF interface sets the values of all newly-defined variables of finite length (aka the ones that do NOT have an unlimited dimension) to the type-dependent fill-value associated with each variable. this happens when nc_enddef() is called. you can change a variable's fill-value from the default by defining the attribute _FillValue for that variable. that attribute has to have the same type as the variable and be of length one. β¨
variables with an unlimited dimension also get prefilled, but on an "as needed" basis. like, if the first write of such a variable goes to position 5, then positions 0 through 4 (and no others) would get set to the fill-value at the same time.
this default prefilling can be turned off by or'ing the NC_NOFILL flag into the mode parameter of nc_open() or nc_create(), or by calling the function nc_set_fill() with the argument NC_NOFILL. for variables that don't use the unlimited dimension, this call has to be made before nc_enddef(). for variables that DO use the unlimited dimension, this call can be made at any time. π
you can get increased performance out of the netCDF interface by using this feature, but ONLY at the cost of your app having to set every single data value itself. the performance-enhancing behavior of this function depends on the particulars of the implementation and dataset format. the flag value that nc_set_fill() controls is per netCDF ID, not per variable and not per write. letting this change affects how much a program can be effectively parallelized. given all of that, we're saying: the use of this feature may not be available (or even needed) in future releases. programmers are cautioned against heavy reliance upon this feature. π«
ok so that last part is basically the manpage gently telling you "don't get attached" π
int nc_setfill(int ncid, int fillmode, int* old_fillemode)
(Corresponds to ncsetfill() in version 2)
determines whether or not variable prefilling will be done (see above). the netCDF dataset must be writable. fillmode is either NC_FILL to enable prefilling (that's the default) or NC_NOFILL to disable it. this function returns the previous setting in old_fillmode.
π MPP FUNCTION DESCRIPTIONS π
these functions were used on archaic SGI/Cray MPP machines. they're retained for backward compatibility; the PE arguments must all be set to zero.
int nc__create_mp(const char path[], int cmode, size_t initialsize, int pe, size_t* chunksize, int* ncid)β likenc__create(). the argumentpemust be zero.int nc__open_mp(const char path[], int mode, int pe, size_t* chunksize, int* ncid)β likenc__open(). the argumentpemust be zero.int nc_inq_base_pe(int ncid, int* pe)β always returnspeof zero.int nc_set_base_pe(int ncid, int pe)β this function does nothing. π (literally nothing. icon of restraint.)
π ENVIRONMENT VARIABLES π
NETCDF_FFIOSPECβ specifies the Flexible File I/O buffers for netCDF I/O when executing under the UNICOS operating system (the variable is ignored on other operating systems). an appropriate specification can greatly increase the efficiency of netCDF I/O β to the extent that it can actually surpass FORTRAN binary I/O π₯. this environment variable has been made a little more generalized, such that other FFIO option specifications can now be added. the default specification isbufa:336:2, unless a current FFIO specification is in operation, which will be honored. see UNICOS Flexible File I/O for more information.
π MAILING-LISTS π
both a mailing list AND a digest are available for discussion of the netCDF interface and announcements about netCDF bugs, fixes, and enhancements. to begin or change your subscription to either one, send one of the following in the body (not the subject line) of an email message to "majordomo@unidata.ucar.edu". use your email address in place of 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
π SEE ALSO π
ncdump(1), ncgen(1), netcdf(3).
netCDF User's Guide, published by the Unidata Program Center, University Corporation for Atmospheric Research, located in Boulder, Colorado.
NetCDF home page at http:/www.unidata.ucar.edu/netcdf.
and that's the whole page, bestie, we did it π this version was printed on 2026-10-12, and the page itself dates back to 1997-04-18, and it lives under NETCDF(3). thank you for coming to my ted talk, go write some data, you're gonna slay π¦β¨
π¦ where this page comes from
- epel 10: netcdf-devel 4.9.2-7.el10_0 Β· BSD-3-Clause
- epel 10: netcdf-mpich-devel 4.9.2-7.el10_0 Β· BSD-3-Clause
- epel 10: netcdf-openmpi-devel 4.9.2-7.el10_0 Β· BSD-3-Clause
- fedora 43: netcdf-devel 4.9.2-15.fc43 Β· BSD-3-Clause
- fedora 43: netcdf-devel 4.9.2-15.fc43 Β· BSD-3-Clause
- fedora 43: netcdf-mpich-devel 4.9.2-15.fc43 Β· BSD-3-Clause
- fedora 43: netcdf-mpich-devel 4.9.2-15.fc43 Β· BSD-3-Clause
- fedora 43: netcdf-openmpi-devel 4.9.2-15.fc43 Β· BSD-3-Clause
- fedora 44: netcdf-devel 4.9.3-2.fc44 Β· BSD-3-Clause
- fedora 44: netcdf-devel 4.9.3-2.fc44 Β· BSD-3-Clause
- fedora 44: netcdf-mpich-devel 4.9.3-2.fc44 Β· BSD-3-Clause
- fedora 44: netcdf-mpich-devel 4.9.3-2.fc44 Β· BSD-3-Clause
- fedora 44: netcdf-openmpi-devel 4.9.3-2.fc44 Β· BSD-3-Clause
- nixos 26.05: netcdf 4.9.3
- nixos 26.05: netcdf-mpi 4.9.3
- opensuse-leap 16.0: netcdf-devel 4.9.2-bp160.1.5 Β· NetCDF
- opensuse-leap 16.0: netcdf-devel 4.9.2-bp160.1.5 Β· NetCDF
- opensuse-leap 16.0: netcdf-devel 4.9.2-bp160.1.5 Β· NetCDF
- opensuse-leap 16.0: netcdf-openmpi4-devel 4.9.2-bp160.1.5 Β· NetCDF
- opensuse-leap 16.0: netcdf-openmpi4-devel 4.9.2-bp160.1.5 Β· NetCDF
- opensuse-leap 16.0: netcdf-openmpi4-devel 4.9.2-bp160.1.5 Β· NetCDF
- opensuse-leap 16.0: netcdf-openmpi5-devel 4.9.2-bp160.1.1 Β· NetCDF
- opensuse-leap 16.0: netcdf-openmpi5-devel 4.9.2-bp160.1.1 Β· NetCDF
- opensuse-leap 16.0: netcdf-openmpi5-devel 4.9.2-bp160.1.1 Β· NetCDF
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms