简体   繁体   中英

Regrid multiple netcdf files in R by using CDO

I need to regrid hundreds of netCDF files but when I used the CDO command in R, there is always a problem like this:

cdo remapnn (Abort): Too few streams specified! Operator needs 1 input and 1 output streams.

the code is as follows:

files <- list.files(path = common_path,pattern = ".nc")
cdo_path   = '/opt/local/bin/cdo'

new_data_folder = "test_r"
raw_data_folder = "data"

for (i_file in files) {
  raw_file <- paste(raw_data_folder,i_file,sep = '/')
  new_file <- paste(new_data_folder,i_file,sep = '/')
  system(paste(cdo_path,' remapnn,r720x360 ',raw_file,new_file,sep="")) 
}

You could try this:

system(paste(cdo_path,' remapnn,r720x360 ',raw_file,' ',new_file,sep = ""))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM