{ "metadata": { "name": "", "signature": "sha256:34d911ab9b3d9f3c4de0e631d4b7f5524709c2a8c257b2a6d8d566e5a373b567" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "%load_ext load_style\n", "%load_style talk.css\n", "from talktools import website" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "<style>\n", "\n", ".rendered_html {\n", " font-family: \"proxima-nova\", helvetica;\n", " font-size: 130%;\n", " line-height: 1.5;\n", "}\n", "\n", ".rendered_html h1 {\n", " margin: 0.25em 0em 0.5em;\n", " color: #015C9C;\n", " text-align: center;\n", " line-height: 1.2; \n", " page-break-before: always;\n", "}\n", "\n", ".rendered_html h2 {\n", " margin: 1.1em 0em 0.5em;\n", " color: #26465D;\n", " line-height: 1.2;\n", "}\n", "\n", ".rendered_html h3 {\n", " margin: 1.1em 0em 0.5em;\n", " color: #002845;\n", " line-height: 1.2;\n", "}\n", "\n", ".rendered_html li {\n", " line-height: 1.5; \n", "}\n", "\n", "/*.prompt {\n", " font-size: 120%; \n", "}*/\n", "\n", ".CodeMirror-lines {\n", " font-size: 110%; \n", "}\n", "\n", "/*.output_area {\n", " font-size: 120%; \n", "}*/\n", "\n", "/*#notebook {\n", " background-image: url('files/images/witewall_3.png');\n", "}*/\n", "\n", "h1.bigtitle {\n", " margin: 4cm 1cm 4cm 1cm;\n", " font-size: 300%;\n", "}\n", "\n", "h3.point {\n", " font-size: 200%;\n", " text-align: center;\n", " margin: 2em 0em 2em 0em;\n", " #26465D\n", "}\n", "\n", ".logo {\n", " margin: 20px 0 20px 0;\n", "}\n", "\n", "a.anchor-link {\n", " display: none;\n", "}\n", "\n", "h1.title { \n", " font-size: 250%;\n", "}\n", "\n", "</style>" ], "metadata": {}, "output_type": "display_data", "text": [ "<IPython.core.display.HTML at 0x1049b42d0>" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "conda and anaconda" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "<hr size=5>\n", "anaconda " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[anaconda](https://store.continuum.io/cshop/anaconda/) is a Scientific Python distribution, developed by [](), \n", "from their web-page: \n", " \n", " Anaconda is a completely free enterprise-ready Python distribution for large-scale data processing, predictive analytics, and scientific computing\n", " \n", "some advantages: \n", "\n", "+ free \n", "+ cross-platform \n", "+ 195+ of the [most popular Python packages](http://docs.continuum.io/anaconda/pkg-docs.html) for science, math, engineering, data analysis, ... notably:\n", " <br><br>\n", " + <a href=\"http://www.numpy.org/\">NumPy</a>\n", " + <a href=\"http://www.scipy.org/\">SciPy</a>\n", " + <a href=\"http://pandas.pydata.org/\">Pandas</a>\n", " + <a href=\"http://ipython.org/\">IPython</a>\n", " + <a href=\"http://matplotlib.org/\">Matplotlib</a>\n", " + <a href=\"http://numba.pydata.org/\">Numba</a>\n", " + <a href=\"http://blaze.pydata.org/\">Blaze</a>\n", " + <a href=\"http://bokeh.pydata.org/\">Bokeh</a>\n", " <br><br>\n", " \n", "+ easily install, update, revert Python packages (with dependencies ..)" ] }, { "cell_type": "code", "collapsed": false, "input": [ "website('https://store.continuum.io/cshop/anaconda/',width=1000)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "<iframe src=\"https://store.continuum.io/cshop/anaconda/\" width=\"1000\" height=\"450\">" ], "metadata": {}, "output_type": "pyout", "prompt_number": 2, "text": [ "<IPython.core.display.HTML at 0x1040c0e10>" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "<hr size=5>\n", "conda" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[conda](http://conda.pydata.org/docs/) is a package and **environment management system** akin to virtualenv" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "example, I want to test the [iris](http://scitools.org.uk/iris/index.html) and [cartopy](http://scitools.org.uk/cartopy/index.html) packages.\n", "\n", "These are developed by the [UK Met. Office](http://scitools.org.uk/).\n", "\n", "+ [iris](http://scitools.org.uk/iris/index.html) is a Python package for analysing and visualising meteorological and oceanographic data sets\n", "+ [cartopy](http://scitools.org.uk/cartopy/index.html) is a Python package for advanced map generation with a simple matplotlib interface.\n", "<br>\n", "<br>" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "first create a conda environment named *iris*, with the minimum: python and ipython [+ libraries for the notebook]\n", "\n", " \u1405 conda create -n iris python ipython ipython-notebook\n", "\n", "then: \n", "\n", " \u1405 source activate iris\n", "\n", "and to install (in the `iris` environment)\n", "\n", " \u1405 conda install -c https://conda.binstar.org/scitools cdat-lite\n", " \u1405 conda install -c https://conda.binstar.org/scitools iris\n", " \u1405 conda install -c https://conda.binstar.org/scitools cartopy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A (quick and dirty) exploration of iris and cartopy can be found in [this notebook](./iris_cartopy.ipynb)\n", "\n", "<font color='red'>IMPORTANT</font>: **you need to launch a new instance of the IPython notebook from the `iris` environment**: \n", "\n", " ~/Documents/talks_seminars/metocean/notebooks \u1405 source activate iris\n", "\n", " (iris)~/Documents/talks_seminars/metocean/notebooks \u1405 ipython notebook " ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "binstar" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[binstar](https://binstar.org) is a free service for hosting public packages for pip and conda" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For example, the [GDAL](http://www.gdal.org/) library is not available through **Anaconda** (the package distribution), but some people have compiled it on different platforms, packaged it according to the conda package management system specifications, and made it available through **binstar**, and it can be install via conda. " ] }, { "cell_type": "code", "collapsed": false, "input": [ "website('https://binstar.org/dashboard', width=1000, height=700)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "<iframe src=\"https://binstar.org/dashboard\" width=\"1000\" height=\"700\">" ], "metadata": {}, "output_type": "pyout", "prompt_number": 4, "text": [ "<IPython.core.display.HTML at 0x104ab75d0>" ] } ], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "import iris" ], "language": "python", "metadata": {}, "outputs": [ { "ename": "ImportError", "evalue": "No module named iris", "output_type": "pyerr", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m<ipython-input-3-005053b25f37>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0miris\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mImportError\u001b[0m: No module named iris" ] } ], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }