mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
1014 lines
34 KiB
Groff
1014 lines
34 KiB
Groff
.TH NETCDF 3f90 "2000-04-04" "Printed: \n(yr.\n(mo.\n(dy" "UNIDATA LIBRARY FUNCTIONS"
|
|
.SH NAME
|
|
netcdf \- Unidata Network Common Data Form (netCDF) library, version 3 interface
|
|
.SH SYNOPSIS
|
|
.ft B
|
|
.na
|
|
.nh
|
|
use netcdf
|
|
.sp
|
|
.SS Most Systems:
|
|
f90 ... -lnetcdf
|
|
.sp
|
|
.SS CRAY PVP Systems:
|
|
f90 -dp -i64 ... -lnetcdf
|
|
|
|
.ad
|
|
.hy
|
|
.SH "LIBRARY VERSION"
|
|
.LP
|
|
This document describes version 3 of Unidata netCDF data-access interface
|
|
for the Fortran-90 programming language.
|
|
.HP
|
|
\fBcharacter*80 nf90_inq_libvers(\|)
|
|
.RS
|
|
character(len=80) :: nf90_inq_libvers\fR
|
|
.RE
|
|
.sp
|
|
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 $".
|
|
.LP
|
|
The RCS \fBident(1)\fP command will find a string like
|
|
"$\|Id: @\|(#) netcdf library version 3.1a of Sep 6 1996 15:56:26 $"
|
|
in the library. The SCCS \fBwhat(1)\fP command will find a string like
|
|
"netcdf library version 3.1a of Aug 23 1996 16:07:40 $".
|
|
.SH "ROUTINE DESCRIPTIONS"
|
|
.LP
|
|
All netCDF functions (except
|
|
\fBnf90_inq_libvers(\|)\fR and \fBnf90_strerror(\|)\fR) return an integer
|
|
status.
|
|
This behavior replaces the \fBrcode\fR argument
|
|
used in previous versions of the library.
|
|
If this returned status value is not equal to
|
|
\fBnf90_noerr\fR (zero), it
|
|
indicates that an error occurred. The possible status values are defined in
|
|
the module \fBnetcdf\fP.
|
|
.HP
|
|
\fBfunction nf90_strerror(\fIncerr\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncerr
|
|
character(len=80) :: nf90_strerror
|
|
.fi
|
|
.sp
|
|
Returns a string textual translation of the \fIncerr\fP
|
|
value, like "Attribute or variable name contains illegal characters"
|
|
or "No such file or directory".
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_create(\fIpath\fP, \fIcmode\fP, \fIncid\fP)\fR
|
|
.RS
|
|
.nf
|
|
character(len=*), intent(in) :: path
|
|
integer, intent(in) :: cmode
|
|
integer, optional, intent(in) :: initialsize
|
|
integer, optional, intent(inout) :: chunksize
|
|
integer, intent(out) :: ncid
|
|
integer :: nf90_create
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBnccre(\|)\fR in version 2)
|
|
.sp
|
|
Creates a new netCDF dataset at \fIpath\fP,
|
|
returning a netCDF ID in \fIncid\fP.
|
|
The argument \fIcmode\fP may include the bitwise-or
|
|
of the following flags:
|
|
\fBnf90_noclobber\fR
|
|
to protect existing datasets (default
|
|
silently blows them away),
|
|
\fBnf90_share\fR
|
|
for synchronous dataset updates
|
|
(default is to buffer accesses), and
|
|
\fBnf90_lock\fR
|
|
(not yet implemented).
|
|
When a netCDF dataset is created, is is opened
|
|
\fBnf90_write\fR.
|
|
The new netCDF dataset is in define mode.
|
|
.sp
|
|
The optional argument \fIinitialsize\fP sets the initial size of the file at
|
|
creation time.
|
|
.sp
|
|
See \fBnf__open(\|)\fR below for an explanation of the optional
|
|
\fIchunksize\fP argument.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_open(\fIpath\fP, \fImode\fP, \fIncid\fP, \fIchunksize\fP)\fR
|
|
.RS
|
|
.nf
|
|
character(len=*), intent(in) :: path
|
|
integer, intent(in) :: mode
|
|
integer, intent(out) :: ncid
|
|
integer, optional, intent(inout) :: chunksize
|
|
integer :: nf90_open
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncopn(\|)\fR in version 2)
|
|
.sp
|
|
Opens a existing netCDF dataset at \fIpath\fP
|
|
returning a netCDF ID
|
|
in \fIncid\fP.
|
|
As of NetCDF version 4.1, and if DAP support was enabled
|
|
when the library was built, the path may instead specify
|
|
a DAP URL (refer to the NetCDF user's manual for details).
|
|
.sp
|
|
The type of access is described by the \fImode\fP parameter,
|
|
which may include the bitwise-or
|
|
of the following flags:
|
|
\fBnf90_write\fR
|
|
for read-write access (default
|
|
read-only),
|
|
\fBnf90_share\fR
|
|
for synchronous dataset updates (default is
|
|
to buffer accesses), and
|
|
\fBnf90_lock\fR
|
|
(not yet implemented).
|
|
.sp
|
|
The optional argument referenced by \fIchunksize\fP 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 \fBnf90_sizehint_default\fR 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
|
|
\fBstat()\fR system call, \fBstruct stat\fR member \fBst_blksize\fR.
|
|
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.
|
|
.sp
|
|
The chunksize is a property of a given open netcdf descriptor
|
|
\fIncid\fP: it is not a persistent property of the netcdf dataset.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_set_fill(\fIncid\fP, \fIfillmode\fP, \fIold_mode\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid, fillmode
|
|
integer, intent(out) :: old_mode
|
|
integer :: nf90_set_fill
|
|
.fi
|
|
.sp
|
|
Sets the fill-mode for a netCDF dataset to optimize writes under some
|
|
circumstances.
|
|
The fill-mode argument, \fIfillmode\fP, can be either \fBnf90_fill\fP or
|
|
\fBnf90_nofill\fP.
|
|
\fBnf90_fill\fP causes fill-values to be written into non-record variables
|
|
and into skipped-over records when writing beyond the last valid record.
|
|
\fBnf90_nofill\fP suspends this behavior.
|
|
The default behavior corresponds to \fBnf90_fill\fP.
|
|
.sp
|
|
The previous fill-mode value is return in \fIold_mode\fP.
|
|
.sp
|
|
The fill-mode is a property of a given open netcdf descriptor
|
|
\fIncid\fP: it is not a persistent property of the netcdf dataset.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_redef(\fIncid\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid
|
|
integer :: nf90_redef
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncredf(\|)\fR in version 2)
|
|
.sp
|
|
Puts an open netCDF dataset into define mode,
|
|
so dimensions, variables, and attributes can be added or renamed and
|
|
attributes can be deleted.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_enddef(\fIncid\fP, \fIh_minfree\fP, \fIv_align\fP,
|
|
\fIv_minfree\fP, \fIr_align\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid
|
|
integer, optional, intent(in) :: h_minfree, v_align
|
|
integer, optional, intent(in) :: v_minfree, r_align
|
|
integer :: nf90_enddef
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncendf(\|)\fR in version 2)
|
|
.sp
|
|
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.
|
|
.sp
|
|
The optional arguments are performance tuning parameters.
|
|
They exposes internals of the netcdf version 1 file
|
|
format and may not be available on future netcdf implementations.
|
|
.sp
|
|
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.
|
|
.sp
|
|
The minfree parameters allow one to control costs of future calls
|
|
to \fBnf90_redef(\|)\fR, \fBnf90_enddef(\|)\fR by requesting that \fIminfree\fP bytes be
|
|
available at the end of the section.
|
|
The \fIh_minfree\fP parameter sets the pad
|
|
at the end of the "header" section. The \fIv_minfree\fP parameter sets
|
|
the pad at the end of the data section for fixed size variables.
|
|
.sp
|
|
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
|
|
\fBnf90_align_chunk\fR tells the library to use the chunksize (see above)
|
|
as the align parameter.
|
|
The \fIv_align\fP parameter controls the alignment of the beginning of
|
|
the data section for fixed size variables.
|
|
The \fIr_align\fP parameter controls the alignment of the beginning of
|
|
the data section for variables which have an unlimited dimension (record
|
|
variables).
|
|
.sp
|
|
The file format requires mod 4 alignment, so the align parameters
|
|
are silently rounded up to multiples of 4. The usual call,
|
|
\fBnf90_enddef(\fIncid\fP)\fR
|
|
is equivalent to
|
|
\fBnf__enddef(\fIncid\fP, 0, 4, 0, 4)\fR.
|
|
.sp
|
|
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.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_sync(\fIncid\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid
|
|
integer :: nf90_sync
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncsnc(\|)\fR in version 2)
|
|
.sp
|
|
Unless the
|
|
\fBnf90_share\fR
|
|
bit is set in
|
|
\fBnf90_open(\|)\fR or \fBnf90_create(\|)\fR,
|
|
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
|
|
\fBnf90_close(\|)\fR and \fBnf90_enddef(\|)\fR.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_abort(\fIncid\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid
|
|
integer :: nf90_abort
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncabor(\|)\fR in version 2)
|
|
.sp
|
|
You don't need to call this function.
|
|
This function is called automatically by
|
|
\fBnf90_close(\|)\fR
|
|
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
|
|
\fBnf90_close(\|)\fR.
|
|
If it is called after
|
|
\fBnf90_redef(\|)\fR,
|
|
but before
|
|
\fBnf90_enddef(\|)\fR,
|
|
the new definitions are not committed and the dataset is closed.
|
|
If it is called after
|
|
\fBnf90_create(\|)\fR
|
|
but before
|
|
\fBnf90_enddef(\|)\fR,
|
|
the dataset disappears.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_close(\fIncid\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid
|
|
integer :: nf90_close
|
|
.fi
|
|
.sp
|
|
(Corresponds to
|
|
\fBncclos(\|)\fR in version 2)
|
|
.sp
|
|
Closes an open netCDF dataset.
|
|
If the dataset is in define mode,
|
|
\fBnf90_enddef(\|)\fR
|
|
will be called before closing.
|
|
After a dataset is closed, its ID may be reassigned to another dataset.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_inquire(\fIncid\fP, \fIndims\fP, \fInvars\fP,
|
|
\fInatts\fP, \fIunlimdimid\fP, \fInformat\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid
|
|
integer, optional, intent(out) :: ndims, nvars
|
|
integer, optional, intent(out) :: natts, unlimdimid
|
|
integer, optional, intent(out) :: nformat
|
|
integer :: nf90_inquire
|
|
.fi
|
|
.sp
|
|
Inquire about an open netCDF dataset.
|
|
\fIncid\fP is the netCDF ID of the open dataset.
|
|
Upon successful return,
|
|
\fIndims\fP will contain the
|
|
number of dimensions defined for this netCDF dataset,
|
|
\fInvars\fP will contain the number of variables,
|
|
\fInatts\fP will contain the number of attributes, and
|
|
\fIunlimdimid\fP will contain the
|
|
dimension ID of the unlimited dimension if one exists, or
|
|
0 otherwise.
|
|
\fInformat\fP will contain the format version number, rarely needed
|
|
because the library detects the format version and behaves
|
|
appropriately.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_def_dim(\fIncid\fP, \fIname\fP, \fIlen\fP, \fIdimid\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid
|
|
character(len=*), intent(in) :: name
|
|
integer, intent(in) :: len
|
|
integer, intent(out) :: dimid
|
|
integer :: nf90_def_dim
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncddef(\|)\fR in version 2)
|
|
.sp
|
|
Adds a new dimension to an open netCDF dataset, which must be
|
|
in define mode.
|
|
\fIname\fP is the dimension name.
|
|
\fIlen\fP is the size of the new dimension or \fBnf90_unlimited\fP to define
|
|
the unlimited dimension.
|
|
On return, \fIdimid\fP will contain the dimension ID of the newly created
|
|
dimension.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_inq_dimid(\fIncid\fP, \fIname\fP, \fIdimid\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid
|
|
character(len=*), intent(in) :: name
|
|
integer, intent(out) :: dimid
|
|
integer :: nf90_inq_dimid
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncdid(\|)\fR in version 2)
|
|
.sp
|
|
Given an open netCDF dataset and dimension name, returns the dimension ID of the
|
|
netCDF dimension in \fIdimid\fP.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_inquire_dimension(\fIncid\fP, \fIdimid\fP, \fIname\fP, \fIlen\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid, dimid
|
|
character(len=*), optional, intent(out) :: name
|
|
integer, optional, intent(out) :: len
|
|
integer :: nf90_inquire_dimension
|
|
.fi
|
|
.sp
|
|
Inquire about a dimension.
|
|
\fIname\fP should be big enough (\fBnf90_max_name\fR)
|
|
to hold the dimension name as the name will be copied into your storage.
|
|
The length return parameter, \fIlen\fP
|
|
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.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_rename_dim(\fIncid\fP, \fIdimid\fP, \fIname\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid
|
|
character(len=*), intent(in) :: name
|
|
integer, intent(in) :: dimid
|
|
integer :: nf90_rename_dim
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncdren(\|)\fR in version 2)
|
|
.sp
|
|
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.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_def_var(\fIncid\fP, \fIname\fP, \fIxtype\fP, \fIdimids\fP, \fIvarid\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid
|
|
character(len=*), intent(in) :: name
|
|
integer, intent(in) :: xtype
|
|
integer, optional, dimension(:), intent(in) :: dimids
|
|
integer :: nf90_def_var
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncvdef(\|)\fR in version 2)
|
|
.sp
|
|
Adds a new variable to a netCDF dataset. The netCDF must be in define mode.
|
|
\fIname\fP will be the name of the netCDF variable.
|
|
\fIxtype\fP is the external, netCDF type of the variable and should be one of
|
|
\fBnf90_byte\fP,
|
|
\fBnf90_char\fP,
|
|
\fBnf90_short\fP,
|
|
\fBnf90_int\fP,
|
|
\fBnf90_float\fP, or
|
|
\fBnf90_double\fP,
|
|
The optional \fIdimids\fP argument contains the dimension ID-s of the domain
|
|
of the netCDF variable and, consequently, determines the rank of the
|
|
created variable:
|
|
if \fIdimids\fP is omitted, then the netCDF variable will be a scalar;
|
|
if \fIdimids\fP is a scalar, then the netCDF variable will be 1 dimensional;
|
|
and if \fIdimids\fP is a vector, then the netCDF variable will
|
|
have rank equal to the number of elements in \fIdimids\fP.
|
|
\fIvarid\fP will be set to the netCDF variable ID.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_inq_varid(\fIncid\fP, \fIname\fP, \fIvarid\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid
|
|
character(len=*), intent(in) :: name
|
|
integer, intent(out) :: varid
|
|
integer :: nf90_inq_varid
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncvid(\|)\fR in version 2)
|
|
.sp
|
|
Returns the ID of a netCDF variable in \fIvarid\fP given an open netCDF dataset
|
|
and the name of the variable.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_inquire_variable(\fIncid\fP, \fIvarid\fP, \fIname\fP,
|
|
\fIxtype\fP, \fIndims\fP, \fIdimids\fP, \fInatts\fP)\fR
|
|
.RS
|
|
.nf
|
|
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 :: nf90_inquire_variable
|
|
.fi
|
|
.sp
|
|
Inquire about a netCDF variable in an open netCDF dataset, given its
|
|
variable ID.
|
|
On return, \fIname\fP will contain the name of the variable and should
|
|
be capacious enough (\fBnf90_max_name\fP).
|
|
\fIxtype\fP will contain the external, netCDF type of the variable.
|
|
\fIndims\fP will contain the dimensionality of the netCDF variable: if the
|
|
variable is a scalar, then size(\fIndims\fP) will be zero; otherwise,
|
|
size(\fIndims\fP) will be the rank of the variable and \fIndims\fP will contain
|
|
the dimension ID-s of the netCDF dimensions that constitute the domain of the
|
|
variable.
|
|
\fInatts\fP will contain the number of attributes associated with the netCDF
|
|
variable.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_rename_var(\fIncid\fP, \fIvarid\fP, \fIname\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent9in) :: ncid, varid
|
|
character(len=*), intent(in) :: newname
|
|
integer :: nf90_rename_var
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncvren(\|)\fR in version 2)
|
|
.sp
|
|
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.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_put_var(\fIncid\fP, \fIvarid\fP, \fIvalues\fP,
|
|
\fIstart\fP, \fIstride\fP, \fIimap\fP)\fR
|
|
.RS
|
|
.nf
|
|
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 :: nf90_put_var
|
|
.fi
|
|
.sp
|
|
(Replaces \fBncvpt(\|)\fR in version 2)
|
|
.sp
|
|
Writes a value or values to a netCDF variable.
|
|
The netCDF dataset must be open and in data mode.
|
|
\fIvalues\fP contains the value(s) what will be written to the netCDF variable
|
|
identified by \fIncid\fP and \fIvarid\fP; it may be a scalar or an array and
|
|
must be of type
|
|
\fBcharacter\fP,
|
|
\fBinteger(kind=OneByteInt)\fP,
|
|
\fBinteger(kind=TwoByteInt)\fP,
|
|
\fBinteger(kind=FourByteInt)\fP,
|
|
\fBinteger(kind=EightByteInt)\fP,
|
|
\fBreal(kind=FourByteReal)\fP, or
|
|
\fBreal(kind=EightByteReal)\fP.
|
|
All values are converted to the external type
|
|
of the netCDF variable, if possible; otherwise, an
|
|
\fBnf90_erange\fR error is returned.
|
|
The optional argument \fIstart\fP specifies
|
|
the starting index in the netCDF variable for writing for each
|
|
dimension of the netCDF variable.
|
|
The optional argument \fIstride\fP 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 \fIimap\fP specifies the in-memory arrangement of the data
|
|
values (see COMMON ARGUMENT DESCRIPTIONS below).
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_get_var(\fIncid\fP, \fIvarid\fP, \fIvalues\fP,
|
|
\fIstart\fP, \fIstride\fP, \fIimap\fP)\fR
|
|
.RS
|
|
.nf
|
|
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 :: nf90_get_var
|
|
.fi
|
|
.sp
|
|
(Replaces \fBncvgt(\|)\fR in version 2)
|
|
.sp
|
|
Reads a value or values from a netCDF variable.
|
|
The netCDF dataset must be open and in data mode.
|
|
\fIvalues\fP will receive the value(s) what will be read from the netCDF
|
|
variable
|
|
identified by \fIncid\fP and \fIvarid\fP; it may be a scalar or an array and
|
|
must be of type
|
|
\fBcharacter\fP,
|
|
\fBinteger(kind=OneByteInt)\fP,
|
|
\fBinteger(kind=TwoByteInt)\fP,
|
|
\fBinteger(kind=FourByteInt)\fP,
|
|
\fBinteger(kind=EightByteInt)\fP,
|
|
\fBreal(kind=FourByteReal)\fP, or
|
|
\fBreal(kind=EightByteReal)\fP.
|
|
All values are converted from the external type
|
|
of the netCDF variable, if possible; otherwise, an
|
|
\fBnf90_erange\fR error is returned.
|
|
The optional argument \fIstart\fP specifies
|
|
the starting index in the netCDF variable for reading for each
|
|
dimension of the netCDF variable.
|
|
The optional argument \fIstride\fP 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 \fIimap\fP specifies the in-memory arrangement of the data
|
|
values (see COMMON ARGUMENT DESCRIPTIONS below).
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_inquire_attribute(\fIncid\fP, \fIvarid\fP, \fIname\fP,
|
|
\fIxtype\fP, \fIlen\fP, \fIattnum\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid, varid
|
|
character(len=*), intent(in) :: name
|
|
integer, optional, intent(out) :: xtype, len, attnum
|
|
integer :: nf90_inquire_attribute
|
|
.fi
|
|
.sp
|
|
Inquires about the netCDF attribute named \fIname\fP, of variable \fIvarid\fP,
|
|
in the open netCDF dataset \fIncid\fP.
|
|
\fIxtype\fP will contain the external, netCDF type of the variable.
|
|
\fIlen\fP will contain the number of elements in the attribute.
|
|
\fIattnum\fP will contain the attribute number.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_inq_attname(\fIncid\fP, \fIvarid\fP, \fIattnum\fP,
|
|
\fIname\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid, varid, attnum
|
|
character(len=*), intent(out) :: name
|
|
integer :: nf90_inq_attname
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncanam(\|)\fR in version 2)
|
|
.sp
|
|
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). The attributes for each variable are numbered
|
|
from 1 (the first attribute) to
|
|
\fInatts\fP, where \fInatts\fP is
|
|
the number of attributes for the variable, as returned from a call to
|
|
\fBnf90_inquire_variable(\|)\fR.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_put_att(\fIncid\fP, \fIvarid\fP, \fIname\fP,
|
|
\fIvalues\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid, varid
|
|
character(len=*), intent(in) :: name
|
|
<<whatever>>, intent(in) :: values
|
|
integer :: nf90_put_att
|
|
.fi
|
|
.sp
|
|
Unlike variables, attributes do not have
|
|
separate functions for defining and writing values.
|
|
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.
|
|
\fIvalues\fP contains the attribute values to be written; it may be a scalar
|
|
or a vector and must be of type
|
|
\fBcharacter\fP,
|
|
\fBinteger(kind=OneByteInt)\fP,
|
|
\fBinteger(kind=TwoByteInt)\fP,
|
|
\fBinteger(kind=FourByteInt)\fP,
|
|
\fBinteger(kind=EightByteInt)\fP,
|
|
\fBreal(kind=FourByteReal)\fP, or
|
|
\fBreal(kind=EightByteReal)\fP.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_get_att(\fIncid\fP, \fIvarid\fP, \fIname\fP, \
|
|
fIvalues\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid, varid
|
|
character(len=*), intent(in) :: name
|
|
<<whatever>>, intent(out) :: values
|
|
integer :: nf90_get_att
|
|
.fi
|
|
.sp
|
|
(Replaces \fBncagt(\|)\fR in version 2)
|
|
.sp
|
|
Gets the value(s) of a netCDF attribute, given its
|
|
variable ID and name.
|
|
The values are returned in \fIvalues\fP, which must be of type
|
|
\fBcharacter\fP,
|
|
\fBinteger(kind=OneByteInt)\fP,
|
|
\fBinteger(kind=TwoByteInt)\fP,
|
|
\fBinteger(kind=FourByteInt)\fP,
|
|
\fBinteger(kind=EightByteInt)\fP,
|
|
\fBreal(kind=FourByteReal)\fP, or
|
|
\fBreal(kind=EightByteReal)\fP.
|
|
Converts from the external type to the type
|
|
of the receiving variable, if possible; otherwise returns an \fBnf90_erange\fR
|
|
error.
|
|
All values of the attribute
|
|
are returned, so you must allocate enough space to hold
|
|
them. If you don't know how much space to reserve, call
|
|
\fBnf90_inquire_attribute(\|)\fR
|
|
first to find out the length of the attribute.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_copy_att(\fIncid_in\fP, \fIvarid_in\fP, \fIname\fP,
|
|
\fIncid_out\fP, \fIvarid_out\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid_in, varid_in
|
|
character(len=*), intent(in) :: name
|
|
integer, intent(in) :: ncid_out, varid_out
|
|
integer :: nf90_copy_att
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncacpy(\|)\fR in version 2)
|
|
.sp
|
|
Copies an
|
|
attribute from one netCDF dataset to another. It can also be used to
|
|
copy an attribute from one variable to another within the same netCDF
|
|
dataset.
|
|
\fIncid_in\fP is the netCDF ID of an input netCDF dataset from which the
|
|
attribute will be copied.
|
|
\fIvarid_in\fP
|
|
is the ID of the variable in the input netCDF dataset from which the
|
|
attribute will be copied, or \fBnf90_global\fR
|
|
for a global attribute.
|
|
\fIname\fP
|
|
is the name of the attribute in the input netCDF dataset to be copied.
|
|
\fIncid_out\fP
|
|
is the netCDF ID of the output netCDF dataset to which the attribute will be
|
|
copied.
|
|
It is permissible for the input and output netCDF ID's to be the same. The
|
|
output netCDF dataset 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.
|
|
\fIvarid_out\fP
|
|
is the ID of the variable in the output netCDF dataset to which the
|
|
attribute will
|
|
be copied, or \fBnf90_global\fR to copy to a global attribute.
|
|
.RE
|
|
.HP
|
|
\fBfunction nf90_rename_att(\fIncid\fP, \fIvarid\fP, \fIname\fP,
|
|
\fInewname\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid, varid
|
|
character(len=*), intent(in) :: name, newname
|
|
integer :: nf90_rename_att
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncaren(\|)\fR
|
|
.sp
|
|
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.
|
|
\fIname\fP is the original attribute name.
|
|
\fInewname\fP
|
|
is the new name to be assigned to the specified attribute. If the new name
|
|
is longer than the old name, the netCDF dataset must be in define mode.
|
|
.HP
|
|
\fBfunction nf90_del_att(\fIncid\fP, \fIvarid\fP, \fIname\fP)\fR
|
|
.RS
|
|
.nf
|
|
integer, intent(in) :: ncid, varid
|
|
character(len=*), intent(in) :: name
|
|
integer :: nf90_del_att
|
|
.fi
|
|
.sp
|
|
(Corresponds to \fBncadel(\|)\fR in version 2)
|
|
.sp
|
|
Deletes an attribute from a netCDF dataset. The dataset must be in
|
|
define mode.
|
|
.RE
|
|
.SH "COMMON ARGUMENT DESCRIPTIONS"
|
|
.LP
|
|
In this section we define some common arguments which are used in the
|
|
"FUNCTION DESCRIPTIONS" section.
|
|
.TP
|
|
integer \fIncid\fP
|
|
is the netCDF ID returned from a previous, successful call to
|
|
\fBnf90_open(\|)\fR or \fBnf90_create(\|)\fR
|
|
.TP
|
|
character(len=*) \fIname\fP
|
|
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.
|
|
The maximum allowable number of characters
|
|
is \fBnf90_max_name\fR.
|
|
Names that begin with an underscore (`_') are reserved for use
|
|
by the netCDF interface.
|
|
.TP
|
|
integer \fIxtype\fP
|
|
specifies the external data type of a netCDF variable or attribute and
|
|
is one of the following:
|
|
\fBnf90_byte\fR, \fBnf90_char\fR, \fBnf90_short\fR, \fBnf90_int\fR,
|
|
\fBnf90_float\fR, or \fBnf90_double\fR.
|
|
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.
|
|
|
|
.TP
|
|
integer \fIdimids\fP
|
|
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 (\fIndims\fP).
|
|
The vector shall be ordered by the speed with which a dimension varies:
|
|
\fIdimids\fP(\|1) shall be the dimension ID of the most rapidly
|
|
varying dimension and
|
|
\fIdimids\fP(\fIndims\fP)
|
|
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
|
|
\fBnf90_max_var_dims\fR.
|
|
.TP
|
|
integer \fIdimid\fP
|
|
is the ID of a netCDF dimension.
|
|
netCDF dimension ID's are allocated sequentially from the
|
|
positive
|
|
integers beginning with 1.
|
|
.TP
|
|
integer \fIndims\fP
|
|
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
|
|
\fBnf90_max_var_dims\fR.
|
|
.TP
|
|
integer \fIvarid\fP
|
|
is the ID of a netCDF variable or (for the attribute-access functions)
|
|
the symbolic constant
|
|
\fBnf90_global\fR,
|
|
which is used to reference global attributes.
|
|
netCDF variable ID's are allocated sequentially from the
|
|
positive
|
|
integers beginning with 1.
|
|
.TP
|
|
integer \fInatts\fP
|
|
is the number of global attributes in a netCDF dataset for the
|
|
\fBnf90_inquire(\|)\fR
|
|
function or the number
|
|
of attributes associated with a netCDF variable for the
|
|
\fBnf90_varinq(\|)\fR
|
|
function.
|
|
.TP
|
|
integer \fIstart\fP
|
|
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.
|
|
.TP
|
|
integer \fIstride\fP
|
|
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 (\fIstride\fP(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.).
|
|
|
|
.TP
|
|
\fIimap\fP
|
|
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 (\fIimap\fP(1) 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).
|
|
|
|
.SH "VARIABLE PREFILLING"
|
|
.LP
|
|
By default, the netCDF interface 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 is done when \fBnf90_enddef(\|)\fR
|
|
is called. The
|
|
fill-value for a variable may be changed from the default value by
|
|
defining the attribute `\fB_FillValue\fR' for the variable. This
|
|
attribute must have the same type as the variable and be of length one.
|
|
.LP
|
|
Variables with an unlimited dimension are also prefilled, but on
|
|
an `as needed' basis. For example, if the first write of such a
|
|
variable is to position 5, then
|
|
positions
|
|
1 through 4
|
|
(and no others)
|
|
would be set to the fill-value at the same time.
|
|
.LP
|
|
This default prefilling of data values may be disabled by
|
|
or'ing the
|
|
\fBnf90_nofill\fR
|
|
flag into the mode parameter of \fBnf90_open(\|)\fR or \fBnf90_create(\|)\fR,
|
|
or, by calling the function \fBnf90_set_fill(\|)\fR
|
|
with the argument \fBnf90_nofill\fR.
|
|
For variables that do not use the unlimited dimension,
|
|
this call must
|
|
be made before
|
|
\fBnf90_enddef(\|)\fR.
|
|
For variables that
|
|
use the unlimited dimension, this call
|
|
may be made at any time.
|
|
.LP
|
|
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. The performance
|
|
enhancing behavior of this function is dependent on the particulars of
|
|
the implementation and dataset format.
|
|
The flag value controlled by \fBnf90_set_fill(\|)\fR
|
|
is per netCDF ID,
|
|
not per variable or per write.
|
|
Allowing this to change affects the degree to which
|
|
a program can be effectively parallelized.
|
|
Given all of this, we state that the use
|
|
of this feature may not be available (or even needed) in future
|
|
releases. Programmers are cautioned against heavy reliance upon this
|
|
feature.
|
|
.SH "MPP FUNCTION DESCRIPTIONS"
|
|
.LP
|
|
Additional functions for use on SGI/Cray MPP machines (_CRAYMPP).
|
|
These are used to set and inquire which PE is the base for MPP
|
|
for a particular netCDF. These are only relevant when
|
|
using the SGI/Cray ``global''
|
|
Flexible File I/O layer and desire to have
|
|
only a subset of PEs to open the specific netCDF file.
|
|
For technical reasons, these functions are available on all platforms.
|
|
On a platform other than SGI/Cray MPP, it is as if
|
|
only processor available were processor 0.
|
|
.LP
|
|
To use this feature, you need to specify a communicator group and call
|
|
\fBglio_group_mpi(\|)\fR or \fBglio_group_shmem(\|)\fR prior to the netCDF
|
|
\fBnf90_open(\|)\fR and \fBnf90_create(\|)\fR calls.
|
|
.LP
|
|
Note that the routines described below are Fortran-77 routines rather than
|
|
Fortran-90 routines (they have an "nf_" prefix rather than an "nf90_" prefix).
|
|
.HP
|
|
\fBinteger function nf__create_mp(character*(*) \fIpath\fP, integer \fIcmode\fP, integer \fIinitialsize\fP, integer \fIpe\fP, integer \fIchunksize\fP, integer \fIncid\fP)\fR
|
|
.sp
|
|
Like \fBnf__create(\|)\fR but allows the base PE to be set.
|
|
.sp
|
|
The argument \fIpe\fP sets the base PE at creation time. In the MPP
|
|
environment, \fBnf__create(\|)\fR and \fBnf90_create(\|)\fR set the base PE to processor
|
|
zero by default.
|
|
.HP
|
|
\fBinteger function nf__open_mp(character*(*) \fIpath\fP, integer \fImode\fP, integer \fIpe\fP, integer \fIchunksize\fP, integer \fIncid\fP)\fR
|
|
.sp
|
|
Like \fBnf__open(\|)\fR but allows the base PE to be set.
|
|
The argument \fIpe\fP sets the base PE at creation time. In the MPP
|
|
environment, \fBnf__open(\|)\fR and \fBnf90_open(\|)\fR set the base PE to processor
|
|
zero by default.
|
|
.HP
|
|
\fBinteger function nf_inq_base_pe(integer \fIncid\fP, integer \fIpe\fP)\fR
|
|
.sp
|
|
Inquires of the netCDF dataset which PE is being used as the base for MPP use.
|
|
This is safe to use at any time.
|
|
.HP
|
|
\fBinteger function nf_set_base_pe(integer \fIncid\fP, integer \fIpe\fP)\fR
|
|
.sp
|
|
Resets the base PE for the netCDF dataset.
|
|
Only perform this operation when the affected communicator group
|
|
synchronizes before and after the call.
|
|
This operation is very risky and should only be contemplated
|
|
under only the most extreme cases.
|
|
.SH "ENVIRONMENT VARIABLES"
|
|
.TP 4
|
|
.B 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 is \fBbufa:336:2\fP,
|
|
unless a current FFIO specification is in operation,
|
|
which will be honored.
|
|
See UNICOS Flexible File I/O for more information.
|
|
.SH "MAILING-LISTS"
|
|
.LP
|
|
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 the mailing-list or the
|
|
digest, 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 \fIjdoe@host.inst.domain\fP.
|
|
.sp
|
|
To subscribe to the netCDF mailing list:
|
|
.RS
|
|
\fBsubscribe netcdfgroup \fIjdoe@host.inst.domain\fR
|
|
.RE
|
|
To unsubscribe from the netCDF mailing list:
|
|
.RS
|
|
\fBunsubscribe netcdfgroup \fIjdoe@host.inst.domain\fR
|
|
.RE
|
|
To subscribe to the netCDF digest:
|
|
.RS
|
|
\fBsubscribe netcdfdigest \fIjdoe@host.inst.domain\fR
|
|
.RE
|
|
To unsubscribe from the netCDF digest:
|
|
.RS
|
|
\fBunsubscribe netcdfdigest \fIjdoe@host.inst.domain\fR
|
|
.RE
|
|
To retrieve the general introductory information for the mailing list:
|
|
.RS
|
|
\fBinfo netcdfgroup\fR
|
|
.RE
|
|
To get a synopsis of other majordomo commands:
|
|
.RS
|
|
\fBhelp\fR
|
|
.RE
|
|
.SH "SEE ALSO"
|
|
.LP
|
|
.BR ncdump (1),
|
|
.BR ncgen (1),
|
|
.BR netcdf (3f).
|
|
.LP
|
|
\fInetCDF User's Guide\fP, published
|
|
by the Unidata Program Center, University Corporation for Atmospheric
|
|
Research, located in Boulder, Colorado.
|