Extracts full time series from a list of NetCDF files, provided for time steps (can be one time step or multiple time steps) separately and optionally writes.rds files for each longitude index instead of returning the whole data.

map2tidy(
  nclist,
  varnam,
  lonnam = "lon",
  latnam = "lat",
  timenam = "time",
  timedimnam = "time",
  do_chunks = FALSE,
  outdir = NA,
  fileprefix = NA,
  ncores = 1,
  single_basedate = FALSE,
  fgetdate = NA,
  overwrite = FALSE
)

Arguments

nclist

A vector of character strings specifying the complete paths to files.

varnam

The variable name(s) for which data is to be read from NetCDF files.

lonnam

The dimension name of longitude in the NetCDF files.

latnam

The dimension name of latitude in the NetCDF files.

timenam

The name of dimension variable used for timein the NetCDF files. Defaults to "time".

timedimnam

The name of the dimension (axis) used for time. Defaults to "time".

do_chunks

A logical specifying whether chunks of data should be written to files. Defaults to FALSE. If set to TRUE, the arguments outdir and fileprefix must be specified. Chunks are longitudinal bands and the number of chunks corresponds to the number length of the longitude dimension.

outdir

A character string specifying output directory where data frames are written using the save statement. If omitted (defaults to NA), a tidy data frame containing all data is returned.

fileprefix

A character string specifying the file name prefix.

ncores

Number of cores for parallel execution (distributing extraction of longitude slices). When set to "all", the number of cores for parallelisation is determined by parallel::detectCores(). Defaults to 1 (no parallelisation).

single_basedate

A logical specifying whether all files in the file list have the same base date (e.g., time units given in 'days since ').

fgetdate

A function to derive the date used for the time dimension based on the file name.

overwrite

A logical indicating whether time series files are to be overwritten.

Value

Nothing. Writes data to .rds files for each longitude index.