Starting to work on extended example using climate data
Getting raw data
Getting data into database
Getting all data into database
IPython Notebook to do interactive visualization
swc-windows-installer.py: Install nano source syntax highlighters

Make writing Python source code (and a number of other languages) a
bit more exciting for the eyes and easier on the brain by coloring
strings, comments, and such.

We need to install the source tarball because the compiled zip doesn't
include the syntax highlighting scripts.  To make that easier, I've
extracted out the download / hash-check functionality into a new
download(), which I use in both the old zip_install() and the new
tar_install().  If the user doesn't have an existing ~/.nanorc, we
populate it by adding 'include' options for each of the syntax files
in the Nano tarball.  If they do have an existing ~/.nanorc, I assume
they know what they're doing ;).

The default '*' compression is for transparent detection [1], but you
can override it to explicitly select the compression type if you like.

There's a bit of ugliness to work around the lack of a
--strip-components analog in TarFile.extractall [2].  Instead, we
iterate over the TarInfo members and strip leading components from
their 'name' by hand [3].

[1]: http://docs.python.org/3/library/tarfile.html#tarfile.open
[2]: http://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractall
[3]: http://docs.python.org/3/library/tarfile.html#tarfile.TarInfo.name
Merge branch 'python' into bc-namespaced-python

* python:
  swc-windows-installer.py: Install nano source syntax highlighters
swc-windows-installer.py: Rename ~/.nanorc to ~/nano.rc

The nano FAQ hints that this is the prefered path on MS Windows [1],
and Ethan White confirmed it in testing [2].

[1]: http://www.nano-editor.org/dist/v2.2/faq.html#3.9.1
[2]: https://github.com/swcarpentry/bc/pull/357#issuecomment-37482899
swc-windows-installer.py: Use '~' in ~/nano.rc includes

On Wed, Mar 12, 2014 at 04:44:31PM -0700, Ethan White wrote [1]:
> Got it. We just need to change the `/c/Users/River/` in the include
> statements to `~/` and everything works great!

[1]: https://github.com/swcarpentry/bc/pull/357#issuecomment-37483149
Merge branch 'python' into bc-namespaced-python

* python:
  swc-windows-installer.py: Use '~' in ~/nano.rc includes
  swc-windows-installer.py: Rename ~/.nanorc to ~/nano.rc
swc-windows-installer.py: Use POSIX paths for ~/nano.rc

On Wed, Mar 12, 2014 at 06:34:43PM -0700, Ethan White wrote [1]:
> The bash script in #228 is now working properly, but the Python
> script is still failing. It reports errors like:
>
>     Error reading ~\.swc\share\nanorc\doc\syntax\python.nanorc
>
> The obvious difference is that the nano.rc files produced by the
> bash script have `/` for paths for the includes, but the Python
> script produces includes that use `\`.

[1]: https://github.com/swcarpentry/bc/pull/357#issuecomment-37491038
Merge branch 'python' into bc-namespaced-python

* python:
  swc-windows-installer.py: Use POSIX paths for ~/nano.rc
swc-windows-installer.py: Force UNIX-style \n line endings for ~/nano.rc

On Thu, Mar 13, 2014 at 03:37:12AM -0700, Ethan White wrote [1]:
> We now have a line ending issue resulting in:
>
>     Error reading /cygdrive/c/Users/...
>
> This is fixed by running `dos2unix` on the resulting nano.rc.

This is also mentioned in the nano FAQ [2]:

> Note that the nano.rc file must remain Unix formated in order for
> nano to unerstand it.

Since Python 3.0 and PEP 3116, Python's open() has taken a 'newline'
argument that allows you to override the default line separator for a
particular file [3,4].  However, Python 2.x does not support that
argument [5].  This commit adds a local 'open3' which uses a terrible
hack of a wrapper on Python 2 to fake that support.  It opens the file
in binary mode, and takes advantage of Python 2's lack of distinction
between str and bytes to treat the \n-terminated strings as the raw
binary output.  That's going to crash and burn if you have any
non-ASCII characters in the output content, but we explicitly set all
the components in our relative include_path, so that shouldn't be a
problem.

Another side effect of binary-mode is that we are going to get
ASCII-encoded output, not output encoded in the user's preferred
encoding (locale.getpreferredencoding [3,6]).  That's unfortunate,
because nano does the right thing and uses your locale to decode input
(at least for UTF-8 locales [7], presumably including your nano.rc
file).

[1]: https://github.com/swcarpentry/bc/pull/357#issuecomment-37518899
[2]: http://www.nano-editor.org/dist/v2.2/faq.html#3.9.1
[3]: http://docs.python.org/3/library/functions.html#open
[4]: http://legacy.python.org/dev/peps/pep-3116/
[5]: http://docs.python.org/2/library/functions.html#open
[6]: http://docs.python.org/2/library/stdtypes.html#file.encoding
[7]: http://www.nano-editor.org/dist/v2.2/faq.html#5.3
Merge branch 'python' into bc-namespaced-python

* python:
  swc-windows-installer.py: Force UNIX-style \n line endings for ~/nano.rc
Merge branch 'master' into worked-example
Writing zeroth draft of lesson
Drafting a lesson on working with climate data as a wrap-up for novices
Starting to convert to notebook
Converting a bit more to notebook form
Markdown version of climate example