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.
In [ ]:
success = True # We'll use this to keep track of the various tests
failures = []
In [ ]:
try:
import numpy as np
import scipy
print "numpy and scipy imported -- success!"
except:
success = False
msg = "* There was a problem importing numpy or scipy. You will definitely need these!"
print msg
failures.append(msg)
In [ ]:
try:
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
except:
success = False
msg = "* There was a problem importing matplotlib. You will definitely need this"
failures.append(msg)
You should see a simple plot below the next cell.
In [ ]:
plt.plot([1, 2, 3], [1, 4, 9], "ro--")
In [ ]:
try:
import pandas, PyQt4, enaml
print "pandas, PyQt4, and enaml imported -- success!"
except:
success = False
msg = "* There was a problem importing pandas, pyqt, or enaml. You will need these for Days 2 and 3."
print msg
failures.append(msg)
In [ ]:
try:
import h5py
from mpl_toolkits.basemap import Basemap
print "h5py and Basemap imported -- success!"
except:
success = False
msg = "* There was a problem with h5py and/or Basemap. You will need these for Day 2."
failures.append(msg)
There should be a Basemap plot displayed below this cell.
In [ ]:
# Basemap Test
try:
f = plt.figure(1, figsize=(14.0, 10.0))
f.suptitle("Basemap - First Map")
f.text(0.05, 0.95, "Mollewide")
f.subplots_adjust(left=0.05, right=0.95, top=0.80, bottom=0.05, wspace=0.2, hspace=0.4)
f.add_subplot(1, 1, 1)
b = Basemap(projection="moll", lon_0=0, resolution='c')
b.drawcoastlines()
b.drawparallels(np.arange( -90.0, 90.0, 20.0))
b.drawmeridians(np.arange(-180.0, 181.0, 20.0))
except:
success = False
msg = "* There was a problem creating a Basemap plot. You will need this for Day 2."
failures.append(msg)
In [ ]:
if success:
print """Congratulations! Your python environment seems to be working properly.
We look forward to seeing you at the Boot Camp!"""
elif failures:
print """The following problems occurred:
%s.
Please contact us and we will try to help you fix things.""" % ("\n".join(failures))
else:
print """There was a problem with your python environment -- please contact us
and we will try to help you figure out what happened."""
In [ ]: