Skip to content

Commit 1ef0cf7

Browse files
authored
Update notebooks (#5)
* update notebooks ... shearwater ... show outputs * update readme
1 parent 95672d6 commit 1ef0cf7

File tree

5 files changed

+343
-30
lines changed

5 files changed

+343
-30
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The notebooks demostrate how you can acces the CLINT WPS services using Python w
1111
Try the following notebooks:
1212
* duck
1313
* hawk
14+
* shearwater
1415

1516
You can also run the CLINT WPS service using the Phoenix web-app:
1617
https://clint.dkrz.de/

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ dependencies:
1111
# demo
1212
- owslib
1313
- birdy
14+
- pandas
1415
- xarray
1516
- pyproj

notebooks/duck.ipynb

Lines changed: 71 additions & 13 deletions
Large diffs are not rendered by default.

notebooks/peafowl.ipynb

Lines changed: 18 additions & 9 deletions
Large diffs are not rendered by default.

notebooks/shearwater.ipynb

Lines changed: 252 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
{
1717
"cell_type": "code",
18-
"execution_count": null,
18+
"execution_count": 1,
1919
"id": "572a0c7b-1375-4b41-aae3-4cf61428f95b",
2020
"metadata": {},
2121
"outputs": [],
@@ -25,7 +25,7 @@
2525
},
2626
{
2727
"cell_type": "code",
28-
"execution_count": null,
28+
"execution_count": 2,
2929
"id": "adf8713d-1d97-4942-9b60-981ef379665f",
3030
"metadata": {
3131
"scrolled": true
@@ -40,12 +40,33 @@
4040
},
4141
{
4242
"cell_type": "code",
43-
"execution_count": null,
43+
"execution_count": 3,
4444
"id": "36033b1e-e672-45f8-9f88-9aa77abf6325",
4545
"metadata": {
4646
"scrolled": true
4747
},
48-
"outputs": [],
48+
"outputs": [
49+
{
50+
"name": "stdout",
51+
"output_type": "stream",
52+
"text": [
53+
"Help on WPSClient in module birdy.client.base:\n",
54+
"\n",
55+
"<birdy.client.base.WPSClient object>\n",
56+
" A WPS for forecasting ctropical-cyclone activities.\n",
57+
"\n",
58+
" Processes\n",
59+
" ---------\n",
60+
"\n",
61+
" hello\n",
62+
" Just says a friendly Hello.Returns a literal string output with Hello plus the inputed name.\n",
63+
"\n",
64+
" cyclone\n",
65+
" A process to forecast tropical cyclone activities.\n",
66+
"\n"
67+
]
68+
}
69+
],
4970
"source": [
5071
"# show available processes\n",
5172
"\n",
@@ -54,10 +75,36 @@
5475
},
5576
{
5677
"cell_type": "code",
57-
"execution_count": null,
78+
"execution_count": 4,
5879
"id": "d063413e-6b45-4fcf-baca-c0e318877cfc",
5980
"metadata": {},
60-
"outputs": [],
81+
"outputs": [
82+
{
83+
"name": "stdout",
84+
"output_type": "stream",
85+
"text": [
86+
"Help on method cyclone in module birdy.client.base:\n",
87+
"\n",
88+
"cyclone(start_day='2022-01-01', end_day='2022-01-31', area='Sindian') method of birdy.client.base.WPSClient instance\n",
89+
" A process to forecast tropical cyclone activities.\n",
90+
"\n",
91+
" Parameters\n",
92+
" ----------\n",
93+
" start_day : string\n",
94+
" Enter the start date, like 2021-01-01\n",
95+
" end_day : string\n",
96+
" Enter the end date, like 2023-10-12\n",
97+
" area : {'Sindian', 'TBD'}string\n",
98+
" Choose the region of your interest\n",
99+
"\n",
100+
" Returns\n",
101+
" -------\n",
102+
" output_csv : ComplexData:mimetype:`text/csv`\n",
103+
" csv file\n",
104+
"\n"
105+
]
106+
}
107+
],
61108
"source": [
62109
"# show details of cyclone process\n",
63110
"\n",
@@ -66,16 +113,213 @@
66113
},
67114
{
68115
"cell_type": "code",
69-
"execution_count": null,
116+
"execution_count": 5,
70117
"id": "c5419eca-ac01-43ed-b54b-861f4232b69d",
71118
"metadata": {},
72-
"outputs": [],
119+
"outputs": [
120+
{
121+
"data": {
122+
"text/plain": [
123+
"'ProcessSucceeded'"
124+
]
125+
},
126+
"execution_count": 5,
127+
"metadata": {},
128+
"output_type": "execute_result"
129+
}
130+
],
73131
"source": [
74132
"# run cyclone\n",
75133
"\n",
76134
"resp = wps.cyclone(start_day=\"2019-01-04\", end_day=\"2019-01-05\", area=\"Sindian\")\n",
77135
"resp.status"
78136
]
137+
},
138+
{
139+
"cell_type": "code",
140+
"execution_count": 6,
141+
"id": "09dea9b9-6319-45ee-ba65-1c49e262f582",
142+
"metadata": {},
143+
"outputs": [
144+
{
145+
"data": {
146+
"text/plain": [
147+
"cycloneResponse(\n",
148+
" output_csv='http://shearwater.dkrz.de:80/outputs/shearwater/bf28ea34-2a33-11ef-9168-fa163e86d05a/prediction_Sindian.csv'\n",
149+
")"
150+
]
151+
},
152+
"execution_count": 6,
153+
"metadata": {},
154+
"output_type": "execute_result"
155+
}
156+
],
157+
"source": [
158+
"# show all outputs\n",
159+
"\n",
160+
"resp.get()"
161+
]
162+
},
163+
{
164+
"cell_type": "code",
165+
"execution_count": 7,
166+
"id": "65657950-0b6f-45f6-b83f-fa93935cf7b0",
167+
"metadata": {},
168+
"outputs": [
169+
{
170+
"data": {
171+
"text/html": [
172+
"<div>\n",
173+
"<style scoped>\n",
174+
" .dataframe tbody tr th:only-of-type {\n",
175+
" vertical-align: middle;\n",
176+
" }\n",
177+
"\n",
178+
" .dataframe tbody tr th {\n",
179+
" vertical-align: top;\n",
180+
" }\n",
181+
"\n",
182+
" .dataframe thead th {\n",
183+
" text-align: right;\n",
184+
" }\n",
185+
"</style>\n",
186+
"<table border=\"1\" class=\"dataframe\">\n",
187+
" <thead>\n",
188+
" <tr style=\"text-align: right;\">\n",
189+
" <th></th>\n",
190+
" <th>Unnamed: 0</th>\n",
191+
" <th>latitude</th>\n",
192+
" <th>longitude</th>\n",
193+
" <th>time</th>\n",
194+
" <th>predictions_lag0</th>\n",
195+
" </tr>\n",
196+
" </thead>\n",
197+
" <tbody>\n",
198+
" <tr>\n",
199+
" <th>0</th>\n",
200+
" <td>380016</td>\n",
201+
" <td>0.0</td>\n",
202+
" <td>20.0</td>\n",
203+
" <td>2019-01-04</td>\n",
204+
" <td>0.000010</td>\n",
205+
" </tr>\n",
206+
" <tr>\n",
207+
" <th>1</th>\n",
208+
" <td>380017</td>\n",
209+
" <td>0.0</td>\n",
210+
" <td>22.5</td>\n",
211+
" <td>2019-01-04</td>\n",
212+
" <td>0.000006</td>\n",
213+
" </tr>\n",
214+
" <tr>\n",
215+
" <th>2</th>\n",
216+
" <td>380018</td>\n",
217+
" <td>0.0</td>\n",
218+
" <td>25.0</td>\n",
219+
" <td>2019-01-04</td>\n",
220+
" <td>0.000008</td>\n",
221+
" </tr>\n",
222+
" <tr>\n",
223+
" <th>3</th>\n",
224+
" <td>380019</td>\n",
225+
" <td>0.0</td>\n",
226+
" <td>27.5</td>\n",
227+
" <td>2019-01-04</td>\n",
228+
" <td>0.000014</td>\n",
229+
" </tr>\n",
230+
" <tr>\n",
231+
" <th>4</th>\n",
232+
" <td>380020</td>\n",
233+
" <td>0.0</td>\n",
234+
" <td>30.0</td>\n",
235+
" <td>2019-01-04</td>\n",
236+
" <td>0.000015</td>\n",
237+
" </tr>\n",
238+
" <tr>\n",
239+
" <th>...</th>\n",
240+
" <td>...</td>\n",
241+
" <td>...</td>\n",
242+
" <td>...</td>\n",
243+
" <td>...</td>\n",
244+
" <td>...</td>\n",
245+
" </tr>\n",
246+
" <tr>\n",
247+
" <th>749</th>\n",
248+
" <td>380765</td>\n",
249+
" <td>-30.0</td>\n",
250+
" <td>80.0</td>\n",
251+
" <td>2019-01-05</td>\n",
252+
" <td>0.000099</td>\n",
253+
" </tr>\n",
254+
" <tr>\n",
255+
" <th>750</th>\n",
256+
" <td>380766</td>\n",
257+
" <td>-30.0</td>\n",
258+
" <td>82.5</td>\n",
259+
" <td>2019-01-05</td>\n",
260+
" <td>0.000047</td>\n",
261+
" </tr>\n",
262+
" <tr>\n",
263+
" <th>751</th>\n",
264+
" <td>380767</td>\n",
265+
" <td>-30.0</td>\n",
266+
" <td>85.0</td>\n",
267+
" <td>2019-01-05</td>\n",
268+
" <td>0.000020</td>\n",
269+
" </tr>\n",
270+
" <tr>\n",
271+
" <th>752</th>\n",
272+
" <td>380768</td>\n",
273+
" <td>-30.0</td>\n",
274+
" <td>87.5</td>\n",
275+
" <td>2019-01-05</td>\n",
276+
" <td>0.000020</td>\n",
277+
" </tr>\n",
278+
" <tr>\n",
279+
" <th>753</th>\n",
280+
" <td>380769</td>\n",
281+
" <td>-30.0</td>\n",
282+
" <td>90.0</td>\n",
283+
" <td>2019-01-05</td>\n",
284+
" <td>0.000053</td>\n",
285+
" </tr>\n",
286+
" </tbody>\n",
287+
"</table>\n",
288+
"<p>754 rows × 5 columns</p>\n",
289+
"</div>"
290+
],
291+
"text/plain": [
292+
" Unnamed: 0 latitude longitude time predictions_lag0\n",
293+
"0 380016 0.0 20.0 2019-01-04 0.000010\n",
294+
"1 380017 0.0 22.5 2019-01-04 0.000006\n",
295+
"2 380018 0.0 25.0 2019-01-04 0.000008\n",
296+
"3 380019 0.0 27.5 2019-01-04 0.000014\n",
297+
"4 380020 0.0 30.0 2019-01-04 0.000015\n",
298+
".. ... ... ... ... ...\n",
299+
"749 380765 -30.0 80.0 2019-01-05 0.000099\n",
300+
"750 380766 -30.0 82.5 2019-01-05 0.000047\n",
301+
"751 380767 -30.0 85.0 2019-01-05 0.000020\n",
302+
"752 380768 -30.0 87.5 2019-01-05 0.000020\n",
303+
"753 380769 -30.0 90.0 2019-01-05 0.000053\n",
304+
"\n",
305+
"[754 rows x 5 columns]"
306+
]
307+
},
308+
"execution_count": 7,
309+
"metadata": {},
310+
"output_type": "execute_result"
311+
}
312+
],
313+
"source": [
314+
"# show the result with pandas\n",
315+
"\n",
316+
"import pandas as pd\n",
317+
"\n",
318+
"result_url = resp.get()[0]\n",
319+
"\n",
320+
"df = pd.read_csv(result_url)\n",
321+
"df"
322+
]
79323
}
80324
],
81325
"metadata": {

0 commit comments

Comments
 (0)