PnetCDF(3f)

πŸŽ€ PnetCDF πŸŽ€

okay so bestie, welcome to the manual page for PnetCDF β€” a parallel library for accessing files in Network Common Data Form (CDF, CDF-2 and CDF-5 formats) β€” and this is PnetCDF(3f), the LIBRARY FUNCTIONS section. buckle up, we're doing this properly πŸ’…


✨ NAME ✨

PnetCDF β€” Parallel library for accessing files in Network Common Data Form (CDF, CDF-2 and CDF-5 formats). it's giving parallel I/O, it's giving big data, it's giving we do not do this one process at a time πŸ¦‹


🌸 SYNOPSIS 🌸

use pnetcdf

Most Systems

mpif90 ... -lpnetcdf

CRAY PVP Systems

f90 -dp -i64 ... -lpnetcdf

πŸ‘‘ LIBRARY VERSION πŸ‘‘

This document describes PnetCDF APIs for the Fortran-90 programming language. old money language, honestly iconic.

character*80 nf90mpi_inq_libvers()
character(len=80) :: nf90mpi_inq_libvers

Returns a string identifying the version of the PnetCDF library, and when it was built, like: "1.15.0 of 2026-07-01". so you literally always know what you're working with πŸ’–

The RCS ident(1) command will find a string like "$Id: @(#) PnetCDF library version 1.15.0 of 2026-07-01 $" in the library. The SCCS what(1) command will find a string like "PnetCDF library version 1.15.0 of 2026-07-01".


πŸ’… ROUTINE DESCRIPTIONS πŸ’…

okay so the queen rule of this whole library: all PnetCDF functions (except nf90mpi_inq_libvers() and nf90mpi_strerror()) return an integer status. This behavior replaces the rcode argument used in previous versions of the library. If this returned status value is not equal to nf90_noerr (zero), it indicates that an error occurred. The possible status values are defined in the module pnetcdf. so like β€” check your status, bestie, do not ignore it, it will humble you 😭


nf90mpi_strerror

function nf90mpi_strerror(ncerr)
       integer, intent(in) :: ncerr
       character(len=80) :: nf90mpi_strerror

Returns a string textual translation of the ncerr value, like "Attribute or variable name contains illegal characters" or "No such file or directory". it's your translator bestie πŸ’¬


nf90mpi_create

function nf90mpi_create(comm, path, cmode, info, ncid)
       integer, intent(in) :: comm
       character(len=*), intent(in) :: path
       integer, intent(in) :: cmode
       integer, intent(in) :: info
       integer, intent(out) :: ncid
       integer :: nf90mpi_create

Creates a new netCDF dataset at path collectively by a group of MPI processes specified by comm, returning a netCDF ID in ncid. yes, collectively, like a group chat making a decision 🫢

