Combine many netCDFs into one file per year
Source:R/combine_model_netcdf.R
nc_merge_all_sites_by_year.RdMerges model outputted netCDF files by the time steps specified in a pecan settings file.
Usage
nc_merge_all_sites_by_year(
model.outdir,
nc.outdir,
ens.num,
site.ids,
start.date,
end.date,
time.step = "1 year",
cores = 1
)Arguments
- model.outdir
character: path to the folder that contains model outputs.
- nc.outdir
character: physical path to the folder that contains the merged netCDF files.
- ens.num
numeric: number of ensembles for the model run.
- site.ids
numeric or character: vector of site ids across locations.
- start.date
date or character in YYYY-MM-DD format: start date of the model run.
- end.date
date or character in YYYY-MM-DD format: end date of the model run.
- time.step
character: time step of the model run. Default is 1 year.
- cores
numeric: the number of CPUs for the parallel computation. Default is 1.
Details
The function is only tested for SIPNET model runs that were run with state data assimilation enabled. Please make sure you have the same netCDF formats if you want to proceed with different models. We could also have more functions that deal with different dimensions (e.g., by site instead of by year).