Project

General

Profile

Unable to make daily substraction

Added by Alexandre Dulac over 2 years ago

Hello,

I have a problem with two dataset of precipitation. The two datasets have correct dates but the number of day is not the same .

When i do cdo sub it doesn't look at dates but substract each time step so it does not work since number of days ar not equal. I tried cdo ydaysub -ydayavg , it works but it's not what i want (multi year). I want a function like "daysub" but it seems it does not exist . How can i do ?

Thanks,


Replies (2)

RE: Unable to make daily substraction - Added by Karin Meier-Fleischer over 2 years ago

Hi Alexandre,

cdo subtracts the data of the same dates correct. But CDO will always try to fill the input stream infile1 to the same number of dates of infile2 by copying its data and therefore the subtraction is wrong.

Example: For cdo -sub infile1 infile2 outfile where infile1 (365 days) and infile2 (400 days) will print a warning message

cdo    sub: Filling up stream2 >in1.nc< by copying all timesteps.
...

The message tells you, that in this case, the result of the first same dates will be ok but the data of the input stream infile1 will be copied to the same number of times as infile2.

The best is to select the dates which are in both files (seldate https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#subsection.2.3.4) and do the sub. Nothing else would make sense.

-Karin

RE: Unable to make daily substraction - Added by Alexandre Dulac over 2 years ago

Hi Karin,

Actually i dont think that cdo substract data of the same date. My infile2 has 1 day more than infile1. In this case I don't have warning. Sub just stop at they number of day of infile1 .

When I intervete file, I have the warning but still the same problem.

When i checked the results, the sub was good in the begining but at the end there was a shift of one day (they substract 30th of June with 29of the June on the other file for example). So i think it is working by timestep and not by date. Don't know if it s a bug or not.

I had to check mannualy what was that day in infile2 and remove it and it works after. But i had to find it manually on 10 years so take a bit of time. My problem is solved but there is no way to "synchronize" two files to keep only dates which are common ?

Alexandre

    (1-2/2)