 Welcome back to the open course on programming for geospatial hydrological applications. I'm Hans van der Kwaas to your lecture. In this lecture, I will introduce module 2, introduction to Python. So why learn Python? Well, Python is the duct-tape programming language. I mean with that that it's very flexible and it's open source. So you can always share your code with others and they don't have to buy a license and they can simply run the code after installing free software. This is not the case with MATLAB for example. It's also useful for very different purposes. You can use it in data mining in GIS, bioinformatics, CFD modeling, handling text files, plotting, data, but of course also GIS and modeling that we are going to do in this course. Because of all this, it's not surprising that Python is a very much in-demand skill when you look for jobs. If you search for Python in jobs on LinkedIn, you will find more than 200,000 jobs worldwide. If you restrict it to just the Netherlands, you will find around 6,000 jobs that are available for people with Python skills. And we also know from statistics that Python is one of the most popular programming languages at the moment and its popularity is still increasing. For some facts about Python, it was developed in the early 90s of the last century and the developer was a Dutch guy called Guido van Rossen who worked at the Mathematics Center in Amsterdam and later worked for a Google and Dropbox. Now he's retired. The development of Python is led by the Python Software Foundation and the software is actually named after Monty Python because Guido van Rossen was a fan of Monty Python's Flying Circus. And if you don't know about Monty Python, then check on YouTube some videos and you'll have a lot of fun. Let's have a look at specific Python characteristics. Python is a general purpose language, which means it's not developed for a specific field, but it can be used for a whole range of purposes. It's also a high level language. In the previous lecture, we've discussed the meaning of high level. It means that it's closer to the scientist and the scientist doesn't need to know all the bits and bytes and technical things that low level programming languages require. Python therefore also has an emphasis on the readability of code. It doesn't need all kinds of strange brackets and strange signs, but it uses, for example, indentations. If you write loops, it will look at the indented part of your script and that will be defined as the loop. And it's very strict on indentations, so you should not confuse spaces with tabs when you indent. You all learn this in this class. It supports also multiple programming paradigms. It's object-oriented with its functions and its classes. You also learn that. It's imperative, which means you don't need to compile it. You can just run the code and it will give feedback immediately. And it has a very functional and procedural style of coding. It also has a dynamic type system, which means that you don't need to bother about declaring the type of variables, but Python tries to understand it from the way you declare it yourself the first time. And it has automatic memory management, so you don't need to take care of it. And the standard library of Python is very comprehensive and useful for many purposes. But in the next module, we are going to look at Python libraries, which is the real power of Python where third-party libraries can be added to the comprehensive standard library, including added functionality for GIS. Now we're going to discuss a little bit of terminology. We will not discuss terminology of the concepts of Python because that will come during the exercises in the tutorial. And it would be a bit boring to use a lot of slides to explain what a function is and how a tuple works. It's better to learn it by doing and with the explanations in the tutorial. But I will cover here some terminology on the technology that we use. There's implementations, distributions, and IDE. Python implementations are coded in different ways. There is the standard implementation in C, the standard code of Python. But there are also alternatives developed for different purposes. An important one that we will use is IPython or interactive Python. It makes it possible to execute Python in an interactive way, such as in Jupyter Notebooks that I'll discuss later. There's also, for example, Jython, which is for Java virtual machines. Then there are distributions. This is not just Python, but also different libraries that we often need and IDE and other tools that we need in combination with Python. And it's very useful to use a distribution because it makes it easy to use different libraries and tools. Here in this course, we will use Anaconda, which is a distribution that comes with a lot of scientific libraries. And it's completely free. You can also use mthought, which is free in academia. And there are many others that you can find on the internet. But in class, we will use Anaconda. Then there's the IDE, the Integrated Development Environment. That is where you type your Python scripts. You can type, of course, your Python commands at the command prompt, but that doesn't make it a script. So you need an IDE to type your script. And if you use a text editor like Notepad, that would not have the functionality that you need to write properly your scripts. At least you need some syntax highlighting. The default IDE that comes with standard Python distribution is called idle. But since we use the Anaconda distribution, which comes with spider, we will use spider in this class. Another very popular one at the moment is PyCharm. Spider is completely open source. And PyCharm is free, but not open source. There are also a few others that are used a lot. At some point, your scripts will be more complex and you might work in teams on the same code. In that case, you need to store your code centrally in a repository and take care of the version management. The most popular system for that at the moment is GitHub. In GitHub, you can store the code. It can take care of version control. You can have access control. It can be used for tracking bugs. Users can file their bugs there. They can also do feature requests. And if you work in a team, you can even include the management of tasks there at a wiki page or at web pages about the tool. And until now, it has been free for open source projects. But to have more up-to-date information about it, check the current terms of GitHub. Last thing that I'd like to mention are notebooks. Jupyter notebooks are the most popular ones and we will use them also in this class. Notebooks are interactive websites where code can be executed. You can mix instruction text with fields where code can be entered and executed, code such as Python scripts. But it has been developed for Julia, Python, and R, which forms Jupyter as an acronym. It uses the iPython implementation, so Python can be executed in an interactive way. If you've installed the Anaconda distribution, which we'll install later in this course, you will get the instructions for that, then you can launch your Jupyter notebooks from your computer and it can use the libraries that you have installed. This will be a part later in the course. We will start, however, with running it online from a GitHub repository for this course. And there are tools to run these Jupyter notebooks online. They connect to the GitHub repository and run on a server, and tools to do that are Binder or Google Colabs, Colaboratory. In this module, we will use a Jupyter notebook about the introduction to Python. You can choose if you want to launch it through Colab or use Binder. The links are provided in the platform and there's not much difference. If you have more experience, you can download the Jupyter notebook from GitHub and install it locally and run it locally, but that's not really necessary at this point. You will learn that later.