简体   繁体   English

无法使用 NCO 连接全局层 netCDF 数据

[英]Failed to concatenate global layer netCDF data using NCO

I am using monthly global potential evapotranspiration data from TerraClimate from 1958-2020 (available as 1 nc per year) and planning to concatenate all into single nc file.我正在使用TerraClimate 1958-2020 年的每月全球潜在蒸散数据(每年 1 nc),并计划将所有数据连接到单个 nc 文件中。 The data has a variable pet and three dimension ppt(time,lat,lon) .数据有一个变量pet和三个维度ppt(time,lat,lon)

I managed to combine all of the data using cod mergetime TerraClimate_*.nc and generate around 100GB of output file.我设法使用cod mergetime TerraClimate_*.nc合并所有数据并生成大约 100GB 的输出文件。

For analysis purpose in Windows machine, I need single netCDF file with order lat,lon,time .为了在 Windows 机器中进行分析,我需要一个顺序为lat,lon,time netCDF 文件。 What I have done is as follows:我所做的如下:

  1. Reorder the dimension from time,lat,lon into lat,lon,time using ncpdq command使用ncpdq命令将维度从time,lat,lon重新排序为lat,lon,time
for fl in *.nc; do ncpdq -a lat,lon,time $fl ../pet2/$fl; done
  1. Loop all file in the folder to make time the record dimension/variable used for concatenating files using ncks command循环文件夹中的所有文件,使时间成为使用ncks命令连接文件的记录维度/变量
for fl in *.nc; do ncks -O --mk_rec_dmn time $fl $fl; done
  1. Concatenates all nc files in the folder into one nc file using ncrcat command使用ncrcat命令将文件夹中的所有 nc 文件连接成一个 nc 文件
ncrcat -h TerraClimate_*.nc -O TerraClimate_pet_1958_2020.nc

It's worked, but the result is not what I expected, it generate 458KB size of file, when I check the result using Panoply it provide wrong information, all have value -3276.7.它起作用了,但结果不是我所期望的,它生成了 458KB 大小的文件,当我使用 Panoply 检查结果时,它提供了错误的信息,所有值都为 -3276.7。 See below picture.见下图。

帕诺普利

I have check the files from step 1 and 2, and everything is correct.我已经检查了步骤 1 和 2 中的文件,一切都正确。

I also try to concatenate only 2 files, using 1958 and 1959 data (each file 103MB), but the result still not what I expected.我也尝试只连接 2 个文件,使用1958 年1959 年的数据(每个文件 103MB),但结果仍然不是我所期望的。

ncrcat -h TerraClimate_pet_1958.nc TerraClimate_pet_1959.nc -O ../TerraClimate_pet_1958_1959.nc

Did I missed something on the code or write the wrong code?我是否遗漏了代码中的某些内容或编写了错误的代码? Any suggestion how to solve the problem?任何建议如何解决问题?

UPDATE:更新:

Here's the metadata of original data downloaded from above link.这是从上述链接下载的原始数据的元数据。 元数据

Your commands appear to be correct, however I suspect that the data in the input files is packed.您的命令似乎是正确的,但我怀疑输入文件中的数据已打包。 As explained in the ncrcat documentation here , the input data should be unpacked (eg, with ncpdq --unpack ) prior to concatenating all the input files (unless they all share the same values of scale_factor and add_offset ).正如此处ncrcat文档中所解释的,在连接所有输入文件之前,应该对输入数据进行解包(例如,使用ncpdq --unpack )(除非它们都共享相同的scale_factoradd_offset值)。 If that does not solve the problem, then (1) there is likely an issue with _FillValue and (2) please post the pet metadata from a sample input file.如果这不能解决问题,那么 (1) _FillValue可能存在问题,并且 (2) 请发布示例输入文件中的pet元数据。

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

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