首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >平均多个.nc文件- Linux上的NCO操作符

平均多个.nc文件- Linux上的NCO操作符
EN

Stack Overflow用户
提问于 2018-09-24 23:31:51
回答 1查看 804关注 0票数 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

EN

回答 1

Stack Overflow用户

发布于 2018-09-25 07:29:23

此命令

代码语言:javascript
复制
ncra data_ncfiles/* dataaverage.nc

依赖于shell-globbing来扩展文件名列表。如果ls data_ncfiles/*提供了来自同一目录的预期文件列表,它将会工作。你的帖子不清楚,但你可能已经通过使用引号关闭了globbing。

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52482728

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档