Search code examples
multiplicationnetcdfadditionnetcdf4cdo-climate

Multiplication and addition of Netcdf files


I have two timeseries netcdf files with the same number of steps:

  1. U.nc with variable name u10.
  2. V.nc with variable name v10. Now I want to add multiply U.nc with U.nc similarily, V.nc with V.nc.

I also want to add U.nc with V.nc., the variables u10 and v10 should be added.

How can I do this?


Solution

  • A similar answer to Adrian Tompkins's above.

    cdo -L -expr,'wind=sqrt(u10*u10+v10*v10)' -merge u.nc v.nc uv.nc wind.nc 
    

    This uses method chaining. Depending on how CDO was built, you may or may not need -L.