|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 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." |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "markdown", |
| 12 | + "metadata": {}, |
| 13 | + "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", |
| 15 | + "```python\n", |
| 16 | + "def linear_regression(x, y):\n", |
| 17 | + " \n", |
| 18 | + " return a, c, ssqe\n", |
| 19 | + "```" |
| 20 | + ] |
| 21 | + }, |
| 22 | + { |
| 23 | + "cell_type": "markdown", |
| 24 | + "metadata": {}, |
| 25 | + "source": [ |
| 26 | + "### 3. Eestimate the mean precipitation on different land use types.\n", |
| 27 | + "\n", |
| 28 | + "```python\n", |
| 29 | + "landuse = np.random.randint(1, 5, [5, 5])\n", |
| 30 | + "precipitation = np.random.random([5, 5])\n", |
| 31 | + "\n", |
| 32 | + "print('landuse\\n', landuse)\n", |
| 33 | + "print('landuse\\n', precipitation)\n", |
| 34 | + "```\n", |
| 35 | + "\n" |
| 36 | + ] |
| 37 | + }, |
| 38 | + { |
| 39 | + "cell_type": "markdown", |
| 40 | + "metadata": {}, |
| 41 | + "source": [ |
| 42 | + "### 4. We have two array. The first array is the distribution of irrigated land. The second array is the precipitation. \n", |
| 43 | + "\n", |
| 44 | + "A. Create a function to create the buffer zones of varied distances to the irrigated land.\n", |
| 45 | + "\n", |
| 46 | + "B. Calculate the mean precipitation in the buffer zones of different distance to the irrigated land.\n" |
| 47 | + ] |
| 48 | + }, |
| 49 | + { |
| 50 | + "cell_type": "markdown", |
| 51 | + "metadata": {}, |
| 52 | + "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", |
| 54 | + "e. g. points = [(3, 4), (1, 2), (7, 8), (9, 4), (6, 5), (8, 7), (4, 7)]\n", |
| 55 | + "\n", |
| 56 | + "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." |
| 57 | + ] |
| 58 | + } |
| 59 | + ], |
| 60 | + "metadata": { |
| 61 | + "kernelspec": { |
| 62 | + "display_name": "Python 3", |
| 63 | + "language": "python", |
| 64 | + "name": "python3" |
| 65 | + }, |
| 66 | + "language_info": { |
| 67 | + "codemirror_mode": { |
| 68 | + "name": "ipython", |
| 69 | + "version": 3 |
| 70 | + }, |
| 71 | + "file_extension": ".py", |
| 72 | + "mimetype": "text/x-python", |
| 73 | + "name": "python", |
| 74 | + "nbconvert_exporter": "python", |
| 75 | + "pygments_lexer": "ipython3", |
| 76 | + "version": "3.7.6" |
| 77 | + } |
| 78 | + }, |
| 79 | + "nbformat": 4, |
| 80 | + "nbformat_minor": 4 |
| 81 | +} |
0 commit comments