Parallel processing netcdf

Hi all, i am, for the first time, trying to use foreach and dopar to compute some stat from a netcdf file, but the output is NA. here is the code

ncores <- detectCores()
cl <- makeCluster(ncores)
registerDoParallel(cl)

max <- nc_open("CRTS02.nc")
lons <- ncvar_get(max, varid = "lon")
lats <- ncvar_get(max, varid = "lat")
nx <- length(lons)
ny <- length(lats)
obs <- ncvar_get(max, "flow")

foreach (x = 1:nx) %dopar% {
  print(x)
  for (y in 1:ny) {
    tryCatch({
     flo = ts(obs[x, y, ], start = c(1981), frequency = 12)
    riv=data.frame(flo)
head (riv)
......... simple stat continues like mean and sd

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.