R: Print Summary Information About a NetCDF Dataset

print.nc {RNetCDF} | R Documentation

## Print Summary Information About a NetCDF Dataset

### Description

Print summary information about a NetCDF dataset.

### Usage

    print.nc(x, ...)

### Arguments

`x` | Object of class "`NetCDF`" which points to the NetCDF dataset (as returned from `open.nc`).
`...` | Arguments passed to or from other methods (not used).

### Details

This function prints information about the structure of a NetCDF dataset, including lists of all groups, dimensions, user-defined types, variables and attributes.

The output of this function is similar to the `ncdump -h` command supplied with the NetCDF C library. One important difference is that array dimensions are shown by `print.nc` in the order used by R, where the leftmost subscript varies fastest.

### Author(s)

Pavel Michna, Milton Woods

### References

https://www.unidata.ucar.edu/software/netcdf/

### Examples

    ##  Create a new NetCDF dataset
    file1 <- tempfile("print_", fileext=".nc")
    nc <- create.nc(file1, format="netcdf4")

    ## Create a group (just because we can!):
    grp <- grp.def.nc(nc, "data")

    ## Create some dimensions, putting one inside the group:
    dim.def.nc(nc, "time", unlim=TRUE)
    dim.def.nc(grp, "station", 5)

    ##  Create two variables, putting one inside the group:
    var.def.nc(nc, "time", "NC_INT", "time")
    var.def.nc(grp, "temperature", "NC_DOUBLE", c("station","time"))

    ##  Put some attributes
    att.put.nc(nc, "NC_GLOBAL", "history", "NC_CHAR", paste("Created on", date()))
    att.put.nc(grp, "temperature", "_FillValue", "NC_DOUBLE", -99999.9)
    att.put.nc(grp, "temperature", "long_name", "NC_CHAR", "air temperature")
    att.put.nc(grp, "NC_GLOBAL", "title", "NC_CHAR", "Data from Foo")

    ##  Print summary information about the dataset
    print.nc(nc)

    close.nc(nc)
    unlink(file1)

[Package RNetCDF version 2.4-2 Index]