Learn R Programming

ncdfCF (version 0.1.1)

open_ncdf: Read a NetCDF resource

Description

Read a NetCDF resource

Usage

open_ncdf(resource, keep_open = FALSE)

Value

An ncdfDataset instance, or an error if the resource was not found or errored upon reading.

Arguments

resource

The name of the NetCDF resource to open, either a local file name or a remote URI.

keep_open

Logical flag to indicate if the NetCDF resource has to remain open after reading the metadata. This should be enabled typically only for programmatic access or when a remote resource has an expensive access protocol (i.e. 2FA). The resource has to be explicitly closed with close() after use. Note that when a dataset is opened with keep_open = TRUE the resource may still be closed by the operating system or the remote server.

Examples

Run this code
fn <- system.file("extdata",
  "pr_day_EC-Earth3-CC_ssp245_r1i1p1f1_gr_20240101-20241231_vncdfCF.nc",
  package = "ncdfCF")
ds <- open_ncdf(fn)
ds

Run the code above in your browser using DataLab