Project

General

Profile

Backward daily accumulations

Added by Romulo Oliveira over 10 years ago

Hi everybody,

I have a spatial/temporal data (ex. South America, from 01/01/2000 to 31/12/2009), with a single variable (daily precipitation). Given a specific day, for example 05/06/2002, I want to calcule the backwards accumulation from this date. 5, 10, 30, ... days accumulations, before a espefifc day.

Is it possible to do it using CDO?

Could anybody help me with that?

PS: date DD/MM/YYYY

Thanks,
R. Oliveira


Replies (5)

RE: Backward daily accumulations - Added by Romulo Oliveira over 10 years ago

Hi again,
I've been tried this option fisrt, with a cshel script:

foreach day ( 2002-10-01 2002-10-12 )

echo $day
$CDO copy -seldate,$day-5/$day 3b42rt_2002-2010_Amazon.nc 3b42rt_${day}_Amazon_5days.nc

but in the result only have 1 time (for the specific day). And I would like 5 times until the day (five timestep).

thanks
R. Oliveira

RE: Backward daily accumulations - Added by Uwe Schulzweida over 10 years ago

The CDO operator seldate needs 2 parameter. First parameter is the start date and the second parameter is the end date. Here is an example to select the first 5 days of October:

cdo seldate,2002-10-01,2002-10-05  ifile  ofile
The copy operator is not needed.

RE: Backward daily accumulations - Added by Romulo Oliveira over 10 years ago

Thanks Uwe,

Exactly. But intend to do it for several dates (random days)... And I think that if I give the last day I can call the 5 days before

I've been tried this options also:

cdo seldate,$day-5,$day 3b42rt_2002-2010_Amazon.nc 3b42rt_${day}_Amazon_5days.nc

Have a template option in CDO that I can do it?

Thanks again,
R

RE: Backward daily accumulations - Added by Romulo Oliveira over 10 years ago

Hi All,

Problem solved...

Below is my code (cshell script):

#!/bin/csh #

  1. put here your date (YYYY-MM-DD)
    foreach day ( 2002-11-04 2002-12-09 2003-01-13 2003-02-17 )

    echo $day

#find the the 4 days before my data
set days5=`date --date="$day 4 days" +%Y%m-%d`

echo $days5

#sum the five days
cdo -timsum -seldate,$days5,$day rain_2002-2010.nc rain_${day}_5days.nc

end

#all dates in one file.nc
cdo mergetime rain_*_5days.nc rain_ALL_5days_timsum.nc

  1. extract the time series of a specific point (lat/lon) to a text
    cdo -outputtab,date,lon,lat,value -remapnn,lon=-67.242_lat=-2.584 rain_ALL_5days_timsum.nc > Station_01_5days_sum.txt

RE: Backward daily accumulations - Added by Etienne Tourigny about 10 years ago

Hi Romulo!!!

Your script could be more efficient if you extract your lon/lat point first, that way all computations will be done on a smaller dataset.

cheers!
Etienne

    (1-5/5)