Frequently Asked Questions#

What is “Scientific Programming”?#

Scientific programming targets to solve scientific problems with the help of computers.

It is sometimes used as synonym for computational science, but in my opinion these are not entirely the same. “Scientific programming” is not really a discipline, and therefore cannot be taught.

What are we doing here then? Well, we are going to learn programming first, and then programming as a tool to do science. We are going to apply our new skills to scientific problems, but not only. Within the time given to us, we won’t be able to learn everything about programming of course. My hope is that at the end of the lecture you’ll have sufficient background and tools at your disposition to solve your own problems, and (this is the most important bit) that you’ll know where to find solutions to the problems you encounter.

Why should I learn programming?#

As a scientist you are going to either produce or analyze data, most of the time you’ll do both. For a long time, scientists have seen programming as a “tool”, a menial task to accomplish in order to answer the questions they were asking. Nowadays programming has taken a prominent place in a scientist’s work, for several reasons:

  • the amount of data we have to handle increases together with computational power and our capacity to store it. I would even argue that the bottleneck in model based scientific discovery isn’t the computational effort anymore, but our capacity to comprehend and analyze these huge amounts of data.

  • the questions we are asking are getting more complex, and so are the tools we are using to answer them. The times when scientists could make discoveries with the help of a piece of paper and a pen are long gone, at least for most of us in the geosciences. We rely heavily on computer models, and these models are developed by us scientists, not only by programmers.

  • science faces a credibility crisis, and part of the mistrust towards scientists comes from the fact that their research happens behind closed doors, using closed source tools and based on protected data. Opening our computers and demonstrating that our code can be trusted is necessary to re-engage confidence in our results.

  • on a more general note: a better understanding of the tools that govern our digital world is a strong asset for many aspects of our everyday life and citizenship.

In simple words, we have to become better programmers to be faster and better at what we do: science.

Why Python?#

We will use the Python programming language in this course. In case you are wondering why this language and not any other like <name your favorite language here>, let me stop you right away: this course is not about “learning Python”, it is about learning the general concepts of programming: algorithmic, numerics, program structure, object oriented programming, testing, etc. Python is just the tool I chose to use for this purpose.

We could indeed have taken any other language, but there are several advantages in using Python. A quick web search will give you millions of reasons, but let me pick some of my favorites here:

  • Python is a general purpose programming language and, as such, well suited to learn general programming concepts. It is therefore better suited than, for example, R which was developed for statistics and has certain particularities regarding object oriented programming in particular.

  • Python can be used for many purposes, from data preprocessing to numerical modeling and plotting. Unless you have a very compelling reason to change, you are likely to be able to use Python for all programming tasks you’ll have in the near future.

  • Python is one of the fastest growing languages for data science. There is a very active community developing new and exiting packages every day, and joining this community is a good bet on the future.

  • Python is free and open-source. No license fee, the code is available for everyone to see.

There are many other reasons to use Python (and some arguments against Python as well of course), but I don’t think it’s relevant to list them here. My argument is following: for a good programmer, switching language is not a very big deal. It’s not easy of course, but it’s possible - becoming a good programmer is the hard bit, and is a never ending process.

Why did you write these lecture notes? There are plenty of other resources online.#

That’s true, and I used many of these resources myself (see External resources). However, none of the tutorials is organized to fit exactly the 15 week semester of Austrian universities. Therefore, I had to make some choices regarding (i) what to teach and (ii) how to teach it. But you are right: there is no need to reinvent the wheel. As you will see, I will rely heavily on external resources, all openly available and written by better teachers than me.

Following the open source philosophy, my lecture notes are also freely available.