{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#Welcome to the 2015 GSFC Python BootCamp!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Our objective here is to make sure that python is installed properly on your system, in particular all of the various modules that we will be using for our lectures. We therefore *strongly recommend* that you attempt to run this notebook *well before the start of the BootCamp*. If you see a \"Success\" message at the bottom, then you should be good to go! If not, please contact us at pythonbootcamp@bigbang.gsfc.nasa.gov (including the error message) and we will try to help you track down any problems." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#In order to \"run\" this notebook, click on the \"Cell\" tab along the top of this window, and select \"Run All\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "success = True # We'll use this to keep track of the various tests\n", "failures = []" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "try:\n", " import numpy as np\n", " import scipy\n", " print \"numpy and scipy imported -- success!\"\n", "except:\n", " success = False\n", " msg = \"* There was a problem importing numpy or scipy. You will definitely need these!\"\n", " print msg\n", " failures.append(msg)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "try:\n", " import matplotlib\n", " import matplotlib.pyplot as plt\n", " %matplotlib inline\n", "except:\n", " success = False\n", " msg = \"* There was a problem importing matplotlib. You will definitely need this\"\n", " failures.append(msg)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You should see a simple plot below the next cell." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "plt.plot([1, 2, 3], [1, 4, 9], \"ro--\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "try:\n", " import pandas, PyQt4, enaml\n", " print \"pandas, PyQt4, and enaml imported -- success!\"\n", "except:\n", " success = False\n", " msg = \"* There was a problem importing pandas, pyqt, or enaml. You will need these for Days 2 and 3.\"\n", " print msg\n", " failures.append(msg)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "try:\n", " import h5py\n", " from mpl_toolkits.basemap import Basemap\n", " print \"h5py and Basemap imported -- success!\"\n", "except:\n", " success = False\n", " msg = \"* There was a problem with h5py and/or Basemap. You will need these for Day 2.\"\n", " failures.append(msg)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There should be a Basemap plot displayed below this cell." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Basemap Test\n", "try:\n", " f = plt.figure(1, figsize=(14.0, 10.0))\n", " f.suptitle(\"Basemap - First Map\")\n", " f.text(0.05, 0.95, \"Mollewide\")\n", " f.subplots_adjust(left=0.05, right=0.95, top=0.80, bottom=0.05, wspace=0.2, hspace=0.4)\n", " f.add_subplot(1, 1, 1)\n", " b = Basemap(projection=\"moll\", lon_0=0, resolution='c')\n", " b.drawcoastlines()\n", " b.drawparallels(np.arange( -90.0, 90.0, 20.0))\n", " b.drawmeridians(np.arange(-180.0, 181.0, 20.0))\n", "except:\n", " success = False\n", " msg = \"* There was a problem creating a Basemap plot. You will need this for Day 2.\"\n", " failures.append(msg)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "if success:\n", " print \"\"\"Congratulations! Your python environment seems to be working properly.\n", "We look forward to seeing you at the Boot Camp!\"\"\"\n", "elif failures:\n", " print \"\"\"The following problems occurred:\n", "\n", "%s.\n", "\n", "Please contact us and we will try to help you fix things.\"\"\" % (\"\\n\".join(failures))\n", "else:\n", " print \"\"\"There was a problem with your python environment -- please contact us\n", "and we will try to help you figure out what happened.\"\"\"\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "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 }