Routines (alphabetical) > Routines: N > NCDF Routines > NCDF_ATTCOPY

# NCDF_ATTCOPY

The NCDF_ATTCOPY function copies an attribute from one NetCDF file to another. Note that Incdf and Outcdf can be the same NetCDF ID.

## Examples

See example from NCDF_ATTINQ.

## Syntax

Result = NCDF_ATTCOPY( Incdf [, Invar ] , Name, Outcdf [, Outvar] [, /IN_GLOBAL] [, /OUT_GLOBAL] )

## Return Value

NCDF_ATTCOPY returns the attribute number of the copied attribute in the new file, or -1 if the copy was not successful.

## Arguments

### Incdf

The NetCDF ID, returned from a previous call to NCDF_OPEN, NCDF_CREATE, or NCDF_GROUPDEF.

### Invar

The NetCDF variable ID to be read, returned from a previous call to NCDF_VARDEF or NCDF_VARID, or the name of the variable. If the IN_GLOBAL keyword is set, this argument must be omitted.

### Name

A scalar string containing the name of the attribute to be copied.

### Outcdf

The NetCDF ID of a NetCDF file opened for writing, returned from a previous call to NCDF_OPEN or NCDF_CREATE.

### Outvar

The NetCDF variable ID to be written, returned from a previous call to NCDF_VARDEF or NCDF_VARID, or the name of the variable. If the OUT_GLOBAL keyword is set, this argument must be omitted.

## Keywords

### IN_GLOBAL

Set this keyword to read a global attribute.

### OUT_GLOBAL

Set this keyword to create a global attribute.

## Version History

Pre 4.0 | Introduced