|
54 | 54 | "cell_type": "code", |
55 | 55 | "execution_count": null, |
56 | 56 | "metadata": { |
57 | | - "collapsed": false, |
58 | 57 | "slideshow": { |
59 | 58 | "slide_type": "fragment" |
60 | 59 | } |
|
126 | 125 | "cell_type": "code", |
127 | 126 | "execution_count": null, |
128 | 127 | "metadata": { |
129 | | - "collapsed": true, |
130 | 128 | "slideshow": { |
131 | 129 | "slide_type": "fragment" |
132 | 130 | } |
|
185 | 183 | "cell_type": "code", |
186 | 184 | "execution_count": null, |
187 | 185 | "metadata": { |
188 | | - "collapsed": false, |
189 | 186 | "slideshow": { |
190 | 187 | "slide_type": "fragment" |
191 | 188 | } |
|
232 | 229 | "cell_type": "code", |
233 | 230 | "execution_count": null, |
234 | 231 | "metadata": { |
235 | | - "collapsed": false, |
236 | 232 | "slideshow": { |
237 | 233 | "slide_type": "fragment" |
238 | 234 | } |
|
284 | 280 | "cell_type": "code", |
285 | 281 | "execution_count": null, |
286 | 282 | "metadata": { |
287 | | - "collapsed": false, |
288 | 283 | "slideshow": { |
289 | 284 | "slide_type": "fragment" |
290 | 285 | } |
|
296 | 291 | "mfberror = verify.ErrorMetrics(truth, mfb_adjusted)\n", |
297 | 292 | "adderror = verify.ErrorMetrics(truth, add_adjusted)\n", |
298 | 293 | "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": [ |
301 | 326 | "# Verification reports\n", |
302 | 327 | "maxval = 4.\n", |
303 | 328 | "# Enlarge all label fonts\n", |
304 | 329 | "font = {'size' : 10}\n", |
305 | 330 | "pl.rc('font', **font)\n", |
306 | 331 | "fig = pl.figure(figsize=(14, 8))\n", |
307 | 332 | "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", |
310 | 335 | "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", |
313 | 338 | "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", |
316 | 341 | "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", |
320 | 344 | "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()" |
323 | 348 | ] |
324 | 349 | }, |
325 | 350 | { |
|
365 | 390 | "cell_type": "code", |
366 | 391 | "execution_count": null, |
367 | 392 | "metadata": { |
368 | | - "collapsed": true, |
369 | 393 | "slideshow": { |
370 | 394 | "slide_type": "fragment" |
371 | 395 | } |
|
419 | 443 | "cell_type": "code", |
420 | 444 | "execution_count": null, |
421 | 445 | "metadata": { |
422 | | - "collapsed": true, |
423 | 446 | "slideshow": { |
424 | 447 | "slide_type": "fragment" |
425 | 448 | } |
|
454 | 477 | "cell_type": "code", |
455 | 478 | "execution_count": null, |
456 | 479 | "metadata": { |
457 | | - "collapsed": true, |
458 | 480 | "slideshow": { |
459 | 481 | "slide_type": "fragment" |
460 | 482 | } |
461 | 483 | }, |
462 | 484 | "outputs": [], |
463 | 485 | "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", |
476 | 487 | "def gridplot(data, title):\n", |
477 | 488 | " \"\"\"Quick and dirty helper function to produce a grid plot\n", |
478 | 489 | " \"\"\"\n", |
|
490 | 501 | "cell_type": "code", |
491 | 502 | "execution_count": null, |
492 | 503 | "metadata": { |
493 | | - "collapsed": false, |
494 | 504 | "scrolled": true, |
495 | 505 | "slideshow": { |
496 | 506 | "slide_type": "fragment" |
|
531 | 541 | "cell_type": "code", |
532 | 542 | "execution_count": null, |
533 | 543 | "metadata": { |
534 | | - "collapsed": false, |
535 | 544 | "slideshow": { |
536 | 545 | "slide_type": "fragment" |
537 | 546 | } |
|
565 | 574 | "metadata": { |
566 | 575 | "celltoolbar": "Slideshow", |
567 | 576 | "kernelspec": { |
568 | | - "display_name": "Python 2", |
| 577 | + "display_name": "Python 3", |
569 | 578 | "language": "python", |
570 | | - "name": "python2" |
| 579 | + "name": "python3" |
571 | 580 | }, |
572 | 581 | "language_info": { |
573 | 582 | "codemirror_mode": { |
574 | 583 | "name": "ipython", |
575 | | - "version": 2 |
| 584 | + "version": 3 |
576 | 585 | }, |
577 | 586 | "file_extension": ".py", |
578 | 587 | "mimetype": "text/x-python", |
579 | 588 | "name": "python", |
580 | 589 | "nbconvert_exporter": "python", |
581 | | - "pygments_lexer": "ipython2", |
582 | | - "version": "2.7.12" |
| 590 | + "pygments_lexer": "ipython3", |
| 591 | + "version": "3.6.4" |
583 | 592 | }, |
584 | 593 | "livereveal": { |
585 | 594 | "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 |
586 | 619 | } |
587 | 620 | }, |
588 | 621 | "nbformat": 4, |
589 | | - "nbformat_minor": 0 |
| 622 | + "nbformat_minor": 1 |
590 | 623 | } |
0 commit comments