Go to the previous, next section.
The function ncattdel (or NCADEL for FORTRAN) deletes a
netCDF attribute from an open netCDF file. The netCDF file must be in
define mode.
In case of an error, ncattdel returns -1; NCADEL returns a
nonzero value in rcode. Possible causes of errors include:
int ncattdel (int ncid, int varid, const char* name);
ncid
ncopen or nccreate.
varid
NC_GLOBAL for a
global attribute.
name
Here is an example using ncattdel to delete the variable
attribute Units for a variable rh in an existing netCDF
file named `foo.nc':
#include "netcdf.h"
...
int ncid; /* netCDF ID */
int rh_id; /* variable ID */
...
ncid = ncopen("foo.nc", NC_WRITE);
...
rh_id = ncvarid (ncid, "rh");
...
/* delete attribute */
ncredef(ncid); /* enter define mode */
ncattdel(ncid, rh_id, "Units");
ncendef(ncid); /* leave define mode */
SUBROUTINE NCADEL (INTEGER NCID, INTEGER VARID,
+ CHARACTER*(*) ATTNAM, INTEGER RCODE)
NCID
NCOPN or NCCRE.
VARID
NCGLOBAL for a
global attribute.
ATTNAM
RCODE
Here is an example using NCADEL to delete the variable attribute
Units for a variable rh in an existing netCDF file named
`foo.nc':
INCLUDE 'netcdf.inc'
...
INTEGER NCID ! netCDF ID
INTEGER RHID ! variable ID
...
NCID = NCOPN ('foo.nc', NCWRITE, RCODE)
...
RHID = NCVID (NCID, 'rh', RCODE)
...
* delete attribute
CALL NCREDF (NCID, RCODE) ! enter define mode
CALL NCADEL (NCID, RHID, 'Units', RCODE)
CALL NCENDF (NCID, RCODE) ! leave define mode
Go to the previous, next section.