简体   繁体   English

netcdf 时间维度缺少 CDO

[英]netcdf time dimension missing CDO

I downloaded a netcdf file containing 4-5 variables but it has only 2 dimensions (lat and lon).我下载了一个包含 4-5 个变量的 netcdf 文件,但它只有 2 个维度(纬度和经度)。 Time is missing and this does not allow me to merge timesteps or do anything useful.时间丢失了,这不允许我合并时间步或做任何有用的事情。

Is there any way to fix this hopefully by using CDO?有没有办法通过使用 CDO 来解决这个问题?

there are 100 netcdf files (without time dimension) and I want to merge them using time as the main variable for merging.有 100 个 netcdf 文件(没有时间维度),我想使用时间作为合并的主要变量来合并它们。

You can use command:您可以使用命令:

ncecat -O -u time in.nc out.nc

to create a new time dimension from scratch.从头开始创建一个新的时间维度。

Let me expound a bit on the answer by @Ales --让我稍微解释一下@Ales 的答案——

ncecat is a command-line function in the NCO package that concatenates multiple netcdf files lacking a record (oftentimes "Time") dimension. ncecatNCO包中的一个命令行函数,它连接多个缺少记录(通常是“时间”)维度的 netcdf 文件。 The concatenated file will have a new record dimension, by default it is 'record'.连接的文件将有一个新的记录维度,默认为“记录”。

Let's say you have a list of netcdf files such as A.nc, B.nc, and C.nc, all with the dimensions lat x lon.假设您有一个 netcdf 文件列表,例如 A.nc、B.nc 和 C.nc,所有文件的维度都是 lat x lon。 You can concatenate them using ncecat A.nc B.nc C.nc -O new_file.nc .您可以使用ncecat A.nc B.nc C.nc -O new_file.nc连接它们。 new_file.nc will have dimensions record x lat x lon, where record will have a size of 3 (the number of files you concatenated). new_file.nc 的维度为 record x lat x lon,其中 record 的大小为 3(您连接的文件数)。 The -O option is not necessary, but will explicitly create (and overwrite) the file new_file.nc...or whatever you want to call it. -O选项不是必需的,但会显式创建(并覆盖)文件 new_file.nc...或您想要调用的任何内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM