View source: R/write_attribute_data.R
write_attribute_data | R Documentation |
Creates a NetCDF file with an instance dimension, and any attributes from a data frame. Use to create the start of a NetCDF-DSG file. One character length dimension is created long enough to contain the longest provided character string. This function does not implement any CF convention attributes or standard names. Any columns of class date will be converted to character.
write_attribute_data(
nc_file,
att_data,
instance_dim_name = "instance",
units = rep("unknown", ncol(att_data)),
overwrite = FALSE
)
nc_file |
|
att_data |
|
instance_dim_name |
|
units |
|
overwrite |
boolean overwrite existing file? Will append if FALSE. |
sample_data <- sf::st_set_geometry(sf::read_sf(system.file("shape/nc.shp",
package = "sf")),
NULL)
example_file <-write_attribute_data(tempfile(), sample_data,
units = rep("unknown", ncol(sample_data)))
try({
ncdump <- system(paste("ncdump -h", example_file), intern = TRUE)
cat(ncdump ,sep = "\n")
}, silent = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.