The argument cmode may include the bitwise-or of the following flags:

  • nf90_noclobber β€” protects existing datasets (protect the girls βœ‹)
  • nf90_clobber β€” the default, silently blows them away πŸ’€ (yes, "silently blows them away", that is literally the manpage's energy and I respect it)
  • nf90_64bit_offset β€” creates a file in the 64-bit offset format (CDF-2), as opposed to classic format, the default
  • nf90_64bit_data β€” creates a file in the 64-bit data format (CDF-5)

Use either nf90_64bit_offset or nf90_64bit_data. The 64-bit offset format allows the creation of very large files with far fewer restrictions than netCDF classic format, but can only be read by the netCDF library version 3.6 or greater. Users are cautioned that files that use the 64-bit offset format will not be recognized by netCDF applications linked to an earlier version of the netCDF library than 3.6. Applications linked to version 3.6 or later will be able to transparently access either the classic format or 64-bit offset format. The 64-bit data format allows the creation of very large array variables. CDF-5 files currently will not be recognized by netCDF 3 or 4 library.

⚠️ heads up bestie: the 64-bit offset format is not recognized by netCDF applications linked against a netCDF library earlier than 3.6, and CDF-5 files currently will not be recognized by netCDF 3 or 4 library. no cap.

The argument cmode must be consistent among all MPI processes that collectively create the file. The argument info is an MPI info object. Users can use it to supply the file access hints further performance improvement. The hints include existing MPI-IO hints as well as hints defined and used in PnetCDF.

When a netCDF dataset is created, it is opened in nf90_write mode. When this function returns, the new netCDF dataset is in define mode.


nf90mpi_open

function nf90mpi_open(comm, path, mode, info, ncid)
       integer, intent(in) :: comm
       character(len=*), intent(in) :: path
       integer, intent(in) :: mode
       integer, intent(in) :: info
       integer, intent(out) :: ncid
       integer :: nf90mpi_open

Opens an existing netCDF dataset at path collectively by a group of MPI processes specified by comm, returning a netCDF ID in ncid. The type of access is described by the mode parameter, which may include the bitwise-or of the following flags:

  • nf90_write β€” read-write access (default read-only)

The argument mode must be consistent among all MPI processes that collectively open the file. The argument info is an MPI info object. Users can use it to supply the file access hints further performance improvement. The hints include existing MPI-IO hints as well as hints defined and used in PnetCDF.


nf90mpi_redef

function nf90mpi_redef(ncid)
       integer, intent(in) :: ncid
       integer :: nf90mpi_redef

Puts an open netCDF dataset into define mode, so dimensions, variables, and attributes can be added or renamed and attributes can be deleted. glow-up mode for your file ✨


nf90mpi_enddef

function nf90mpi_enddef(ncid)
       integer, intent(in) :: ncid
       integer :: nf90mpi_enddef

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. After a successful call, variable data can be read or written to the dataset. say it with me: commit to disk, no take-backs πŸ’–


nf90mpi_sync

function nf90mpi_sync(ncid)
       integer, intent(in) :: ncid
       integer :: nf90mpi_sync

Data written by PnetCDF APIs may be cached by local file system on each compute node. This API flushes cached data by calling MPI_File_sync. your data said "let me out" and this is how πŸ¦‹


nf90mpi_flush

function nf90mpi_flush(ncid)
       integer, intent(in) :: ncid
       integer :: nf90mpi_flush

Flush the data in the buffer. short king, one line, does its job πŸ’…


nf90mpi_abort

function nf90mpi_abort(ncid)
       integer, intent(in) :: ncid
       integer :: nf90mpi_abort

You don't need to call this function. This function is called automatically by nf90mpi_close() if the netCDF dataset 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 nf90mpi_close(). If it is called after nf90mpi_redef(), but before nf90mpi_enddef(), the new definitions are not committed and the dataset is closed. If it is called after nf90mpi_create() but before nf90mpi_enddef(), the dataset disappears.

😭 bestie. the dataset disappears. not "is rolled back", not "is cleaned up" β€” disappears. read the above twice.

nf90mpi_close

function nf90mpi_close(ncid)
       integer, intent(in) :: ncid
       integer :: nf90mpi_close

Closes an open netCDF dataset. If the dataset is in define mode, nf90mpi_enddef() will be called before closing. After a dataset is closed, its ID may be reassigned to another dataset. so don't be out here texting an old ID, it might belong to somebody else now πŸ™ˆ


nf90mpi_inquire

function nf90mpi_inquire(ncid, ndims, nvars, natts, unlimdimid, nformat)
       integer, intent(in) :: ncid
       integer, optional, intent(out) :: ndims, nvars
       integer, optional, intent(out) :: natts, unlimdimid
       integer, optional, intent(out) :: nformat
       integer :: nf90mpi_inquire

Inquire about an open netCDF dataset. ncid is the netCDF ID of the open 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
  • unlimdimid will contain the dimension ID of the unlimited dimension if one exists, or 0 otherwise
  • nformat will contain the format version number, rarely needed because the library detects the format version and behaves appropriately

get the full 411 on your file, main character energy πŸ‘‘


nf90mpi_def_dim

function nf90mpi_def_dim(ncid, name, len, dimid)
       integer, intent(in) :: ncid
       character(len=*), intent(in) :: name
       integer, intent(in) :: len
       integer, intent(out) :: dimid
       integer :: nf90mpi_def_dim

Adds a new dimension to an open netCDF dataset, which must be in define mode. name is the dimension name. len is the size of the new dimension or nf90mpi_unlimited to define the unlimited dimension. On return, dimid will contain the dimension ID of the newly created dimension. 🌈


nf90mpi_inq_dimid

function nf90mpi_inq_dimid(ncid, name, dimid)
       integer, intent(in) :: ncid
       character(len=*), intent(in) :: name
       integer, intent(out) :: dimid
       integer :: nf90mpi_inq_dimid

Given an open netCDF dataset and dimension name, returns the dimension ID of the netCDF dimension in dimid. name β†’ ID, that's it, that's the function πŸ”


nf90mpi_inquire_dimension

function nf90mpi_inquire_dimension(ncid, dimid, name, len)
       integer, intent(in) :: ncid, dimid
       character(len=*), optional, intent(out) :: name
       integer, optional, intent(out) :: len
       integer :: nf90mpi_inquire_dimension

Inquire about a dimension. name should be big enough (nf90_max_name) to hold the dimension name as 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.

πŸŽ€ sizing note: your name buffer needs to fit nf90_max_name, bestie. do not under-buffer, she will humble you.

nf90mpi_rename_dim

function nf90mpi_rename_dim(ncid, dimid, name)
       integer, intent(in) :: ncid
       character(len=*), intent(in) :: name
       integer, intent(in) :: dimid
       integer :: nf90mpi_rename_dim

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 twins allowed, we're all unique here πŸ’…


nf90mpi_def_var

function nf90mpi_def_var(ncid, name, xtype, dimids, varid)
       integer, intent(in) :: ncid
       character(len=*), intent(in) :: name
       integer, intent(in) :: xtype
       integer, optional, dimension(:), intent(in) :: dimids
       integer :: nf90mpi_def_var

okay so this one adds a brand-new variable to a netCDF dataset, and there is one rule you cannot fumble: the netCDF must be in define mode. Like, do not try this in data mode bestie, that is not the vibe it wants. 🌸

name is gonna be the name of the netCDF variable β€” main character gets a name, iconic ✨

xtype is the external, netCDF type of the variable, and for CDF-1 and CDF-2 file formats it should be one of:

  • nf90_byte
  • nf90_char
  • nf90_short
  • nf90_int
  • nf90_float
  • nf90_double

And CDF-5 said "actually let me expand the roster πŸ’…" and defines these additional external types:

  • nf90_ubyte
  • nf90_ushort
  • nf90_uint
  • nf90_int64
  • nf90_uint64

Then there's the optional dimids argument, which lowkey decides your variable's entire personality, because it contains the dimension ID-s of the domain of the netCDF variable and, consequently, determines the rank of the created variable:

  • if dimids is omitted, then the netCDF variable will be a scalar (no dims, just vibes 🫢)
  • if dimids is a scalar, then the netCDF variable will be 1 dimensional
  • if dimids is a vector, then the netCDF variable will have rank equal to the number of elements in dimids

And varid will be set to the netCDF variable ID πŸŽ€


🌈 nf90mpi_inq_varid

       function nf90mpi_inq_varid(ncid, name, varid)
              integer, intent(in) :: ncid
              character(len=*), intent(in) :: name
              integer, intent(out) :: varid
              integer :: nf90mpi_inq_varid

Returns the ID of a netCDF variable in varid, given an open netCDF dataset and the name of the variable. Basically you hand over the name, and it hands you back the varid like "here bestie, found her πŸ’–"

🌟 nf90mpi_inquire_variable

       function nf90mpi_inquire_variable(ncid, varid, name, xtype, ndims, dimids, natts)
              integer, intent(in) :: ncid, varid
              character(len=*), optional, intent(out) :: name
              integer, optional, intent(out) :: xtype, ndims
              integer, dimension(*), optional, intent(out) :: dimids
              integer, optional, intent(out) :: natts
              integer :: nf90mpi_inquire_variable

Inquire about a netCDF variable in an open netCDF dataset, given its variable ID β€” the classic "so tell me about her" energy πŸ™ˆ

On return:

  • name will contain the name of the variable, and it should be capacious enough (nf90_max_name) β€” do not skimp on the buffer, she is long sometimes.
  • xtype will contain the external, netCDF type of the variable.
  • ndims will contain the dimensionality of the netCDF variable: if the variable is a scalar, then size(ndims) will be zero; otherwise, size(ndims) will be the rank of the variable, and ndims will contain the dimension ID-s of the netCDF dimensions that constitute the domain of the variable.
  • natts will contain the number of attributes associated with the netCDF variable.

πŸ¦‹ nf90mpi_rename_var

       function nf90mpi_rename_var(ncid, varid, name)
              integer, intent9in) :: ncid, varid
              character(len=*), intent(in) :: newname
              integer :: nf90mpi_rename_var

