nc_varput_missing¶
The nc_varput_missing functions writes data values
into a netCDF variable of an open netCDF file. The file must be in
data mode. Missing values must have the value MISSING_VALUE
.
-
r = nc_varput_missing(ncid, varid, rvStart, rvCount, values)
-
r = nc_varput_missing(ncid, varid, rvStart, rvCount, values, bCharAsByte)
Return Value
r is -1 in case an error occurred.
Parameters
-
ncid
Identifies the netCDF file.
-
varid
varid is the ID of a variable.
-
rvStart
rvStart is a vector of values specifying the multidimensional index of the corner of the hyperslab where the first of the data values will be read from. The size of start must be the same as the number of dimensions of the specified variable. The elements of start must correspond to the variable’s dimensions in order. The indices are relative to 0.
-
rvCount
rvCount is a vector of values specifying the multidimensional edge lengths from the corner of the hyperslab where the first of the data values will be read. To read a single value, for example, specify rvCount as [1,1,…,1]. The size of rcCount is the number of dimensions of the specified variable. The elements of rvCount correspond to the variable’s dimensions.
-
values
values is a vector or matrix of real values or a string.
-
bCharAsByte
If bCharAsByte is TRUE (1) characters are specified as byte values (data type = NC_CHAR). For other data type this parameter has no meaning. Default value is FALSE (0).
Comment
Except for the handling of missing values the function is identical to nc_varput.
It converts missing values MISSING_VALUES
to the specified value depending on
the data type: NC_FLOAT
is replaced by MISSING_FLOAT
and NC_DOUBLE
is
replaced to MISSING_DOUBLE
.
Example
ncid = nc_create("d:/test.nc");
dimid = nc_dimdef(ncid, "n", 8);
varid = nc_vardef(ncid, "channel", NC_FLOAT, dimid);
nc_attput(ncid, varid, "missing_value", NC_FLOAT, -99);
nc_endef(ncid);
// translate MISSING_VALUE (10e10) to -99
nc_varput_missing(ncid, varid, 3, 4, [3,MISSING_VALUE,5,6]);
nc_close(ncid);
See also
Overview UniPlot Data Files, nc_create, nc_dimdef, nc_vardef, nc_endef, nc_redef, nc_close, nc_varget, nc_varget_missing, nc_varput, strcode
id-1253990