联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2019-11-05 10:16

MTMA33: INTRODUCTION

Assignment 1

Background and syntax

1. El Nino and its effects

The El Nino Southern Oscillation (ENSO) results in sea surface temperature (SST) anomalies

in the Pacific Ocean. ENSO has strong local effects, especially on fisheries. The

perturbations to the circulation caused by ENSO also have far-reaching effects on weather

throughout the tropics. These remote effects are known as ‘teleconnections’. The expected

impact of El Nino on rainfall is shown in Figure 1.

Figure 1: Typical rainfall patterns during El Nino events (map produced by the IRI)

The ENSO related impact on rainfall has significant societal impact, including on the

management of hydrological systems. In this assignment, you will investigate the effect of

ENSO on the Angat reservoir in the Philippines.

2. Linear regression and prediction models in python

A common way of investigating the strength of ENSO effects is to use linear regression. The

strength of an El Nino can be measured by the SST anomaly in the central eastern Pacific

(Nino3.4 region). In this case, we are considering the effect of ENSO on reservoir level. This

can be ‘modelled’ as:

Reservoir_level = A + B * Nino3_SST_anomaly

3

There are several functions in python for doing a linear regression and hence deriving A and

B. These functions are in the numpy or scipy modules. For example:

from scipy.stats.stats import linregress

import numpy as np

X = np.array([1,3,4,5,7])

Y = np.array([10,9,4,3,1])

linearmodel = linregress(X,Y)

linregress() returns a tuple containing a description of the linear model. If you look at the

help function for linregress by typing help(linregress), you will find that the first two

elements of this tuple (in our example, linearmodel[0] and linearmodel[1]) are the slope (B)

and intercept (A). The third and fourth elements are the correlation co-efficient and p-value

(the likelihood of the null hypothesis that the slope (B) is 0).

Assignment tasks

Early warning of floods or water shortages is the key to managing water resources

efficiently. Meteorological services are regularly called on to issue early warnings of flood

and drought. In this assignment, you will be investigating the teleconnection between ENSO

and inflow to the Angat reservoir, near Manila in the Philippines. You will develop a linear

regression model of the link between Nino3.4 SST and dam inflow and use it to estimate the

impact of a predicted El Nino.

I have provided you with historical seasonal time series for Nino3.4 and inflow to the

reservoir. The data are in the file “assignment1_data.txt”, which you can download from

http://www.met.reading.ac.uk/~swrmethn/python_teaching/assignment_data/assignment

1_data.txt

The file contains four columns of data: year, month, dam inflow, Nino3.4 anomaly.

Task 1

Write a series of functions to extract dam inflow data and compare it against the Nino3.4

anomaly for each month of the year.

Can you see a relationship between the two quantities? Does this relationship vary

seasonally? Investigate further, for example by using scatter plots.

Present your results as a short description (maximum one page) and four plots. Note that

restricting the number of plots is intended to assess your ability to design plots that display

data effectively and support your description. You should also submit your code for

assessment in a separate file (see below).

4

Task 2

Use the linregress function to develop a model for dam inflow for December, based on

knowledge of monthly Nino3.4 SST anomalies up to the current month. How accurate do

you think your prediction model is?

Present your results as a short description (maximum one page) and a maximum of two

plots. You should also submit your code for assessment.

Task 3

Using examples from your own code, discuss how code can be designed so that the editor of

a scientific journal, or another researcher, could understand your calculations and use the

code to reproduce your results (given the same input data). [maximum one page]

Format of submissions

Submit your written answers for all three tasks of Assignment 1 in a single PDF file that you

must upload to Blackboard under “Assignment 1”. This file should not contain the code.

Most people find that the easiest way to do this is to write your assignment report in a

WORD doc. Include figures generated by your code by exporting them from Spyder figure

windows as PNG images and then importing these figures into your document.

Upload one Python file with your code for Task 1 and call it task1_mysurname.py (substitute

your actual surname in place of “mysurname”).

Upload a second Python file with your code for Task 2 and call it task2_mysurname.py

5

Marking criteria

You will be assessed on the following criteria:

• Quality of code. Use the guidance on good programming practices and conventions on style

reading the Course Notes Section 4.3 and 5 (70%)

• Clarity of plots, description and interpretation (30%)

Criteria >72% (Distinction) 60 – 69%

Assignment report writing

30% of your assignment marks are allocated to plots, divided into plot description (20%) and

interpretation of results (10%). This is what we are looking for:

1. The report should be written in full sentences, ensuring that the work makes sense to

someone who has not read the question sheet. Enough detail should be given so that the

analysis could be repeated (and re-implemented) by someone who has not got access to the

code.

2. Be concise. Quality not quantity. Proof read and think, “could I have got the same

information across more concisely?”

3. The work should be proof read for basic errors (e.g., incorrect figure numbers)

4. All figures / plots should be referenced within the text.

5. Plots should be chosen that illustrate the key points being made in the text.

6. All plots should have labeled axes, including units. The text on plots should be big enough

to read easily. All symbols should be clear and easy to differentiate. If applicable, a key

should be provided.

7. Captions should clearly describe what is plotted, but should not contain interpretation or

analysis.

8. Your interpretation should clearly stem from your analysis and results – as shown in your

plots. For the highest marks, this should be put in the context of the literature. For

example, ‘Figure 3 shows that TAMSAT underestimates high rainfall. This is consistent with

Maidment et al, 2013, which demonstrates that TAMSAT underestimates the intensity of

high rainfall events in Uganda’.

What you will not be penalized for:

1. Grammatical or stylistic errors that do not detract from the meaning of the text.

2. Submitting more code that you are asked for.

3. Carry through errors i.e. if you make a mistake in an early part of the assignment and this

means that all the rest of your answers are ‘wrong’, you will lose marks only for the initial

error.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp