Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Testing You in Pandas"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Given the Risø V52 met mast data, let's select and make some plots.\n",
"\n",
"### Exercises\n",
"\n",
"Make the following plots: \n",
"1. For a wind speed sector from 250 to 340 degrees, plot a histogram of the mean cup anemometer mean wind speed at 70 m. \n",
"2. Scatter plot the turbulence intensity versus the mean wind speed for two heights (your choice). Overlaid plots are preferred, but if you can't figure out how to do it, then separate plots are fine.\n",
"\n",
"Be sure to add axis labels, legends, titles, etc., where applicable."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Preliminaries"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As always, we must first import the modules we want to use before we can write any code. I'm also setting the jupyter matploblib option to be interactive, as we can do in notebooks."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"% matplotlib notebook\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Load the mean and std dev `.csv` files to dataframes and concatenate them."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"dfs = []\n",
"for csv_name, suffix in zip(['demo_risoe_data_means.csv', 'demo_risoe_data_stdvs.csv'], ['_mean', '_stdv']):\n",
" df_path = f'data/{csv_name}'\n",
" df = pd.read_csv(df_path) # load csv to dataframe\n",
" df['name'] = pd.to_datetime(df['name'].astype(str), format='%Y%m%d%H%M') # convert name to datetime\n",
" df.set_index('name', inplace=True) # set name as index\n",
" df = df.add_suffix(suffix)\n",
" dfs.append(df)\n",
"met_df = pd.concat(dfs, axis=1); # suppress jupyter output with semicolon"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercise 1: Wind Speed Histogram for Sector\n",
"\n",
"For a wind speed sector from 250 to 340 degrees, plot a histogram of the mean cup anemometer mean wind speed at 70 m."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
" # insert code here!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercise 2: TI vs U\n",
"\n",
"Scatter plot the turbulence intensity versus the mean wind speed for two heights (your choice)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
" # insert code here!"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}