1

我有一个包含 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

4

1 回答 1

1

这个命令

ncra data_ncfiles/* dataaverage.nc

依靠 shell-globbing 来扩展文件名列表。ls data_ncfiles/*如果给出来自同一目录的预期文件列表,它将起作用。您的帖子不清楚,但您可能使用引号关闭了通配符。

ERROR no variables fit criteria for processing当您的输入缺少记录维度时,通常会发生下一个错误。令人敬畏的错误恰好指向有关如何解决该问题的说明。按照这些说明进行操作。

于 2018-09-24T23:29:22.650 回答