Changes the name of a netCDF variable. Heads up: if the new name is longer than the old name, the netCDF must be in define mode. And you cannot rename a variable to have the name of any existing variable β€” no name-stealing, that's not cute 🚫

πŸ’œ nf90mpi_put_var

       function nf90mpi_put_var(ncid, varid, values, start, stride, imap)
              integer, intent(in) :: ncid, varid
              <<whatever>>, intent(in) :: values
              integer, dimension(:), optional, intent(in) :: start
              integer, dimension(:), optional, intent(in) :: stride
              integer, dimension(:), optional, intent(in) :: imap
              integer :: nf90mpi_put_var

Writes a value or values to a netCDF variable. The netCDF dataset must be open and in data mode.

values contains the value(s) that will be written to the netCDF variable identified by ncid and varid; it may be a scalar or an array, and it must be of type:

  • character
  • integer(kind=OneByteInt)
  • integer(kind=TwoByteInt)
  • integer(kind=FourByteInt)
  • integer(kind=EightByteInt)
  • real(kind=FourByteReal)
  • real(kind=EightByteReal)

All values are converted to the external type of the netCDF variable, if possible; otherwise, an nf90_erange error is returned. 😭

  • The optional argument start specifies the starting index in the netCDF variable for writing for each dimension of the netCDF variable.
  • The optional argument stride specifies the sampling stride (the interval between accessed values in the netCDF variable) for each dimension of the netCDF variable (see COMMON ARGUMENT DESCRIPTIONS below).
  • The optional argument imap specifies the in-memory arrangement of the data values (see COMMON ARGUMENT DESCRIPTIONS below).

