【问题标题】:Regrid multiple netcdf files in R by using CDO使用 CDO 在 R 中重新网格化多个 netcdf 文件
【发布时间】:2020-01-14 23:59:17
【问题描述】:

我需要重新网格化数百个 netCDF 文件,但是当我在 R 中使用 CDO 命令时,总是出现这样的问题:

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

代码如下:

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="")) 
}

【问题讨论】:

  • 也许在raw_filenew_file 之间添加一个空格? system(paste(cdo_path, ' remapnn,r720x360 ', raw_file, " ", new_file, sep = ""))
  • 如有疑问,请务必先打印出命令以仔细检查,即print(paste(cdo_path, ' remapnn,r720x360 ', raw_file, " ", new_file, sep = ""))
  • 谢谢!我已经弄明白了。 system(paste(cdo_path,' remapnn,r720x360 ',raw_file,' ',new_file,sep = ""))

标签: r cdo-climate


【解决方案1】:

你可以试试这个:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-09-07
    • 2017-09-04
    • 2021-12-20
    • 2023-03-26
    • 2019-11-01
    • 1970-01-01
    • 2020-08-18
    相关资源
    最近更新 更多