【问题标题】:Averaging multiple .nc files - NCO operators on Linux平均多个 .nc 文件 - Linux 上的 NCO 运算符
【发布时间】:2019-02-28 03:58:41
【问题描述】:

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

【问题讨论】:

    标签: linux netcdf nco


    【解决方案1】:

    这个命令

    ncra data_ncfiles/* dataaverage.nc
    

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

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

    【讨论】:

      猜你喜欢
      • 2017-05-28
      • 2021-05-14
      • 2018-06-10
      • 2013-07-19
      • 2019-01-14
      • 2017-02-06
      • 2019-08-01
      • 1970-01-01
      • 2015-06-30
      相关资源
      最近更新 更多