πŸ“ nf90mpi_get_var

       function nf90mpi_get_var(ncid, varid, values, start, stride, imap)
              integer, intent(in) :: ncid, varid
              <<whatever>>, intent(out) :: values
              integer, dimension(:), optional, intent(in) :: start
              integer, dimension(:), optional, intent(in) :: stride
              integer, dimension(:), optional, intent(in) :: imap
              integer :: nf90mpi_get_var

Reads a value or values from a netCDF variable. The netCDF dataset must be open and in data mode.

values will receive the value(s) that will be read from the netCDF variable identified by ncid and varid; it may be a scalar or an array, and it must be of type:

  • character
  • integer(kind=OneByteInt)
  • integer(kind=TwoByteInt)
  • integer(kind=FourByteInt)
  • integer(kind=EightByteInt)
  • real(kind=FourByteReal)
  • real(kind=EightByteReal)

All values are converted from the external type of the netCDF variable, if possible; otherwise, an nf90_erange error is returned. πŸ’€

  • The optional argument start specifies the starting index in the netCDF variable for reading for each dimension of the netCDF variable.
  • The optional argument stride specifies the sampling stride (the interval between accessed values in the netCDF variable) for each dimension of the netCDF variable (see COMMON ARGUMENT DESCRIPTIONS below).
  • The optional argument imap specifies the in-memory arrangement of the data values (see COMMON ARGUMENT DESCRIPTIONS below).

