6.35 Copy a Variable from One File to Another: nc_copy_var
This function will copy a variable from one file to another.
It works even if the files are different formats, (i.e. classic
vs. netCDF-4/HDF5.)
If you're copying into a netcdf-3 file, from a netcdf-4 file, you must
be copying a var of one of the six netcdf-3 types. Similarly for the
attributes.
Usage
nc_copy_var(int ncid_in, int varid_in, int ncid_out)
- ncid_in
The file ID for the file that contains the variable to be copied.
- varid_in
The variable ID for the variable to be copied.
- ncid_out
The file ID for the file where the variable should be copied to.
Return Codes
- NC_NOERR
No error.
- NC_EBADID
Bad ncid.
- NC_EBADVAR
Bad varid.
- NC_EHDFERR
HDF5 layer error.
- NC_ENOMEM
Out of memory.
- NC_ERANGE
One or more values out of range.
Example