Project

General

Profile

merge files with overlapping time periods

Added by name lastname almost 12 years ago

HI CDO users,

imagine I have a bunch of files that I want to merge (or append) via mergetime. Some of the time periods in the files, however, overlap. If I use mergetime in these cases, I end up with a results file with two time steps for these periods. Is there any way to easily merge the files without having two datapoints? Until now i always had to cut the overlapping time steps which is quite cumbersome in case you have many files.

Cheers!


Replies (4)

RE: merge files with overlapping time periods - Added by Jaison-Thomas Ambadan almost 12 years ago

Hi,

CDO mergetime won't do the "thinning" automatically - you may have to use a script for that. For example, if each of your input file (abcd.001 to abcd.030) has, say minimum 12 consecutive timestep, then

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!/bin/ksh

for I in abcd.???; do

cdo -seltimestep,1/12 $I $TMPDIR/$I

done

cd $TMPDIR

cdo mergetime * outfile

exit 0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(or something similar) should do the job

However if the overlapping time-steps are somewhere in the middle/random, then I guess you have to manually strip one by one.

Cheers,
J.

RE: merge files with overlapping time periods - Added by Uwe Schulzweida almost 12 years ago

To skip all double entries set the environment variable SKIP_SAME_TIME=1 before using CDO mergetime:

export SKIP_SAME_TIME=1
cdo mergetime ifiles ofile

RE: merge files with overlapping time periods - Added by Andrew Schurer over 9 years ago

Hi,

I am also trying to merge two timeseries together with an overlapping period.

i.e.
export SKIP_SAME_TIME=1
cdo mergetime ifile1 ifile2 ofile

Using the above method creates a merged timeseries where the period of overlap looks like it has been calculated as the mean of the two input files.

Is it possible to change this so that instead of the mean of the two files the output file contains just ifile1 during the overlap and then continues with ifile2 after the overlap?

Many thanks,
Andrew

RE: merge files with overlapping time periods - Added by Uwe Schulzweida over 9 years ago

Setting the environment variable SKIP_SAME_TIME=1 removes duplicate time steps. Only the first occurrence of a time stamp is written to the output file.

    (1-4/4)