✨ nf90mpi_inquire_attribute

       function nf90mpi_inquire_attribute(ncid, varid, name, xtype, len, attnum)
              integer, intent(in) :: ncid, varid
              character(len=*), intent(in) :: name
              integer, optional, intent(out) :: xtype, len, attnum
              integer :: nf90mpi_inquire_attribute

Inquires about the netCDF attribute named name, of variable varid, in the open netCDF dataset ncid. The gossip it gives you back:

  • xtype will contain the external, netCDF type of the variable.
  • len will contain the number of elements in the attribute.
  • attnum will contain the attribute number.

🧚 nf90mpi_inq_attname

       function nf90mpi_inq_attname(ncid, varid, attnum, name)
              integer, intent(in) :: ncid, varid, attnum
              character(len=*), intent(out) :: name
              integer :: nf90mpi_inq_attname

Gets the name of an attribute, given its variable ID and attribute number. This function is useful in generic applications that need to get the names of all the attributes associated with a variable, because attributes are accessed by name rather than number in all other attribute functions (the number of an attribute is more volatile than the name, because it can change when other attributes of the same variable are deleted β€” messy, honestly πŸ™ˆ).

The attributes for each variable are numbered from 1 (the first attribute) to natts, where natts is the number of attributes for the variable, as returned from a call to nf90mpi_inquire_variable().

πŸŽ€ nf90mpi_put_att

       function nf90mpi_put_att(ncid, varid, name, values)
              integer, intent(in) :: ncid, varid
              character(len=*), intent(in) :: name
              <<whatever>>, intent(in) :: values
              integer :: nf90mpi_put_att

Unlike variables, attributes do not have separate functions for defining and writing values β€” she does both, multitasking queen πŸ‘‘

This function defines a new attribute with a value, or changes the value of an existing attribute. If the attribute is new, or if the space required to store the attribute value is greater than before, the netCDF dataset must be in define mode.

values contains the attribute values to be written; it may be a scalar or a vector, and it must be of type:

  • character
  • integer(kind=OneByteInt)
  • integer(kind=TwoByteInt)
  • integer(kind=FourByteInt)
  • integer(kind=EightByteInt)
  • real(kind=FourByteReal)
  • real(kind=EightByteReal)

πŸ’– nf90mpi_get_att

       function nf90mpi_get_att(ncid, varid, name, fIvalues)
              integer, intent(in) :: ncid, varid
              character(len=*), intent(in) :: name
              <<whatever>>, intent(out) :: values
              integer :: nf90mpi_get_att

Gets the value(s) of a netCDF attribute, given its variable ID and name. The values are returned in values, which must be of type:

  • character
  • integer(kind=OneByteInt)
  • integer(kind=TwoByteInt)
  • integer(kind=FourByteInt)
  • integer(kind=EightByteInt)
  • real(kind=FourByteReal)
  • real(kind=EightByteReal)

Converts from the external type to the type of the receiving variable, if possible; otherwise returns an nf90_erange error. 😀

All values of the attribute are returned, so you must allocate enough space to hold them. And if you don't know how much space to reserve, call nf90mpi_inquire_attribute() first to find out the length of the attribute β€” do your homework bestie, it saves you every time 🫢

🌈 nf90mpi_copy_att

       function nf90mpi_copy_att(ncid_in, varid_in, name, ncid_out, varid_out)
              integer, intent(in) :: ncid_in, varid_in
              character(len=*), intent(in) :: name
              integer, intent(in) :: ncid_out, varid_out
              integer :: nf90mpi_copy_att

