Project

General

Profile

Cumulative sum of a variable in large netcdf

Added by Suman B over 2 years ago

Hi,
I am just wondering is it possible to calculate the cumulative sum of a variable (X) using CDO where there will be brak in the summation results for zero or NA values? I know the timcumsum operator gives a continuous cumulative summation of a time series. But I am interested in getting a cumulative sum where the time series values are above a particular threshold/NA/zero values. The consects operator gives the cumulative sum/ total number of time steps where the variable value is above a certain value but it don't provide the cumulative sum of the variable values upto that timestep. Is it possible to calculate the cumulative sum which gives a similar output format of consects but for the cumulative sum of variable (X) and not the timesteps? Besides, the runsum we need to specify the timesteps which in my case is not possible because it has a wide range of continuous timesteps. Please let me if you have any suggetion how can I do it with CDO. I am leaving an example of my problem and the required output of a Variable(X) below.

Thanks in advance.
Varible Desired Output
(X) (DO)
0 0
0 0
0 0
0 0
0 0
2 0
3 0
2 7
0 0
0 0
0 0
2 0
2 4
0 0
0 0
5 5
0 0
0 0
0 0
4 0
6 0
2 0
9 0
3 0
4 0
8 32
0 0