Search code examples
netcdfnco

Creating a 3D variable from a 1D variable with NCO


I have a 1D variable describing height in my NetCDF file. I'd like to create an 3D variable that is uniform on the X and Y axes from this column of data. Is there an easy way to do this in NCO?


Solution

  • If the 1-D axes are named x and y and z, then construct a 3D field containing z that is uniform over x and y with ncap2:

    ncap2 -s 'z_3D[z,y,x]=z' in.nc out.nc
    

    Pretty cool, huh?