This next one copies an attribute from one netCDF dataset to another πŸ’« and lowkey it's also got you if you just wanna move an attribute from one variable to another inside the same netCDF dataset. ncid_in is the netCDF ID of the input netCDF dataset you're copying from. varid_in is the ID of the variable in that input dataset that owns the attribute you want, or nf90_global if it's a global attribute we're talking about. name is the name of the attribute in the input netCDF dataset that's getting copied. ncid_out is the netCDF ID of the output netCDF dataset you're copying to. And yes bestie, it is totally permissible for the input and output netCDF ID's to be the same one. The output netCDF dataset should be in define mode if the attribute you're copying doesn't already exist for the target variable, or if copying it would make an existing target attribute grow. varid_out is the ID of the variable in the output netCDF dataset receiving the attribute, or nf90_global to copy it to a global attribute. 🫢


function nf90mpi_rename_att(ncid, varid, name, newname)
       integer, intent(in) :: ncid, varid
       character(len=*), intent(in) :: name, newname
       integer :: nf90mpi_rename_att

Changes the name of an attribute ✨. If the new name is longer than the original name, the netCDF must be in define mode β€” no exceptions, that's the rule. You cannot rename an attribute to have the same name as another attribute of the same variable, so don't even try it πŸ’€. name is the original attribute name. newname is the new name you're assigning to the specified attribute. And yeah, saying it twice: if the new name is longer than the old name, the netCDF dataset must be in define mode. πŸ“

function nf90mpi_del_att(ncid, varid, name)
       integer, intent(in) :: ncid, varid
       character(len=*), intent(in) :: name
       integer :: nf90mpi_del_att

Deletes an attribute from a netCDF dataset πŸ—‘οΈ. The dataset must be in define mode. That's the whole vibe, no notes.


🌈 COMMON ARGUMENT DESCRIPTIONS 🌈

Okay so in this section we define some common arguments that get used over in the "FUNCTION DESCRIPTIONS" section. Same characters, same energy, every time. πŸ’…

integer ncid

is the netCDF ID returned from a previous, successful call to nf90mpi_open() or nf90mpi_create(). If that call didn't succeed, this isn't the vibe you think it is. πŸ™ˆ

character(len=*) name

is the name of a dimension, variable, or attribute. It shall begin with an alphabetic character, followed by zero or more alphanumeric characters including the underscore (_) or hyphen (-). Case is significant (so Name and name are two entirely different girls). The maximum allowable number of characters is nf90_max_name. Names that begin with an underscore (_) are reserved for use by the netCDF and PnetCDF interfaces β€” like, hands off, that's theirs. πŸ‘‘

integer xtype

specifies the external data type of a netCDF variable or attribute and is one of the following: nf90_byte, nf90_char, nf90_short, nf90_int, nf90_float, or nf90_double. These are used to specify 8-bit integers, characters, 16-bit integers, 32-bit integers, 32-bit IEEE floating point numbers, and 64-bit IEEE floating-point numbers, respectively. Pick your type, pick your destiny ⭐.

integer dimids

is a vector of dimension ID's and defines the shape of a netCDF variable. The size of the vector shall be greater than or equal to the rank (i.e. the number of dimensions) of the variable (ndims). The vector shall be ordered by the speed with which a dimension varies: dimids(1) shall be the dimension ID of the most rapidly varying dimension and dimids(ndims) shall be the dimension ID of the most slowly varying dimension. The maximum possible number of dimensions for a variable is given by the symbolic constant nf90_max_var_dims. Order matters, bestie, it always matters πŸŒ€.

integer dimid

is the ID of a netCDF dimension. netCDF dimension ID's are allocated sequentially from the positive integers beginning with 1. Counting from one, like nature intended πŸ’–.

integer ndims

is either the total number of dimensions in a netCDF dataset or the rank (i.e. the number of dimensions) of a netCDF variable. The value shall not be negative or greater than the symbolic constant nf90_max_var_dims. So, like, zero and up, and not more than the cap. πŸŽ€

integer varid

is the ID of a netCDF variable or (for the attribute-access functions) the symbolic constant nf90_global, which is used to reference global attributes. netCDF variable ID's are allocated sequentially from the positive integers beginning with 1. Same sequential-from-one energy πŸ¦‹.

integer natts

