Define a new dimension to one of the variables in netCDF file

本秂侑毒 提交于 2021-02-18 07:23:11

问题


I have a NetCDF file which include lots of variables (1d, 2d, 3d, and 4d). I want to add a new dimension to one of the 3d variables.

To make it more clear, suppose:

I have a 3d variable: A(d1, d2, d3)

I want to have 4d variable: A(d1, d2, d3, d4)

In fact, d4 is the new dimension which I would like to add to my variable. I do not have d4 in my file. I know it has just one value.

I would appreciate that if anyone guide me.


回答1:


Using NCO:

ncap2 -s 'defdim("d4",737);A_new[$d1,$d2,$d3,$d4]=A' in.nc out.nc



来源:https://stackoverflow.com/questions/34536742/define-a-new-dimension-to-one-of-the-variables-in-netcdf-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!