2017-04-04 78 views
0

我有一个netcdf文件,其中包含空气质量数据。有4个维度:拆分Netcdf变量并重新写入文件

time : 24 hours (midnight to midnight) 
level : 1 to 8 (this is the height in meters (0, 50, 250, 500, 1000, 2000, 3000, 5000 m)) 
latitude : 1 to 400 
longitude : 1 to 700 

我想创建一个新的netcdf文件只保留级别1,删除其他级别,因为我只需要表面。

我该怎么做?

我试图用nccopy命令行来做到这一点,但它重现了数据集。我不知道如何删除其他关卡。

回答

2

您可以NCO hyperslab,例如,

ncks -d level,0 in.nc out.nc 

如果没有NCO,但你确实有畅达,与

conda install -c conda-forge nco 
+0

哇很简单!这个工具真棒,非常感谢你,它完美的作品。我使用'sudo port install nco'将其安装在我的Mac上。仅供参考,您可以向我解释什么是-d?我无法在文档中看到它。 – John

+0

Look-up hyperslab:http://nco.sf.net/nco.html#hyp –