Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

grp.rename.nc

Rename a NetCDF Group


Description

Rename a NetCDF group.

Usage

grp.rename.nc(ncid, newname, oldname=NULL)

Arguments

ncid

Object of class "NetCDF" which points to a NetCDF group (from grp.def.nc) or dataset (from open.nc).

newname

The new group name.

oldname

By default, the rename applies to the group represented by ncid. If oldname is a character string, a group with this name is renamed instead. A hierarchical search is performed if oldname contains "/", otherwise only the immediate group of ncid is searched for a matching group name.

Details

This function renames an existing group in a NetCDF dataset or group that is open for writing. A group cannot be renamed to have the same name as another group, type or variable in the parent group.

Author(s)

Pavel Michna, Milton Woods

References

Examples

##  Create a new NetCDF dataset and define a group
file1 <- tempfile("grp.rename_", fileext=".nc")
nc <- create.nc(file1, format="netcdf4")

grp <- grp.def.nc(nc, "oldgroup")

##  Rename the group (operation not support by early versions of the netcdf4 library)
try(grp.rename.nc(grp, "newgroup"))

close.nc(nc)
unlink(file1)

RNetCDF

Interface to 'NetCDF' Datasets

v2.4-2
GPL (>= 2) | file LICENSE
Authors
Pavel Michna [aut], Milton Woods [aut, cre]
Initial release
2020-09-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.