Menu

Taking the average of two files with identical dimensions: (file1 + file2)/2

Help
2016-01-30
2016-01-30
  • Richard P Signell

    If I have two files with identical variables and dimensions, each with a finite number of records in the time dimension, how can I use NCO to average these two files together, preserving the number of time records?

    Would I first use NCBO to add them together, and then NCAP2 to divide by 2?

    I ask this because we have a rather complicated NCO script for reading u,v velocity components on a rotated, staggered C grid (from ROMS) , and creating two new variables containing the true east and north velocity components averaged to the grid cell center:
    https://www.myroms.org/forum/viewtopic.php?f=31&t=3550#p13493

    It turns out this script as written doesn't currently work for more than single time step files, because it's using "ncra" to average two files together.

     

    Last edit: Richard P Signell 2016-01-30
  • Charlie Zender

    Charlie Zender - 2016-01-30

    Hi Richard,

    Try ncflint:

    ncflint -w 0.5,0.5 in1.nc in2.nc out.nc

    http://nco.sf.net/nco.html#ncflint

    Best,
    cz

     

Log in to post a comment.