Skip to content

Commit

Permalink
deploy: 5a1d033
Browse files Browse the repository at this point in the history
  • Loading branch information
MeilianLee committed Nov 4, 2024
1 parent 50af928 commit b18ab2b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 33 deletions.
58 changes: 42 additions & 16 deletions _sources/chapters/homework/homework2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
"source": [
"```{admonition} Submission Guide\n",
"\n",
"Deadline: **Sunday 11:59 pm, 19th November 2023** \n",
"Deadline: **Sunday 11:59 pm, 17th November 2024** \n",
"(Note: Late submissions will not be accepted). \n",
"\n",
"Please upload your solutions to [Canvas](https://canvas.nus.edu.sg/courses/47849/assignments) in a Jupyter Notebook format with the name \"Homework2_StudentID.ipynb\". Make sure to write down your student ID and full name in the cell below. \n",
"Please upload your solutions to [Canvas](https://canvas.nus.edu.sg/courses/61921/assignments) in a Jupyter Notebook format with the name \"Homework2_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 ([[email protected]](mailto:[email protected])), or Zhixiao NIU ([niu.zhixiao@u.nus.edu](mailto:niu.zhixiao@u.nus.edu)).\n",
"For any questions, feel free to contact Prof. Xiaogang HE ([[email protected]](mailto:[email protected])), Haoling CHEN ([h.chen@u.nus.edu](mailto:[email protected])) or Meilian LI ([[email protected]](mailto:limeilian@u.nus.edu)).\n",
"\n",
"```"
]
Expand Down Expand Up @@ -82,13 +82,26 @@
"source": [
"## Task 1: Visualize the GEV distribution (30 marks)\n",
"To visualize the GEV distribution, you can:\n",
"1. Fit the Generalized Extreme Value (GEV) distribution to annual maximum daily temperature data and estimate the GEV parameters using the **Maximum Likelihood method**.\n",
"2. Plot the probability density function (PDF) curve to to represent the distribution directly.\n",
"3. Calculate the return level for a 20-year event and mark it on the plot.\n",
"4. Fill the figure with different colors regarding the calculated return level as the dividing line.\n",
"1. Fit the Generalized Extreme Value (GEV) distribution to annual maximum daily temperature data and estimate the GEV parameters using the **L-Moments method**.\n",
"2. Plot the probability density function (PDF) curve to represent the distribution directly.\n",
"3. Calculate the return level for a 10-year event and mark it on the plot.\n",
"4. Shade the plot with different colors to distinguish areas above and below the calculated return level.\n",
"5. Ensure that the necessary non-data elements are included, such as title, x/y axis labels, legend, etc. (you can check the [Matplotlib tutorial](https://xiaoganghe.github.io/python-climate-visuals/chapters/data-visuals/matplotlib-basic.html) for details)."
]
},
{
"cell_type": "markdown",
"id": "8f7a646f",
"metadata": {},
"source": [
"```{admonition} Bonus: 10 marks\n",
":class: tip\n",
"\n",
"Illustrate how return levels vary across different return periods (e.g., 2, 5, 10, 20, 50, 100 years) using interactive sliders or dashboards. Resources such as the [Plotly documentation](https://plotly.com/python/sliders/) and [this tutorial video](https://www.youtube.com/watch?v=gs4d0_AKQi8) may be helpful for this task.\n",
"\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand All @@ -105,12 +118,12 @@
"id": "67c41c3b",
"metadata": {},
"source": [
"## Task 2: Visualize the trend of temperature anomaly ( 70 marks )\n",
"## Task 2: Visualize the trend of temperature anomaly (70 marks)\n",
"### Q1: Visualize the time series and trend of historical temperature anomalies of Singapore (35 marks)\n",
"- Calculate the annual mean temperature from the daily data. This will result in a data set of 39 values — one per year. (5 marks)\n",
"- Calculate the annual temperature anomalies using the first 15-year period as the baseline. (Hint: the anomalies is calculated by substracting the mean temperature over year 1982 to 1996 from the yearly mean temperature.) (5 marks)\n",
"- Make a line graph of these annual temperature anomalies and make sure that the necessary non-data elements are included. (10 marks)\n",
"- Based on the annual temperature anomalies above, visualize the trend using a 10-year moving window. (15 marks)"
"- Calculate the annual mean temperature from the daily data. This will result in a dataset of 39 values — one per year. (5 marks)\n",
"- Calculate the annual temperature anomalies using the first 10-year period as the baseline. (Hint: subtract the mean temperature over 1982 to 1991 from the annual mean temperature for each year.) (5 marks)\n",
"- Visualize the change in these annual temperature anomalies over time, ensuring that you include essential non-data elements. (10 marks)\n",
"- Visualize the trend of the annual temperature anomalies using a 5-year moving window. (15 marks)"
]
},
{
Expand Down Expand Up @@ -143,8 +156,8 @@
"- Use your generated climate stripes as the background and then overlay the time series and the trend of annual anomalies (from Q1) on top of the climate stripes. (15 marks)\n",
"\n",
"Tips: \n",
"- You can refer to [this GitHub repository](https://github.com/josephshea/ClimateStripes/blob/master/ClimateStripes-Canada.ipynb) to make the climate stripes. \n",
"- To make a pretty and accessible (colorblind safe) chart, you might want to fine tune the aesthetics (e.g., color palette of the diverging colorbar) of your chart. "
"- Refer to [this GitHub repository](https://github.com/josephshea/ClimateStripes/blob/master/ClimateStripes-Canada.ipynb) for guidance on creating climate stripes.\n",
"- Fine-tune the aesthetics of your chart (e.g., color palette of the diverging colorbar) to ensure it is visually appealing and accessible (colorblind safe)."
]
},
{
Expand All @@ -161,11 +174,24 @@
"# Your solutions go here.\n",
"# Use the + icon in the toolbar to add a cell."
]
},
{
"cell_type": "markdown",
"id": "14d1fb06",
"metadata": {},
"source": [
"```{admonition} Bonus: 10 marks\n",
":class: tip\n",
"\n",
"Create an interactive plot where users can hover over climate stripes and trend lines to view detailed information. For inspiration, you can refer to [this example](https://ourworldindata.org/un-population-2024-revision).\n",
"\n",
"```"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "PytorchCPU",
"language": "python",
"name": "python3"
},
Expand All @@ -179,7 +205,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.8.13"
},
"toc": {
"base_numbering": 1,
Expand Down
40 changes: 24 additions & 16 deletions chapters/homework/homework2.html
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ <h2> Contents </h2>
<nav aria-label="Page">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#task-1-visualize-the-gev-distribution-30-marks">Task 1: Visualize the GEV distribution (30 marks)</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#task-2-visualize-the-trend-of-temperature-anomaly-70-marks">Task 2: Visualize the trend of temperature anomaly ( 70 marks )</a><ul class="nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#task-2-visualize-the-trend-of-temperature-anomaly-70-marks">Task 2: Visualize the trend of temperature anomaly (70 marks)</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#q1-visualize-the-time-series-and-trend-of-historical-temperature-anomalies-of-singapore-35-marks">Q1: Visualize the time series and trend of historical temperature anomalies of Singapore (35 marks)</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#q2-add-climate-stripes-for-singapore-35-marks">Q2: Add climate stripes for Singapore (35 marks)</a></li>
</ul>
Expand Down Expand Up @@ -447,10 +447,10 @@ <h1>HW#2: Visualizing Historical Temperature Changes in Singapore<a class="heade
</div>
<div class="admonition-submission-guide admonition">
<p class="admonition-title">Submission Guide</p>
<p>Deadline: <strong>Sunday 11:59 pm, 19th November 2023</strong>
<p>Deadline: <strong>Sunday 11:59 pm, 17th November 2024</strong>
(Note: Late submissions will not be accepted).</p>
<p>Please upload your solutions to <a class="reference external" href="https://canvas.nus.edu.sg/courses/47849/assignments">Canvas</a> in a Jupyter Notebook format with the name “Homework2_StudentID.ipynb”. Make sure to write down your student ID and full name in the cell below.</p>
<p>For any questions, feel free to contact Prof. Xiaogang HE (<a class="reference external" href="mailto:hexg&#37;&#52;&#48;nus&#46;edu&#46;sg">hexg<span>&#64;</span>nus<span>&#46;</span>edu<span>&#46;</span>sg</a>), or Zhixiao NIU (<a class="reference external" href="mailto:niu&#46;zhixiao&#37;&#52;&#48;u&#46;nus&#46;edu">niu<span>&#46;</span>zhixiao<span>&#64;</span>u<span>&#46;</span>nus<span>&#46;</span>edu</a>).</p>
<p>Please upload your solutions to <a class="reference external" href="https://canvas.nus.edu.sg/courses/61921/assignments">Canvas</a> in a Jupyter Notebook format with the name “Homework2_StudentID.ipynb”. Make sure to write down your student ID and full name in the cell below.</p>
<p>For any questions, feel free to contact Prof. Xiaogang HE (<a class="reference external" href="mailto:hexg&#37;&#52;&#48;nus&#46;edu&#46;sg">hexg<span>&#64;</span>nus<span>&#46;</span>edu<span>&#46;</span>sg</a>), Haoling CHEN (<a class="reference external" href="mailto:h&#46;chen&#37;&#52;&#48;u&#46;nus&#46;edu">h<span>&#46;</span>chen<span>&#64;</span>u<span>&#46;</span>nus<span>&#46;</span>edu</a>) or Meilian LI (<a class="reference external" href="mailto:limeilian&#37;&#52;&#48;u&#46;nus&#46;edu">limeilian<span>&#64;</span>u<span>&#46;</span>nus<span>&#46;</span>edu</a>).</p>
</div>
<div class="cell docutils container">
<div class="cell_input docutils container">
Expand All @@ -469,12 +469,16 @@ <h1>HW#2: Visualizing Historical Temperature Changes in Singapore<a class="heade
<h2>Task 1: Visualize the GEV distribution (30 marks)<a class="headerlink" href="#task-1-visualize-the-gev-distribution-30-marks" title="Link to this heading">#</a></h2>
<p>To visualize the GEV distribution, you can:</p>
<ol class="arabic simple">
<li><p>Fit the Generalized Extreme Value (GEV) distribution to annual maximum daily temperature data and estimate the GEV parameters using the <strong>Maximum Likelihood method</strong>.</p></li>
<li><p>Plot the probability density function (PDF) curve to to represent the distribution directly.</p></li>
<li><p>Calculate the return level for a 20-year event and mark it on the plot.</p></li>
<li><p>Fill the figure with different colors regarding the calculated return level as the dividing line.</p></li>
<li><p>Fit the Generalized Extreme Value (GEV) distribution to annual maximum daily temperature data and estimate the GEV parameters using the <strong>L-Moments method</strong>.</p></li>
<li><p>Plot the probability density function (PDF) curve to represent the distribution directly.</p></li>
<li><p>Calculate the return level for a 10-year event and mark it on the plot.</p></li>
<li><p>Shade the plot with different colors to distinguish areas above and below the calculated return level.</p></li>
<li><p>Ensure that the necessary non-data elements are included, such as title, x/y axis labels, legend, etc. (you can check the <a class="reference external" href="https://xiaoganghe.github.io/python-climate-visuals/chapters/data-visuals/matplotlib-basic.html">Matplotlib tutorial</a> for details).</p></li>
</ol>
<div class="tip admonition">
<p class="admonition-title">Bonus: 10 marks</p>
<p>Illustrate how return levels vary across different return periods (e.g., 2, 5, 10, 20, 50, 100 years) using interactive sliders or dashboards. Resources such as the <a class="reference external" href="https://plotly.com/python/sliders/">Plotly documentation</a> and <a class="reference external" href="https://www.youtube.com/watch?v=gs4d0_AKQi8">this tutorial video</a> may be helpful for this task.</p>
</div>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># Your solutions go here.</span>
Expand All @@ -485,14 +489,14 @@ <h2>Task 1: Visualize the GEV distribution (30 marks)<a class="headerlink" href=
</div>
</section>
<section id="task-2-visualize-the-trend-of-temperature-anomaly-70-marks">
<h2>Task 2: Visualize the trend of temperature anomaly ( 70 marks )<a class="headerlink" href="#task-2-visualize-the-trend-of-temperature-anomaly-70-marks" title="Link to this heading">#</a></h2>
<h2>Task 2: Visualize the trend of temperature anomaly (70 marks)<a class="headerlink" href="#task-2-visualize-the-trend-of-temperature-anomaly-70-marks" title="Link to this heading">#</a></h2>
<section id="q1-visualize-the-time-series-and-trend-of-historical-temperature-anomalies-of-singapore-35-marks">
<h3>Q1: Visualize the time series and trend of historical temperature anomalies of Singapore (35 marks)<a class="headerlink" href="#q1-visualize-the-time-series-and-trend-of-historical-temperature-anomalies-of-singapore-35-marks" title="Link to this heading">#</a></h3>
<ul class="simple">
<li><p>Calculate the annual mean temperature from the daily data. This will result in a data set of 39 values — one per year. (5 marks)</p></li>
<li><p>Calculate the annual temperature anomalies using the first 15-year period as the baseline. (Hint: the anomalies is calculated by substracting the mean temperature over year 1982 to 1996 from the yearly mean temperature.) (5 marks)</p></li>
<li><p>Make a line graph of these annual temperature anomalies and make sure that the necessary non-data elements are included. (10 marks)</p></li>
<li><p>Based on the annual temperature anomalies above, visualize the trend using a 10-year moving window. (15 marks)</p></li>
<li><p>Calculate the annual mean temperature from the daily data. This will result in a dataset of 39 values — one per year. (5 marks)</p></li>
<li><p>Calculate the annual temperature anomalies using the first 10-year period as the baseline. (Hint: subtract the mean temperature over 1982 to 1991 from the annual mean temperature for each year.) (5 marks)</p></li>
<li><p>Visualize the change in these annual temperature anomalies over time, ensuring that you include essential non-data elements. (10 marks)</p></li>
<li><p>Visualize the trend of the annual temperature anomalies using a 5-year moving window. (15 marks)</p></li>
</ul>
<div class="cell docutils container">
<div class="cell_input docutils container">
Expand All @@ -511,8 +515,8 @@ <h3>Q2: Add climate stripes for Singapore (35 marks)<a class="headerlink" href="
</ul>
<p>Tips:</p>
<ul class="simple">
<li><p>You can refer to <a class="reference external" href="https://github.com/josephshea/ClimateStripes/blob/master/ClimateStripes-Canada.ipynb">this GitHub repository</a> to make the climate stripes.</p></li>
<li><p>To make a pretty and accessible (colorblind safe) chart, you might want to fine tune the aesthetics (e.g., color palette of the diverging colorbar) of your chart.</p></li>
<li><p>Refer to <a class="reference external" href="https://github.com/josephshea/ClimateStripes/blob/master/ClimateStripes-Canada.ipynb">this GitHub repository</a> for guidance on creating climate stripes.</p></li>
<li><p>Fine-tune the aesthetics of your chart (e.g., color palette of the diverging colorbar) to ensure it is visually appealing and accessible (colorblind safe).</p></li>
</ul>
<div class="cell docutils container">
<div class="cell_input docutils container">
Expand All @@ -522,6 +526,10 @@ <h3>Q2: Add climate stripes for Singapore (35 marks)<a class="headerlink" href="
</div>
</div>
</div>
<div class="tip admonition">
<p class="admonition-title">Bonus: 10 marks</p>
<p>Create an interactive plot where users can hover over climate stripes and trend lines to view detailed information. For inspiration, you can refer to <a class="reference external" href="https://ourworldindata.org/un-population-2024-revision">this example</a>.</p>
</div>
</section>
</section>
</section>
Expand Down Expand Up @@ -574,7 +582,7 @@ <h3>Q2: Add climate stripes for Singapore (35 marks)<a class="headerlink" href="
<nav class="bd-toc-nav page-toc">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#task-1-visualize-the-gev-distribution-30-marks">Task 1: Visualize the GEV distribution (30 marks)</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#task-2-visualize-the-trend-of-temperature-anomaly-70-marks">Task 2: Visualize the trend of temperature anomaly ( 70 marks )</a><ul class="nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#task-2-visualize-the-trend-of-temperature-anomaly-70-marks">Task 2: Visualize the trend of temperature anomaly (70 marks)</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#q1-visualize-the-time-series-and-trend-of-historical-temperature-anomalies-of-singapore-35-marks">Q1: Visualize the time series and trend of historical temperature anomalies of Singapore (35 marks)</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#q2-add-climate-stripes-for-singapore-35-marks">Q2: Add climate stripes for Singapore (35 marks)</a></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit b18ab2b

Please sign in to comment.