Project

General

Profile

Percentile Values for Specific Time Period

Added by Richard Thoman over 2 years ago

I want to generate the percentile values of a single variable at a single time step. For example, from ERA5 July 2021 precipitation, I would like to output a file with the grid point by grid point percentile of the July 2021 precipitation as a function of, say a 1991 to 2020 baseline. However, I've not be able find a way to do that. Any help would be appreciated. --Rick


Replies (4)

RE: Percentile Values for Specific Time Period - Added by Karin Meier-Fleischer over 2 years ago

Hi Rick,

without more information I can only point you to timpctl https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#subsection.2.8.17 to compute the percentile over a time range e.g. 1991 to 2020.

-Karin

RE: Percentile Values for Specific Time Period - Added by Richard Thoman over 2 years ago

Karin, thank you for your reply and my apologies for not expressing the problem more clearly.

What I need is for a particular month, say, July 2021, what the percentile value of the July 2021 precipitation at each gridpoint is relative to some baseline, e.g. 1991-2020. For example, at some grid points the July 2021 precip with be higher than any in year the baseline, at other grid points will be at the median, some will be at 23rd percentile of the baseline, etc. --Rick

RE: Percentile Values for Specific Time Period - Added by Karin Meier-Fleischer over 2 years ago

I guess something like the following is what you are looking for, if you want to see the difference for each timestep in the baseline range 1991-2020.

Example for values greater than
Select the time range for comparison (baseline)

cdo -selyear,1991/2020 infile.nc baseline_1991_2020.nc

Select July 2021 from infile

cdo -selmon,7 -selyear,2021 infile.nc year_202107.nc

Generate the mask for data greater than yearly max of baseline

cdo -gt year_202107.nc -yearmax baseline_1991_2020.nc mask_gt.nc

Multiply data of July 2021 with mask

cdo -setctomiss,0 -mul year_202107.nc mask_gt.nc outfile_gt.nc

The result is a file containing 30 timesteps (relation July 2021 to each year of 1991-2020).

    (1-4/4)