Project

General

Profile

Consecutive numbers without rain

Added by Guilherme Martins almost 10 years ago

Hi cdo users,

I'm trying to calculte the consecutive numbers without rain using the values less than 1 mm/day.

My file input is: tmp.nc and the output is: a1.nc

I've used the command below to do that:

cdo -consects -lec,1 tmp.nc a1.nc

But I want only the first ocurrence and not all values like the result below:

-1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter name
1 : 2015-01-01 12:00:00 0 1 1 : nan : prec
2 : 2015-01-02 12:00:00 0 1 1 : nan : prec
3 : 2015-01-03 12:00:00 0 1 1 : nan : prec
4 : 2015-01-04 12:00:00 0 1 1 : nan : prec
5 : 2015-01-05 12:00:00 0 1 1 : nan : prec
6 : 2015-01-06 12:00:00 0 1 0 : 4.0000 : prec <== I want only this value, that is, only the firs ocurrence.
7 : 2015-01-07 12:00:00 0 1 1 : nan : prec
8 : 2015-01-08 12:00:00 0 1 1 : nan : prec
9 : 2015-01-09 12:00:00 0 1 1 : nan : prec
10 : 2015-01-10 12:00:00 0 1 1 : nan : prec
11 : 2015-01-11 12:00:00 0 1 1 : nan : prec
12 : 2015-01-12 12:00:00 0 1 1 : nan : prec
13 : 2015-01-13 12:00:00 0 1 0 : 1.0000 : prec
14 : 2015-01-14 12:00:00 0 1 1 : nan : prec
15 : 2015-01-15 12:00:00 0 1 1 : nan : prec
16 : 2015-01-16 12:00:00 0 1 0 : 2.0000 : prec
17 : 2015-01-17 12:00:00 0 1 1 : nan : prec
18 : 2015-01-18 12:00:00 0 1 1 : nan : prec
19 : 2015-01-19 12:00:00 0 1 0 : 2.0000 : prec
20 : 2015-01-20 12:00:00 0 1 1 : nan : prec

Cheers,

Guilherme Martins.


Replies (2)

RE: Consecutive numbers without rain - Added by Ralf Mueller almost 10 years ago

What about the eca_cdd (Consecutive dry days index per time period)

ram@luthien:~ cdo -h eca_cdd                                                                                                                                                                                               [12:54:40|16-12-06]
NAME
    eca_cdd - Consecutive dry days index per time period

SYNOPSIS
    eca_cdd[,R[,N]]  ifile ofile

DESCRIPTION
    Let ifile be a time series of the daily precipitation amount RR, then the largest number 
    of consecutive days where RR is less than R is counted. R is an optional parameter with 
    default R = 1 mm. A further output variable is the number of dry periods of more than N days.
    The date information of a timestep in ofile is the date of the last contributing timestep in ifile.
    The following variables are created: 
    - consecutive_dry_days_index_per_time_period
    - number_of_cdd_periods_with_more_than_<N>days_per_time_period

PARAMETER
    R  FLOAT    Precipitation threshold (unit: mm; default: R = 1 mm)
    N  INTEGER  Minimum number of days exceeded (default: N = 5)

RE: Consecutive numbers without rain - Added by Guilherme Martins almost 10 years ago

Hi Ralf,

Perfect!

Thanks a lot!

Guilherme.

    (1-2/2)