18 Dec 2014 #python

Calliope, an open-source energy systems modelling framework

Energy system models are used by analysts in academia, government and industry. They allow researchers to build internally coherent simulations and scenarios of the extraction, conversion, transportation and use of energy, either today or in the future, at scales ranging from cities to entire countries or continents. These models are particularly important because they can help with understanding and planning the transition from a fossil-fuel dominated energy system to one primarily consisting of clean and renewable energy. Read more...

29 Aug 2014 #python

IPython notebook extensions to ease day-to-day work

Update 26 October 2015: The ipython-extensions repository has been updated with instructions for Jupyter/IPython 4.0, but for now, the CodeMirror customizations do not seem to work. Update 4 March 2015: As of IPython 3.0, it seems that code in custom.js (such as the examples below) should be attached to the app_initialized.NotebookApp event (the ipython-extensions repository is updated accordingly): $([IPython.events]).on("app_initialized.NotebookApp", function () { // your code here }); Since I use the IPython notebook for a lot of explorative data analysis, I wanted some extra functionality to make day-to-day notebook work just a little bit more pleasant. Read more...

21 Apr 2014 #python

IPython extension to toggle dark code cells

Update 25 August 2014: As described in this newer post, this is now part of the ipython-extensions repository. Sometimes it’s more pleasant to read light text on a dark background, particularly when dealing with code. However, depending on ambient lighting, it can be necessary to switch back to dark text on a light background on short notice. To make this possible, I created a simple extension for the IPython notebook (version 2. Read more...

13 Apr 2014 #python

Mapping the world's nuclear power plants

This post demonstrates the use of Python to map the world's nuclear power plants. First, we procure data on plants currently operational or under construction. Then, we make some back of the envelope calculations on how many plants would power the world's current electricity demand. For this latter part, we use GeoPandas, a very interesting development for Python-based geospatial analysis, building on modules such as Fiona and Shapely to add geospatial functionality on top of one of the workhorses of scientific Python, pandas. Read more...

7 Apr 2013 #python

Doing a minor version update for homebrew-installed Python

I install Python with homebrew (on OS X) and manage my packages with virtualenv. I was interested in whether updating from Python 2.7.3 to 2.7.4 would cause my virtualenvs to break. It did, but fixing them turned out to be very simple: First, of course, $ brew upgrade python; brew cleanup python, which installed Python 2.7.4 and then removed 2.7.3. According to this post, re-running virtualenv suffices to update the paths inside a virtualenv (the installed packages remain, and you shouldn’t need to re-install or recompile anything after a minor version update): Read more...