is the number of global attributes in a netCDF dataset for the nf90mpi_inquire() function or the number of attributes associated with a netCDF variable for the nf90mpi_varinq() function. Two functions, two meanings, one int πŸ“Š.

integer(kind=MPI_OFFSET) start

specifies the starting point for accessing a netCDF variable's data values in terms of the indicial coordinates of the corner of the array section. The indices start at 1; thus, the first data value of a variable is (1, 1, ..., 1). 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. πŸ“

integer(kind=MPI_OFFSET) stride

specifies the sampling interval along each dimension of the netCDF variable. The elements of the stride vector correspond, in order, to the netCDF variable's dimensions (stride(1) gives the sampling interval along the most rapidly varying dimension of the netCDF variable). Sampling intervals are specified in type-independent units of elements (a value of 1 selects consecutive elements of the netCDF variable along the corresponding dimension, a value of 2 selects every other element, etc.). Skip-skip-skip, we love a little ✨sampling✨ moment.

integer(kind=MPI_OFFSET) imap

specifies 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 (imap gives the distance between elements of the internal array corresponding to the most rapidly varying dimension of the netCDF variable). Distances between elements are specified in type-independent units of elements (the distance between internal elements that occupy adjacent memory locations is 1 and not the element's byte-length as in netCDF 2). 🧠


🧚 VARIABLE PREFILLING 🧚

Okay, history lesson: prior to version 1.6.1, PnetCDF does not support data filling. The default fill mode in PnetCDF is NF90_NOFILL. This is contrary to the netCDF library, whose default is NF90_FILL. Very "we do things differently here" of it, honestly πŸ’….

When fill mode is enabled, PnetCDF sets the values of all newly-defined variables of finite length (i.e. those that do not have an unlimited dimension) to the type-dependent fill-value associated with each variable. This happens when nf90mpi_enddef() 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 β€” one type, one element, no negotiations. 🌸

Variables with an unlimited dimension are not prefilled in PnetCDF. This is also contrary to netCDF, which does prefill record variables. In PnetCDF, filling a record variable must be done by calling nf90mpi_fill_var_rec(). Note this fills only one record of a variable β€” just one, bestie, don't get greedy. 😭

The fill mode for the entire file can be set by nf90mpi_set_fill(). Per-variable fill mode setting is also available through nf90mpi_def_var_fill(). In PnetCDF, changing fill mode must be done in define mode. In netCDF, it is true only for fixed-size variables. For record variables, changing fill mode can be made at any time in netCDF. Yes this is a whole difference, yes it matters, write it down πŸ“.


πŸ”₯ ENVIRONMENT VARIABLES πŸ”₯

  • PNETCDF_SAFE_MODE β€” set it to 1 to enable the metadata consistency check. Warning messages will be printed to stdout if any inconsistency is detected. Safety girl summer πŸ›‘οΈ.

πŸ’Œ MAILING-LISTS πŸ’Œ

A mailing list is available for discussion of the PnetCDF interface and announcements about PnetCDF bugs, fixes, and enhancements. To subscribe or unsubscribe to the PnetCDF mailing list, visit https://lists.mcs.anl.gov/mailman/listinfo/parallel-netcdf. Come hang out, the group chat is open 🫢✨


πŸ‘€ SEE ALSO πŸ‘€

The little squad of tools you should absolutely go read next, iykyk πŸ’œ


πŸ—“οΈ DATE πŸ—“οΈ

July 1, 2026

PnetCDF User's Guide, published by Northwestern University and Argonne National Laboratory. This document is adopted from the netCDF User's Guide, developed at the Unidata Program Center, University Corporation for Atmospheric Research, located in Boulder, Colorado. 🌎

PnetCDF home page at https://parallel-netcdf.github.io 🏠


And that's a wrap on the whole page, bestie πŸŽ€ printed 2026.11.02, running PnetCDF 1.15.0, and yeah it's the PnetCDF(3f) manual. Slay, you read the entire thing, that's main character energy fr fr βœ¨πŸ‘‘πŸ’…

πŸ“¦ where this page comes from