{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "name = '2016-12-02-oop-meteo-example'\n", "title = 'Object-Oriented Programming in meteorological data analysis'\n", "tags = 'oop, iris'\n", "author = 'Adrian Matthews'" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from nb_tools import connect_notebook_to_post\n", "from IPython.core.display import HTML, Image\n", "\n", "html = connect_notebook_to_post(name, title, tags, author)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Object-oriented programming (OOP) was discussed in the context of a real, fairly complex (meteorological data analysis) situation, as opposed to the very simple `class` examples usually given." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The example chosen was the calculation of an annual cycle from many years of gridded data, the subsequent smoothing of that annual cycle, and then the subtraction of the smoothed annual cycle from the original data to create anomaly data." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The script `anncycle.py` was used to create an instance of the `AnnualCycle` class from the `data_analysis` module. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "All the code is available on [GitHub](https://github.com/adrianjmatthews/python-iris)." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", " \n", "

This post was written as an IPython (Jupyter) notebook. You can view or download it using\n", " nbviewer.

\n", " " ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "HTML(html)" ] } ], "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.5.2" } }, "nbformat": 4, "nbformat_minor": 0 }