4.2. SciPy Exercise#

Choosing a probability distribution to fit daily precipitation depths is important for precipitation frequency analysis, stochastic precipitation modeling, and climate assessments. Read the file ../../assets/data/Changi_daily_rainfall.csv and complete the following tasks.

4.2.1. Task 1#

Extract the wet-day series for 2020 from the raw daily rainfall dataset and calculate a few descriptive statistics: mean, variance, skewness, kurtosis, L-CV, and L-skewness. Is the distribution left-skewed or right-skewed? Is the distribution more or less peaked than the normal distribution?

Note: The wet-day series should be constructed by excluding events whose magnitude is less than 0.25 mm/day (0.25 mm/day is the minimum precipitation that can be recorded by the in situ rain gauge).

The L-CV is L-coefficient of variation and can be calculated as:

\[\text{L-CV}=\tau_2=\lambda_2/\lambda_1,\]

and the L-skewness is L-coefficient of skewness, which is calculated as:

\[\text{L-skewness}=\tau_3=\lambda_3/\lambda_2,\]

where \(\lambda_1\), \(\lambda_2\) and \(\lambda_3\) are the first three L-moments (details can be found in SciPy tutorial)

# Your solution goes here.

4.2.2. Task 2#

Early studies identified the gamma (G2) distribution as a suitable distribution for wet-day precipitation based on the traditional goodness-of-fit tests. Does wet-day series of Changi follow a gamma distribution? Check the scipy.stats documentation and do the following:

  • fit a gamma distribution to the Changi wet-day series;

  • print out the estimated parameters;

  • print out the goodness-of-fit test results using KS test.

# Your solution goes here.