MATLAB to Python

Use of precipitation sheds to explain the increasing rainfall trend in Northern Australia

More Info
expand_more

Abstract

In this thesis, focus lays on converting a MATLAB model to Python. Models are used a lot by students and researchers at universities and they provide an unique way of calculating and reviewing data and results. However, at the Delft University of Technology, a lot of these models are written in MATLAB. MATLAB is a programming language which requires a expensive license. Many researchers in- and outside universities can’t afford this licensewhich means that models are not available for everyone although lots of people would like to work hands on with these type of models. By making the first step in solving this problem, the WAM2-model originally created by R.J. van der Ent, is converted from MATLAB to Python. This conversion is done due to the fact that Python is open-source software which makes the model free to use for everyone. Also, MATLAB and Python syntax is generally the same which makes conversion even easier. Ultimately, theWAM2-model is converted to Python and ready to use by everyone. There are two versions in Python available, namely 1.0 and 2.0. 1.0 is the version with the same structure as the model in MATLAB. However, itwas found that the overall running time for version 1.0was much larger than the original model in MATLAB. This is due to Python executing notebooks inside of one masterscript notebook, which is not very fast with Python’s data structure. To solve this problem, Python WAM2-model 2.0 is created. Version 2.0 makes more effective use of Python’s data structure and this has led to running times almost twice as fast as the original model inMATLAB. Another benefit of conversion is that both model versions in Python are more user-friendly. Headers are possible in Python and by defining the data paths in the beginning of every masterscript, users don’t have to go through every script to change directories. In the tracking of moisture, sometimes the first day requires data which is not available. To make the calculation possible, empty arrays are needed which are now automatically created in Python whereas inMATLAB, the user has to do this at his own expense. Ultimately, the plots created in Python are the same as inMATLAB.However, one additional plot is added, called the contourplot. With agreeing statements from the supervisors, these contourplots are more pleasing to the human eye and therefore they are included in the Python model. Next to converting the model, a readme has been made which can be found in Appendix B. This readme is a step by step guide, helping users by explaining lots of the Python syntax. This guide is therefore also included with the Python model. Using this converted model a precipitation shed is created for North Australia since previous research has shown an increasing rainfall pattern in this region. Different studies have tried to find the cause of this phenomenon. Most important seems to be the rise in sea surface temperature causing stronger monsoons, however also an increasing evaporation trend in Asia is mentioned. On the other hand different research has also shown some interesting effects caused by El Niño. To find answers to link these different studies an analysis is done covering two different periods. First the period 1980 – 1985 has been observed and afterwards this result is compared with the period 2010 – 2015. The sheds are created by tracking the atmospheric moisture backward from North Australia to its original source for both periods. The precipitation sheds provide answers for the increasing precipitation showing an increase in evaporation in the different source areas in the last decades. Also, an increasing precipitation trend in January is observed, which is in line with the stronger monsoons which might have been caused by the increase in sea surface temperature. Therefore fromthis research it can be stated that both local sea surface temperature and the atmospheric changes in Asia have a positive correlation with the increasing rainfall pattern in North Australia as was stated in earlier research. Also, it is found that El Niño is negatively correlated with the increase in precipitation. To conclude, North Australia is indeed dependent on both the atmospheric changes above the Asian continent and the changes of the temperature of the surrounding water bodies. This dependency seems definitely important, since research shows a correlation between rising sea surface temperature and precipitation in Australia of almost one. Also the increase in evaporation in Asia follows an almost linear trend which is in line with the increasing precipitation in North Australia. Therefore it can be stated that following this research it is believed that this might be the cause of the increasing rainfall trend above Northern Australia.