平均多个.nc文件-Linux上的NCO运算符

时间:2018-09-24 15:31:51

标签: linux netcdf nco

我有一个包含60多个netCDF(* .nc)文件的文件夹。我需要找到所有60多个数据文件的平均值,但是我的终端出现错误。

因此,我只需要知道平均60多个文件的平均值并将结果保存在output.nc文件中(我知道如何一次处理2或3个文件,但是有没有60种以上的方法?)

这是我尝试的方法:'ncra data_ncfiles/* dataaverage.nc-> *应该告诉Linux该文件夹中的所有60个文件平均。

我得到的错误是:ncra: ERROR nco_sng_sntz() reports character '' from unsanitized user-input string "CbPM_ncfiles/" is not on whitelist of acceptable characters. For security purposes NCO restricts the set of characters appearing in user input, including filenames, to: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-.@ :%/". NB: This restriction was first imposed in NCO 4.7.3 (February, 2018), and may cause breakage of older workflows. Please contact NCO if you have a real-world use-case that shows why the character '*' should be white-listed. HINT: Re-try command after replacing transgressing characters with innocuous characters.

我也尝试了没有星号的方法,但没有用

更新:我再次尝试:

ncra data_ncfiles/* dataaverage.nc

并收到此错误:

ncra: ERROR no variables fit criteria for processing ncra: HINT Extraction list must contain at least one record variable that is not NC_CHAR or NC_STRING. A record variable is a variable defined with a record dimension. Often the record dimension, aka unlimited dimension, refers to time. To change an existing dimension from a fixed to a record dimensions see http://nco.sf.net/nco.html#mk_rec_dmn or to add a new record dimension to all variables see http://nco.sf.net/nco.html#ncecat_rnm

1 个答案:

答案 0 :(得分:1)

此命令

ncra data_ncfiles/* dataaverage.nc

依靠shell globbing来扩展文件名列表。如果ls data_ncfiles/*提供相同目录中的预期文件列表,它将起作用。您的帖子尚不清楚,但是您可能已通过使用引号关闭了glob。

下一个错误ERROR no variables fit criteria for processing通常在您的输入缺少记录维时发生。令人敬畏的错误恰好指向有关如何解决此问题的说明。请遵循那些说明。