I want to get quantiles of each cell across layers on a stacked set of RasterLayers on R.
My RasterStack looks like this
dimensions : 721, 1440, 1038240, 18628 (nrow, ncol, ncell, nlayers)
I run the following line to get a layer whose values are 25th and 75th percentiles for each cell
qtiles <- raster::calc(RasterStack, fun=function(x){quantile(x, probs= c(0.25,0.75), na.rm=TRUE)})
I get the following error:
Error in R_nc4_open: NETCDF: HDF error
Error in ncdf4::nc_open(x@file@name, suppress_dimvals = TRUE) :
Error in nc_open trying to open file U:path/file1.nc (return_on_error= FALSE )
I suspect it's because of the number of layers since when I try it on a subset of netcdf files, it works fine, and I also have no problems in opening file1.nc separately.
Any suggestions?