Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

netcdf

nco

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.

like image 788
zhr Avatar asked Dec 30 '15 20:12

zhr


Video Answer


1 Answers

Using NCO:

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

like image 94
Charlie Zender Avatar answered Sep 16 '22 21:09

Charlie Zender