{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "\n", "
\n", "\n", "

\n", "

Jonathan J. Helmus, Ph.D.\n", "

\n", "

\n", "

ChiPy

\n", "

August 13, 2015

\n", "
\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## About Me\n", "\n", "\n", "\n", "* Scientist and software developer at Argonne National Laboratory.\n", "* User of the Scientific Python stack \n", " * NumPy, SciPy, matplotlib, etc.\n", "* Lead developer of Py-ART an open source package for working with weather radar data.\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## conda\n", "\n", "* Cross-platform **package** and **environment** management system \n", "* Written by Continuum Analytics\n", "* Open source, BSD license\n", "* Created for Python programs but can package and manage any software.\n", "* Does not require administator privileges." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## conda : the package manager\n", "\n", "Conda is a cross platform package manager which installs binary conda packages." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "# On mac\n", "python\n", "import numpy\n", "\n", "conda --help\n", "conda list # not much installed\n", "conda install scipy # notice dependency resolution\n", "conda insall matplotlib ipython\n", "conda install pandas # notice that version 0.16.2 installed\n", "conda remove pandas\n", "conda install pandas=0.14\n", "conda list # not much installed\n", "\n", "ipython\n", "import pandas\n", "pandas.__version__ # 0.14.1\n", "\n", "conda update pandas\n", "\n", "ipython\n", "import pandas\n", "pandas.__version__ # 0.16.2\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "# On Windows in the ChiPy environment\n", "pip install numpy # Visual C++ what, what what...\n", "conda install numpy\n", "conda install scipy matplotlib ipython\n", "\n", "ipython --pylab\n", "import numpy\n", "import scipy\n", "plot(sin(linspace(-pi, pi)))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "\n", "* **conda install** : Install a package\n", "* **conda remove** : Remove a package\n", "* **conda update** : Update a package\n", "* **conda list** : List packages installed" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## conda : the environment manager\n", "\n", "Conda can create isolated environments that have their own \n", "set of installed and managed packages. " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "# source deactivate\n", "\n", "conda create --name chipy_py27 python=2.7 # who likes Python 2.7\n", "source activate chipy_py27\n", "\n", "python\n", ">>> 5 / 2 # 2...wait\n", ">>> 1 / 2 # 0 \n", ">>> round(1.2) 1.0\n", "\n", "conda install numpy\n", "\n", "python\n", "import numpy\n", "numpy.__version__\n", "\n", "soure deactivate\n", "conda create -n chipy_py34 python=3.4 numpy=1.7 # fail\n", "conda create -n chipy_py34 python=3.4 numpy=1.8\n", "source activate chipy_py34\n", "\n", "python\n", ">>> 5 / 2 # 2.5 better\n", ">>> 1 / 2 # 0.5\n", ">>> round(1.2) 1\n", "type(round(1.2))\n", "numpy.__version__ # 1.8.2" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* **conda create** : Create a new conda environment\n", "* **source activate** : Activate a conda enviroment\n", "* **source deactivate** : Deactivate the current conda enviroment\n", "\n", "Packages are hard linked into the enviroment to save disk space." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Finding conda packages\n", "\n", "Conda can search for packages from the repository provided by Continuum as well as packages created by users and shared on Anaconda.org" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "conda search basemap\n", "conda search cartopy\n", "\n", "conda server search cartopy\n", "anaconda show shoyer/cartopy\n", "\n", "# Search on Anaconda.org\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* **conda search** : Search for packages in the Continuum repository.\n", "* **anaconda search** : Search for user created packages on Anaconda.org" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Creating and sharing conda packages\n", "\n", "Conda packages can be built from a recipe and shared on Anaconda.org" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "cd recipe/pyart\n", "\n", "cd ..\n", "conda build pyart\n", "" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* **conda build** : Build a conda package from a recipe\n", "* **anaconda upload** : Upload a package to Anaconda.org" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [ "anaconda search pyart\n", "anaconda show jjhelmus/pyart\n", "conda create -n radar_fun python=2.7\n", "source activate radar_fun\n", "conda install --channel https://conda.anaconda.org/jjhelmus pyart\n", "conda install ipython basemap\n", "\n", "ipython --pylab\n", "import urllib\n", "import pyart\n", "url = 'ftp://tgftp.nws.noaa.gov/SL.us008001/DF.of/DC.radar/DS.p19r0/SI.klot/sn.last'\n", "f = urllib.urlopen(url)\n", "radar = pyart.io.read_nexrad_level3(f)\n", "display = pyart.graph.RadarMapDisplay(radar)\n", "display.plot_ppi_map('reflectivity', vmin=-32, vmax=80, cmap='pyart_NWSRef', resolution='c', embelish=False)\n", "display.basemap.drawcounties()\n", "draw()" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## How to get conda?\n", "\n", "Conda is available through Anaconda or Miniconda. It cannot be installed seperately.\n", "\n", "* **Anaconda** : Python distribution which includes Python, conda and a number of common scientific packages.\n", "* **Miniconda** : Lightweight distribution, Python and conda only, which can be used to \"bootstrap\" a more complete Python environment.\n", "\n", "Both Anaconda and Miniconda install into a single directory. Try one out! You can always remove this directory to get back your original Python setup." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "
\n", "## Thanks\n", "

\n", "## Questions?\n", "

\n", "
\n", "Jonathan J. Helmus, Ph.D. \n", "

\n", "jjhelmus@gmail.com \n", "

\n", "GitHub: jjhelmus \n", "

\n", "http://nmrglue.com/jhelmus\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "slideshow": { "slide_type": "notes" } }, "outputs": [], "source": [] } ], "metadata": { "celltoolbar": "Slideshow", "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.10" } }, "nbformat": 4, "nbformat_minor": 0 }