decomposeNcdf(file.name, borders.wl, calc.parallel = TRUE, center.series = TRUE, check.files = TRUE, debugging = FALSE, harmonics = c(), M = c(), max.cores = 16, n.comp = c(), pad.series = c(0, 0), print.status = TRUE, ratio.const = 0.05, repeat.extr = rep(1, times = length(borders.wl)), tresh.const = 1e-12, var.names = "auto", ...)
NCDF file specifications
Due to (possible) limitations in file size the ncdf file can only contain one variable and the one dimensional coordinate variables. The file has to contain one time dimension called 'time'. This function will create a second ncdf file identical to the input file but with an additional dimension called 'spectral.bands' which contains the separated spectral bands. In general the data is internally split into individual time series along ALL dimensions other than time, e.g. a spatiotemporal data cube would be separated into individual time series along its longitude/latitude dimension . The individual series are decomposed and finally combined, transposed and saved in the new file.
The NCDF file may contain NaN values at grid locations where no data is available (e.g. ocean tiles) but individual time series from single "valid" grid points must not contain missing values. In other words, decomposition is only performed for series without missing values, results for non gap-free series will be missing_value the results file.
The function has only been exhaustively tested with ncdf files with two spatial dimensions (e.g. latitude and longitude) and the time dimension. Even though it was programmed to be more flexible, its functionality can not be guaranteed under circumstances with more and/or different dimensions. Input NCDF files should be compatible with the Climate Forcasting (CF) 1.5 ncdf conventions. Several crucial attributes and dimension units are checked and an error is caused if the convention regarding these aspects is not followed. Examples are the attributes scale_factor, add_offset _FillValue and the units for the time dimension
Parallel computing
If calc.parallel == TRUE, single time series are decomposed with parallel computing. This requires the package doMC (and its dependencies) to be installed on the computer. Parallelization with other packages is theoretically possible but not yet implemented. If multiple cores are not available, setting calc.parallel to FALSE will cause the process to be calculated sequential without these dependencies. The package foreach is needed in all cases.
ssa
, filterTSeriesSSA
, gapfillNcdf
## Example for the filtering of monthly data
filename <- '<filename>.nc'
# Extract yearly cycle, intra annual part and high frequency residual in several steps
borders.wl <- list(a = c(10, 14)
, b = c(12, Inf)
, c = c(0, 12))
M <- c(2*12, 4*12, 12)
#extract first four harmonics for yearly cycle
harmonics <- c(4, 0, 0)
# uncomment and run
# decomposeNcdf(file.name = filename, borders.wl = borders.wl, M = M, harmonics = harmonics)
# Extract yearly cycle, intra annual part and high frequency residual in one step
borders.wl <- list(c(0,10,14,Inf))
# use the same M for all bands
M <- c(2*12)
# uncomment and run
#decomposeNcdf(file.name = filename, borders.wl = borders.wl, M = M)
Run the code above in your browser using DataLab