elegant-scipy / elegant-scipy-submissions

Submissions of code snippets for the book Elegant SciPy
13 stars 2 forks source link

Reasonably simple (but clean) example of numpy & non-numpy code for numerical model #18

Open robintw opened 8 years ago

robintw commented 8 years ago

Author: Robin Wilson (@robintw) Submitted by: Robin Wilson (@robintw)

This code implements the van Heuklon (1979) model of ozone concentrations in the atmosphere. It was originally implemented in standard Python (see the bottom function in the file), and then re-implemented to use numpy (see top function).

It's relatively clean code that shows off how it can be fairly easy to convert from 'pure Python' to numpy-based code. It's also all fairly basic, so could be good in an early chapter of the book so as not to scare people too much!

It may or may not be suitable - but I thought I'd submit it anyway.

Code available at this Gist: https://gist.github.com/robintw/913d4171810a617d4d6c

rougier commented 8 years ago

@robintw You could also consider submitting it to ReScience at http://rescience.github.io (sorry, for the advertisement)

robintw commented 8 years ago

Just FYI, this has now been released on PyPI (see https://pypi.python.org/pypi/vanHOzone), as various people started wanting to use it.