|
4 | 4 | "cell_type": "markdown",
|
5 | 5 | "metadata": {},
|
6 | 6 | "source": [
|
7 |
| - "### 1. Given two 1-d arrays of simulated values and observed values, Write a Pyhton function to calculate the mean error, coefficient of determination and nash coefficient. Not allowed to use loops." |
| 7 | + "### 1. Given two 1-d arrays of simulated values and observed values, Write a Pyhton function \n", |
| 8 | + "\n", |
| 9 | + "### to calculate the mean error, coefficient of determination and nash coefficient. Loops are NOT allowed." |
8 | 10 | ]
|
9 | 11 | },
|
10 | 12 | {
|
11 | 13 | "cell_type": "markdown",
|
12 | 14 | "metadata": {},
|
13 | 15 | "source": [
|
14 |
| - "### 2. Given `x` and `y`, write a Python function to perform linear regression which returns `a`, `c` and `sum of square errors` where `ax + c = y` \n", |
| 16 | + "### 2. Given `x` and `y`, write a Python function to perform linear regression \n", |
| 17 | + "\n", |
| 18 | + "### which returns `a`, `c` and `sum of square errors` where `ax + c = y` \n", |
15 | 19 | "```python\n",
|
16 | 20 | "def linear_regression(x, y):\n",
|
17 | 21 | " \n",
|
|
26 | 30 | "### 3. Eestimate the mean precipitation on different land use types.\n",
|
27 | 31 | "\n",
|
28 | 32 | "```python\n",
|
29 |
| - "landuse = np.random.randint(1, 5, [5, 5])\n", |
30 |
| - "precipitation = np.random.random([5, 5])\n", |
| 33 | + "landuse = np.random.randint(1, 5, [5, 5])\n", |
| 34 | + "precip = np.random.random([5, 5])\n", |
31 | 35 | "\n",
|
32 | 36 | "print('landuse\\n', landuse)\n",
|
33 |
| - "print('landuse\\n', precipitation)\n", |
| 37 | + "print('precip \\n', precip)\n", |
34 | 38 | "```\n",
|
35 | 39 | "\n"
|
36 | 40 | ]
|
|
39 | 43 | "cell_type": "markdown",
|
40 | 44 | "metadata": {},
|
41 | 45 | "source": [
|
42 |
| - "### 4. We have two array. The first array is the distribution of irrigated land. The second array is the precipitation. \n", |
| 46 | + "### 4. We have two array. The first array is the distribution of irrigated land. \n", |
| 47 | + "\n", |
| 48 | + "### The second array is the precipitation. \n", |
| 49 | + "\n", |
| 50 | + "```python\n", |
| 51 | + "landuse = np.random.randint(0, 1, [6, 6])\n", |
| 52 | + "precip = np.random.random([6, 6])\n", |
| 53 | + "\n", |
| 54 | + "print('landuse\\n', landuse)\n", |
| 55 | + "print('precip \\n', precip)\n", |
| 56 | + "```\n", |
43 | 57 | "\n",
|
44 | 58 | "A. Create a function to create the buffer zones of varied distances to the irrigated land.\n",
|
45 | 59 | "\n",
|
|
50 | 64 | "cell_type": "markdown",
|
51 | 65 | "metadata": {},
|
52 | 66 | "source": [
|
53 |
| - "### 5. Write a Python function to find the nearest point of a list of given points. You are not allowed to use any type of loops.\n", |
| 67 | + "### 5. Write a Python function to find the nearest point of a list of given points. \n", |
| 68 | + "\n", |
| 69 | + "### You are not allowed to use any type of loops.\n", |
| 70 | + "\n", |
54 | 71 | "e. g. points = [(3, 4), (1, 2), (7, 8), (9, 4), (6, 5), (8, 7), (4, 7)]\n",
|
55 | 72 | "\n",
|
56 | 73 | "Hint: using numpy to create a N x N array which contain the distances between each ith an jth point pair; where N is the numer of points."
|
|
0 commit comments