Skip to content

Commit 0b86fa9

Browse files
heistermannkmuehlbauer
authored andcommitted
Fix verify (#9)
* Fix refs to verfication plots and reports
1 parent 3d8edc2 commit 0b86fa9

File tree

3 files changed

+109
-46
lines changed

3 files changed

+109
-46
lines changed

notebooks/basics/wradlib_workflow.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,10 @@
741741
"metadata": {},
742742
"outputs": [],
743743
"source": [
744-
"raw_error.report()\n",
745-
"adj_error.report()"
744+
"print(\"Error metrics for unadjusted radar rainfall estimates:\")\n",
745+
"raw_error.pprint()\n",
746+
"print(\"\\nError metrics for adjusted radar rainfall estimates:\")\n",
747+
"adj_error.pprint()"
746748
]
747749
},
748750
{

notebooks/multisensor/wradlib_adjust_example.ipynb

Lines changed: 74 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"cell_type": "code",
5555
"execution_count": null,
5656
"metadata": {
57-
"collapsed": false,
5857
"slideshow": {
5958
"slide_type": "fragment"
6059
}
@@ -126,7 +125,6 @@
126125
"cell_type": "code",
127126
"execution_count": null,
128127
"metadata": {
129-
"collapsed": true,
130128
"slideshow": {
131129
"slide_type": "fragment"
132130
}
@@ -185,7 +183,6 @@
185183
"cell_type": "code",
186184
"execution_count": null,
187185
"metadata": {
188-
"collapsed": false,
189186
"slideshow": {
190187
"slide_type": "fragment"
191188
}
@@ -232,7 +229,6 @@
232229
"cell_type": "code",
233230
"execution_count": null,
234231
"metadata": {
235-
"collapsed": false,
236232
"slideshow": {
237233
"slide_type": "fragment"
238234
}
@@ -284,7 +280,6 @@
284280
"cell_type": "code",
285281
"execution_count": null,
286282
"metadata": {
287-
"collapsed": false,
288283
"slideshow": {
289284
"slide_type": "fragment"
290285
}
@@ -296,30 +291,60 @@
296291
"mfberror = verify.ErrorMetrics(truth, mfb_adjusted)\n",
297292
"adderror = verify.ErrorMetrics(truth, add_adjusted)\n",
298293
"multerror = verify.ErrorMetrics(truth, mult_adjusted)\n",
299-
"mixerror = verify.ErrorMetrics(truth, mixed_adjusted)\n",
300-
"\n",
294+
"mixerror = verify.ErrorMetrics(truth, mixed_adjusted)"
295+
]
296+
},
297+
{
298+
"cell_type": "code",
299+
"execution_count": null,
300+
"metadata": {},
301+
"outputs": [],
302+
"source": [
303+
"# Helper function for scatter plot\n",
304+
"def scatterplot(x, y, title=\"\"):\n",
305+
" \"\"\"Quick and dirty helper function to produce scatter plots\n",
306+
" \"\"\"\n",
307+
" pl.scatter(x, y)\n",
308+
" pl.plot([0, 1.2 * maxval], [0, 1.2 * maxval], '-', color='grey')\n",
309+
" pl.xlabel(\"True rainfall (mm)\")\n",
310+
" pl.ylabel(\"Estimated rainfall (mm)\")\n",
311+
" pl.xlim(0, maxval + 0.1 * maxval)\n",
312+
" pl.ylim(0, maxval + 0.1 * maxval)\n",
313+
" pl.title(title)"
314+
]
315+
},
316+
{
317+
"cell_type": "code",
318+
"execution_count": null,
319+
"metadata": {
320+
"slideshow": {
321+
"slide_type": "fragment"
322+
}
323+
},
324+
"outputs": [],
325+
"source": [
301326
"# Verification reports\n",
302327
"maxval = 4.\n",
303328
"# Enlarge all label fonts\n",
304329
"font = {'size' : 10}\n",
305330
"pl.rc('font', **font)\n",
306331
"fig = pl.figure(figsize=(14, 8))\n",
307332
"ax = fig.add_subplot(231, aspect=1.)\n",
308-
"rawerror.report(ax=ax, unit=\"mm\", maxval=maxval)\n",
309-
"ax.text(0.2, 0.9 * maxval, \"Unadjusted radar\")\n",
333+
"scatterplot(rawerror.obs, rawerror.est, title=\"Unadjusted radar\")\n",
334+
"ax.text(0.2, maxval, \"Nash=%.1f\" % rawerror.nash(), fontsize=12)\n",
310335
"ax = fig.add_subplot(232, aspect=1.)\n",
311-
"adderror.report(ax=ax, unit=\"mm\", maxval=maxval)\n",
312-
"ax.text(0.2, 0.9 * maxval, \"Additive adjustment\")\n",
336+
"scatterplot(adderror.obs, adderror.est, title=\"Additive adjustment\")\n",
337+
"ax.text(0.2, maxval, \"Nash=%.1f\" % adderror.nash(), fontsize=12)\n",
313338
"ax = fig.add_subplot(233, aspect=1.)\n",
314-
"multerror.report(ax=ax, unit=\"mm\", maxval=maxval)\n",
315-
"ax.text(0.2, 0.9 * maxval, \"Multiplicative adjustment\")\n",
339+
"scatterplot(multerror.obs, multerror.est, title=\"Multiplicative adjustment\")\n",
340+
"ax.text(0.2, maxval, \"Nash=%.1f\" % multerror.nash(), fontsize=12)\n",
316341
"ax = fig.add_subplot(234, aspect=1.)\n",
317-
"mixerror.report(ax=ax, unit=\"mm\", maxval=maxval)\n",
318-
"ax.text(0.2, 0.9 * maxval, \"Mixed (mult./add.) adjustment\")\n",
319-
"mixerror.report(ax=ax, unit=\"mm\", maxval=maxval)\n",
342+
"scatterplot(mixerror.obs, mixerror.est, title=\"Mixed (mult./add.) adjustment\")\n",
343+
"ax.text(0.2, maxval, \"Nash=%.1f\" % mixerror.nash(), fontsize=12)\n",
320344
"ax = fig.add_subplot(235, aspect=1.)\n",
321-
"mfberror.report(ax=ax, unit=\"mm\", maxval=maxval)\n",
322-
"txt = ax.text(0.2, 0.9 * maxval, \"Mean Field Bias adjustment\")"
345+
"scatterplot(mfberror.obs, mfberror.est, title=\"Mean Field Bias adjustment\")\n",
346+
"ax.text(0.2, maxval, \"Nash=%.1f\" % mfberror.nash(), fontsize=12)\n",
347+
"pl.tight_layout()"
323348
]
324349
},
325350
{
@@ -365,7 +390,6 @@
365390
"cell_type": "code",
366391
"execution_count": null,
367392
"metadata": {
368-
"collapsed": true,
369393
"slideshow": {
370394
"slide_type": "fragment"
371395
}
@@ -419,7 +443,6 @@
419443
"cell_type": "code",
420444
"execution_count": null,
421445
"metadata": {
422-
"collapsed": true,
423446
"slideshow": {
424447
"slide_type": "fragment"
425448
}
@@ -454,25 +477,13 @@
454477
"cell_type": "code",
455478
"execution_count": null,
456479
"metadata": {
457-
"collapsed": true,
458480
"slideshow": {
459481
"slide_type": "fragment"
460482
}
461483
},
462484
"outputs": [],
463485
"source": [
464-
"# Two helper functions for repeated plotting tasks\n",
465-
"def scatterplot(x, y, title):\n",
466-
" \"\"\"Quick and dirty helper function to produce scatter plots\n",
467-
" \"\"\"\n",
468-
" pl.scatter(x, y)\n",
469-
" pl.plot([0, 1.2 * maxval], [0, 1.2 * maxval], '-', color='grey')\n",
470-
" pl.xlabel(\"True rainfall (mm)\")\n",
471-
" pl.ylabel(\"Estimated rainfall (mm)\")\n",
472-
" pl.xlim(0, maxval + 0.1 * maxval)\n",
473-
" pl.ylim(0, maxval + 0.1 * maxval)\n",
474-
" pl.title(title)\n",
475-
"\n",
486+
"# Helper functions for grid plots\n",
476487
"def gridplot(data, title):\n",
477488
" \"\"\"Quick and dirty helper function to produce a grid plot\n",
478489
" \"\"\"\n",
@@ -490,7 +501,6 @@
490501
"cell_type": "code",
491502
"execution_count": null,
492503
"metadata": {
493-
"collapsed": false,
494504
"scrolled": true,
495505
"slideshow": {
496506
"slide_type": "fragment"
@@ -531,7 +541,6 @@
531541
"cell_type": "code",
532542
"execution_count": null,
533543
"metadata": {
534-
"collapsed": false,
535544
"slideshow": {
536545
"slide_type": "fragment"
537546
}
@@ -565,26 +574,50 @@
565574
"metadata": {
566575
"celltoolbar": "Slideshow",
567576
"kernelspec": {
568-
"display_name": "Python 2",
577+
"display_name": "Python 3",
569578
"language": "python",
570-
"name": "python2"
579+
"name": "python3"
571580
},
572581
"language_info": {
573582
"codemirror_mode": {
574583
"name": "ipython",
575-
"version": 2
584+
"version": 3
576585
},
577586
"file_extension": ".py",
578587
"mimetype": "text/x-python",
579588
"name": "python",
580589
"nbconvert_exporter": "python",
581-
"pygments_lexer": "ipython2",
582-
"version": "2.7.12"
590+
"pygments_lexer": "ipython3",
591+
"version": "3.6.4"
583592
},
584593
"livereveal": {
585594
"scroll": true
595+
},
596+
"toc": {
597+
"colors": {
598+
"hover_highlight": "#DAA520",
599+
"navigate_num": "#000000",
600+
"navigate_text": "#333333",
601+
"running_highlight": "#FF0000",
602+
"selected_highlight": "#FFD700",
603+
"sidebar_border": "#EEEEEE",
604+
"wrapper_background": "#FFFFFF"
605+
},
606+
"moveMenuLeft": true,
607+
"nav_menu": {
608+
"height": "232px",
609+
"width": "252px"
610+
},
611+
"navigate_menu": true,
612+
"number_sections": false,
613+
"sideBar": true,
614+
"threshold": 4,
615+
"toc_cell": false,
616+
"toc_section_display": "block",
617+
"toc_window_display": false,
618+
"widenNotebook": false
586619
}
587620
},
588621
"nbformat": 4,
589-
"nbformat_minor": 0
622+
"nbformat_minor": 1
590623
}

notebooks/verification/wradlib_verify_example.ipynb

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,12 @@
246246
"outputs": [],
247247
"source": [
248248
"metrics = wradlib.verify.ErrorMetrics(kdp_true, kdp_re)\n",
249-
"metrics.pprint() \n",
250-
"ax = metrics.plot()\n",
249+
"metrics.pprint()\n",
250+
"ax = pl.subplot(111, aspect=1.)\n",
251+
"ax.plot(metrics.obs, metrics.est, \"bo\")\n",
252+
"ax.plot([-1, 2], [-1, 2], \"k--\")\n",
253+
"pl.xlim(-0.3, 1.1)\n",
254+
"pl.ylim(-0.3, 1.1)\n",
251255
"xlabel = ax.set_xlabel(\"True KDP (deg/km)\")\n",
252256
"ylabel = ax.set_ylabel(\"Reconstructed KDP (deg/km)\")"
253257
]
@@ -269,7 +273,31 @@
269273
"name": "python",
270274
"nbconvert_exporter": "python",
271275
"pygments_lexer": "ipython3",
272-
"version": "3.6.3"
276+
"version": "3.6.4"
277+
},
278+
"toc": {
279+
"colors": {
280+
"hover_highlight": "#DAA520",
281+
"navigate_num": "#000000",
282+
"navigate_text": "#333333",
283+
"running_highlight": "#FF0000",
284+
"selected_highlight": "#FFD700",
285+
"sidebar_border": "#EEEEEE",
286+
"wrapper_background": "#FFFFFF"
287+
},
288+
"moveMenuLeft": true,
289+
"nav_menu": {
290+
"height": "232px",
291+
"width": "252px"
292+
},
293+
"navigate_menu": true,
294+
"number_sections": false,
295+
"sideBar": true,
296+
"threshold": 4,
297+
"toc_cell": false,
298+
"toc_section_display": "block",
299+
"toc_window_display": false,
300+
"widenNotebook": false
273301
}
274302
},
275303
"nbformat": 4,

0 commit comments

Comments
 (0)