Authors: Mathabo Malange, Phangoxolo Sishuba

3. A Brief Introduction to Python#

3.1. Overview#

This chapter will start by introducing how a working Python environment can be set. Then, the reader will be introduced to the basics of the Python programming language, the language of choice for this e-manual. Since the discussion revolves around ocean colour data analysis, the modules relevant for such analysis will be briefly introduced. How to handle simple tasks associated with data input/output. The reader is encouraged to explore beyond what is introduced here since the Python ecosystem provides a wide range of libraries and frameworks that can be used for the same end.

This chapter is targeted at beginners who either know a little programming or are starting fresh with no programming experience.

3.1.1. Learning Outcomes#

The learning outcomes of this chapter are:

  • Understand the basic concepts and syntax of Python programming language;

  • Understand modules relevant to Ocean Colour Data Analysis;

  • Gain the ability to set up a Python working environment;

  • Gain the ability to open and read files; and

  • Gain the ability to create visualisations in Python.

3.1.2. How to Proceed#

This chapter serves as a basic introduction to Python. You do not need any prior experience with programming to get started. Certain sections will refer to online documentation and other resources that will assist with further understanding and practice.

To proceed with this chapter, ensure that you have the Anaconda downloaded. You can download the software for the operating system your computer runs here and follow the guidelines for installation here. In Section 3.1.3 below, brief guidelines are given on how to set up a working Anaconda environment.

3.1.3. Why Python#

Python is a widely used, high-level programming language that is open-source, meaning that it is made freely available. It was created by Guido van Rossum in the 1980s and further developed by the Python Software Foundation.The list of features that make Python the language of choice is vast. To name but a few

  1. Python was designed with emphasis on code readability with simple syntax, similar to English, which allows programmers to express concepts with fewer lines of code compared to traditional languages such as C/C++;

  2. There are tons of libraries and frameworks for both scientific use and general purpose readily available in the Python ecosystem which makes it the language of choice for many data science projects. For instance, libraries such as scikit-learn provide the gateway to machine learning applications; and last but not least,

  3. Python emerges as one of the widely used programming languages by many organisations around the world in computer science for Big data, Machine Learning and Cloud Computing.

For the above and beyond reasons, this e-manual will use Python as a tool to open, manipulate and visualise Ocean Colour Data.