Skip to content

Commit

Permalink
Create homework1.ipynb
Browse files Browse the repository at this point in the history
Update homework1 for 2023 fall.
  • Loading branch information
NiuZhixiao committed Oct 21, 2023
1 parent 540c5d9 commit 31e68a8
Showing 1 changed file with 180 additions and 0 deletions.
180 changes: 180 additions & 0 deletions chapters/homework2023/homework1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "ea863e05",
"metadata": {},
"source": [
"# HW#1: Extreme Rainfall in Singapore \n",
"\n",
"```{admonition} Objectives\n",
":class: tip\n",
"\n",
"This homework will help you gain a better understanding in terms of the ways how to:\n",
"* Fit Generalized Extreme Value (GEV) distribution \n",
"* Estimate the return period and return level of extreme rainfall\n",
"\n",
"Happy coding!\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "af48d568",
"metadata": {},
"source": [
"```{admonition} Submission Guide\n",
"\n",
"Deadline: **Sunday 11:59 pm, 5th November 2023** \n",
"(Note: Late submissions will not be accepted). \n",
"\n",
"Please upload your solutions to LumiNUS in a Jupyter Notebook format with the name \"Homework1_StudentID.ipynb\". Make sure to write down your student ID and full name in the cell below. \n",
"\n",
"For any questions, feel free to contact Prof. Xiaogang HE ([hexg@nus.edu.sg](mailto:hexg@nus.edu.sg)), or Zhixiao NIU ([niu.zhixiao@u.nus.edu](mailto:niu.zhixiao@u.nus.edu)).\n",
"\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "c8ae81f2",
"metadata": {},
"outputs": [],
"source": [
"## Fill your student ID and full name below.\n",
"\n",
"# Student ID:\n",
"# Full name:"
]
},
{
"cell_type": "markdown",
"id": "5abc96cb",
"metadata": {},
"source": [
"**Data**:\n",
"You will need to use the historical (1981-2020) daily total rainfall at Singapore's Changi station for this homework. \n",
"You can create a DataFrame using Pandas by reading file \"../../assets/data/Changi_daily_rainfall.csv\"."
]
},
{
"cell_type": "markdown",
"id": "89af3af8",
"metadata": {},
"source": [
"## Q1: Calculate the statisitics\n",
"\n",
"First divide the data into the following seasons, DJF (Dec‐Feb), MAM (Mar‐May), JJA (Jun‐Aug), and SON (Sep‐Nov), by concatenating the seasons together from the 40 years. Calculate, for each seasonal series, the statistics: mean, variance, kendalltau correlation for average daily rainfall. Based on the results, indenify the driest season of the year. (10 marks)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "a6aa6f17",
"metadata": {},
"outputs": [],
"source": [
"# Your solutions go here.\n",
"# using the + icon in the toolbar to add a cell."
]
},
{
"cell_type": "markdown",
"id": "c03f010a",
"metadata": {},
"source": [
"## Q2: Fit the GEV distribution \n",
"\n",
"For each season, find the seasonal maximum rainfall deficit based on the 10-days moving average rainfall deficit. This will result in a data set of 40 values for each seasonal series. Fit 2 GEV distributions of seasonal maximum rainfall deficit for each season using first 20 years and last 20 years separately. To do this, estimate the GEV parameters using (i) Maximum Likelihood and (ii) L-Moments, respectively. Based on your results. (Details on fitting a GEV distribution can be found in the [Scipy tutorial](https://xiaoganghe.github.io/python-climate-visuals/chapters/data-analytics/scipy-basic.html)). (Hint: The rainfall deficit can be obtained by subtracting 10-days moving average rainfall from the mean of the average daily rainfall) (40 marks)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "a782552a",
"metadata": {},
"outputs": [],
"source": [
"# Your solutions go here.\n",
"# using the + icon in the toolbar to add a cell."
]
},
{
"cell_type": "markdown",
"id": "7062d933",
"metadata": {},
"source": [
"## Q3: Identify evolution in time\n",
"\n",
"Based on the estimated GEV parameters using L-Moments in Q2,, discuss, for each season, whether there are statistically differences between the 2 distributions estmated from the first and last 20 years. (Hint: You can use the KS test to compare the underlying distributions of two samples) (30 marks)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e811c398",
"metadata": {},
"outputs": [],
"source": [
"# Your solutions go here.\n",
"# using the + icon in the toolbar to add a cell."
]
},
{
"cell_type": "markdown",
"id": "3ddc466e",
"metadata": {},
"source": [
"## Q4: Estimate the extreme values\n",
"\n",
"Based on the estimated GEV parameters using L-Moments in Q2, estimate the rainfall deficit of 50-year, 100-year, 200-year events. (20 marks)."
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "e5362d61",
"metadata": {},
"outputs": [],
"source": [
"# Your solutions go here.\n",
"# using the + icon in the toolbar to add a cell."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 31e68a8

Please sign in to comment.