ubuntunetcdfcdo-climateera5

Calculate difference in variable within same day in two nc file


I have two NC files with ERA5land precipitation data from the months AMJJASO of 2001-2020. One NC file of precipitation data from UTC 00.00 and one NC file with precipitation data from UTC 12.00. I would like to subtract the precipitation from UTC 00.00 from the precipitation at timeslot 12.00, hence;

UTC12.00 - UTC00.00 = UTCprecip

I have previously used cdo as

cdo sub UTC12.nc UTC00.nc UTCprecip.nc

but was looking for something like daysub, not ydaysub though(!).

But does this simple subtraction using cdo sub occur within each day only?

Or do I have to use a different call?


Solution

  • Based on what you have said the sub method will correctly handle your problem.

    The sub method in CDO will do the subtraction for matching time steps. It only matches time steps, not dates etc. So time step 1 in UTC00.nc is subtracted step 1 from UTC12.nc and so on until the last remaining time step that is in both files.