3

I have several variables defined as follows:

dimensions:
        t = UNLIMITED ; // (1 currently)
        y = 3963 ;
        x = 5762 ;
        myz = 1 ;
        z = 98 ;
variables:
        float e1u(t, y, x, myz) ;
        float e1v(t, y, x, myz) ;
        float e2v(t, y, x, myz) ;
        float e2u(t, y, x, myz) ;
        float nav_lev(z) ;

I'd like to define the e1u variable over the z dimension, by replicating the (x,y) grid for all the 98 levels. Is there a cdo/nco command to accomplish that?

Thanks!

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
Fab
  • 1,145
  • 7
  • 20
  • 40

1 Answers1

2
ncap2 -s 'e1uz[t,y,x,myz,z]=e1u' in.nc out.nc # This replicates over z
ncks -O -x -v e1u out.nc out.nc # Delete original e1u variable
ncrename -v e1uz,e1u out.nc # Rename to original name
Charlie Zender
  • 5,929
  • 14
  • 19