This function will take a set of NWM files and concatenate them along the time access. If NCO is installed, this file will be pivoted and optimized for time series extraction. While this function will work without NCO it is highly recommended to install the NCO binaries (http://nco.sourceforge.net/#Source). If a file list is not provided, defining the type,ensemble, and number (num) of files to download, will query the most current NWM forecasts on NOMADS.

create_nwm_nc(
  fileList = NULL,
  variable = "streamflow",
  dstfile = NULL,
  type = NULL,
  num = NULL,
  ensemble = NULL,
  nco = TRUE,
  pivot = TRUE,
  purge = TRUE,
  quiet = FALSE
)

Arguments

fileList

a vector of file paths to merge

variable

the channel file variable to extract

dstfile

the file path to write to

type

a NWM configuration

num

a number of files to download, default = all

ensemble

an ensemble member number

nco

should NCO be used? Default = TRUE

pivot

should the concatenated file be pivoted? Default = TRUE

purge

should the fileList files be deleted? Default = FALSE

quiet

should messages be silenced? Default = FALSE

Value

file path

Examples

if (FALSE) {
 create_nwm_nc(type = "short_range", dstfile = tempfile(ext = ".nc"))
 
 urls     <-  get_nomads_filelist(type = "medium_range", num = 4,  ensemble = 4)
 in_files <-  download_nomads(urls, dir = tempdir())
 create_nwm_nc(fileList = in_files, dstfile = tempfile(fileext = ".nc"))
}