Python programlama dili kullanılarak günlük maksimum yağış verilerinin trend ve risk analizleri
Trend and risk analysis of daily maximum rainfall data with python programming language
Yazar: CİHAT SARI
Danışman: DOÇ. DR. YAVUZ SELİM GÜÇLÜ
İstanbul Teknik Üniversitesi / Lisansüstü Eğitim Enstitüsü / İnşaat Mühendisliği Ana Bilim Dalı / Hidrolik ve Su Kaynakları Mühendisliği Bilim Dalı
Derece: Yüksek Lisans, 2023
Konu: İnşaat Mühendisliği = Civil Engineering

Özet:
İklim değişikliği giderek daha ciddi bir sorun haline gelmekte ve hidrolojik olaylar üzerinde etkisi giderek artmaktadır. Bu nedenle, meteorolojik ve hidrolojik verilerin doğru bir şekilde analiz edilmesi, hidrolojik afetlerin yönetimi ve önlenmesi için büyük öneme sahiptir. Meteorolojik bir veri olan yağış ölçümleri, çevre koşullarının ve iklim değişikliğinin izlenmesi ve analiz edilmesi için önemli bir veri kaynağıdır. Aynı zamanda bu veriler, su yönetimi, çevre planlaması ve tarım gibi birçok sektör için hayati önem taşımaktadır. Özellikle trend ve risk analiz yöntemleri, yağış verilerinin incelenmesinde ve analiz edilmesinde önemli araçlardır. Trend analiz yöntemleri yağış verilerindeki eğilim varlığının tespit edilmesinde ve yönünün belirlenmesinde yardımcı olmaktadır. Ayrıca risk analiz yöntemleri de gelecekteki muhtemel yağış yüksekliklerinin belli tekerrür aralığına göre öngörülmesinde yardımcı olan araçlardır. Her iki analiz türünden elde edilen çıktılara göre de alınacak önlemler belirlenebilmektedir. Bu çalışmada, Türkiye'de muhtelif noktalardan elde edilen günlük maksimum yağış verilerinin trend ve risk analizleri hem klasik hem de modern yöntemler kullanılarak yapılmıştır. Analizler sırasında, 10- 20- 50- 100- 200- 500 yıllık dönüş periyotlarına göre yağış değerleri hesaplanmıştır. Bu hesaplamalar neticesinde, trend analiz sonuçlarının sayısal olarak nasıl değiştiği gösterilmiştir. Böylece ilgili tekerrür aralıklarına göre muhtemel en büyük (maksimum) yağış miktarları trend dikkate alınarak öngörülmüştür. Trend analiz yöntemleri olarak klasik Mann-Kendall, modern Şen yaklaşımı (Yenilikçi Trend Analizi, YTA) ve YTA'nın türevleri kullanılmıştır. Risk analizi için kullanılan iki parametreli olasılık dağılım fonksiyonu ise alternatif Burr XII fonksiyonudur. Analizlerin tümü ve görselleştirmeler Python programlama dili kullanılarak elde edilmiştir. Verilerin analizi için Python programlama dilinin etkili bir araç olabileceği de böylece vurgulanmıştır. Çalışma kapsamında, Python programlama dili kullanılarak arayüz oluşturulmuştur. Hem trend hem de risk analizlerinin yapılması açısından değerlendirildiğinde bu denli kapsamlı bir çalışma Python programlama dili kullanılarak ilk defa yapılmıştır. Bu çalışma, yağış verileri üzerinde trend ve risk analizleri yapmak isteyenler için bir örnek teşkil edebilecektir ve bu alanda yapılacak araştırmalara kolaylık sağlayabilecektir. Çalışmada kullanılan veriler Meteoroloji Genel Müdürlüğü (MGM) tarafından elde edilmiştir. Türkiye'nin muhtelif noktalarındaki istasyonlardan elde edilen veriler 1961-2020 yılları arasındaki günlük maksimum yağış değerlerini içermektedir.
YTA ve türevleri uygulanarak gerçekleştirilen trend analizi ile alternatif Burr XII dağılımı uygulanarak gerçekleştirilen risk analizi değerlendirmelerinde çoğunlukla artan trend eğiliminin hakim olduğu sonucuna ulaşılabilmektedir. Mevcut verilere göre Türkiye'de son altmış yılda günlük maksimum yağışların arttığı ve kuraklık tehlikesinin olmadığı söylenebilmektedir. İklim değişikliğinin etkilerinin Türkiye'nin farklı bölgelerinde hissedilmeye başlandığı sonucuna ulaşılabilmektedir.

Abstract:
Climate change is becoming an increasingly serious problem, and its impact on hydrological events is growing. Therefore, accurate analysis of hydrological and meteorological data is of great importance for the management and prevention of hydrological disasters. Precipitation measurements, which are meteorological data, are important source of data for monitoring and analyzing environmental conditions and climate change. Furthermore, these datas are vital for many sectors such as water management, environmental planning, and agriculture. Especially trend and risk analysis methods are important tools for examining and analyzing precipitation data. Trend analysis methods help to detect the presence of trends in precipitation data and determine their direction. Additionally, risk analysis methods are tools that help to predict possible future precipitation heights according to a certain return period. With these predictions precautions can be taken based on the outputs obtained from both types of analysis. 
In this study, trend and risk analysis of daily maximum precipitation data obtained from various stations in Turkey were conducted using both classical and modern methods. During the analyses, precipitation values were calculated for return periods of 10- 20- 50- 100- 200- 500 years. As a result of these calculations, the numerical changes in the trend analysis results were demonstrated. Thus, the possible largest (maximum) precipitation amounts were predicted by taking trends into account for relevant return periods. 
Classical Mann-Kendall, modern Şen approach (Innovative Trend Analysis, ITA), and derivatives of ITA were used as trend analysis methods. The two-parameter probability distribution function used for risk analysis such as new type of Burr XII functions. 
Mann-Kendall method is widely used to detect monotonic trends in environmental, climatic, or hydrological data series. The null hypothesis (H0) suggests the absence of a trend, while the alternative hypothesis (HA) indicates that the data exhibit a monotonic trend. Trend test with Mann-Kendall was applied according to Z probability values. Z values were used in the range of α=0.05 significance level. As a result of this method, four stations have increasing trends and and six stations have no trend conditions.
ITA method demonstrates monotonic or non-monotonic increasing or decreasing trends in trend analysis. It easily identificates monotonic increasing, monotonic decreasing, non-monotonic increasing, non-monotonic decreasing, and no trend types. To apply ITA, firstly datas are divided into two parts. After division, each part is sorted in ascending order. First part is placed at x axis and second part is placed at y axis. These values are compared with scatter diagram. And 1:1 line is drawn on this diagram. If the dots are above the 1:1 line, there is a monotonic increasing trend. Otherwise there is a monotonic decreasing trend. If the dots are partially above or below the line there is a non monotonic increasing or decreasing trend. Finally if the dots are on the line, this means there is no trend. In this study ITA results show monotonic decreasing trends for six stations. Non-monotonic increasing and non-monotonic decreasing trends are eqaually divided for the rest four stations.
In order to examine stability of trends, a derivation of ITA method named Double ITA (D-ITA) is used in this study. In this method data is divided into three parts. So first with second and second with third parts compared each other. If both pairs of data result in the same way, that means there is a stable trend condition. Otherwise there is an instable trend condition.
Improved ITA and improved double ITA methods were applied to see dimension of the data while observing trends. Since ITA and double ITA does not indicate the dimension (number) of the data, improved versions of ITA were used. It is important to say that improved double ITA is used for the first time in this study. Its is also important that these improved versions of ITA is useful especially for large datasets. While visualizing trends with large datasets on a scatter diagram, dots can nest each other. It makes harder to detect trends. Improved versions can solve this issue with showing dimension of the data.
To apply improved ITA, firstly datas are divided into two parts. After division each part is sorted in ascending order. As different from ITA, instead of 1:1 line, y=0 line is used in this method. Differences of first and second parts are calculated. A scatter diagram is drawn with data numbers on the x axis and differences on the y axis.
For Improved double ITA firstly datas are divided into three parts. After division each part is sorted in ascending order. Differences of first and second parts and second and third parts are calculated. A scatter diagram is drawn with data numbers on the x axis and differences on the y axis. This method helps to understand not only dimension of the data but also stability of trends.
A new type of Burr XII distribution is a type of distribution which is obtained by modification of Burr XII distribution. Shape, scale and location parameters in the original distribution (k, a, β and γ) are assumed as k=1, γ=0 and b=1/ β^a . After these conversions a new cumulative distribution function is obtained. Since this new equation is compatible with S-Curve, it is fitted on the data with weibull empirical model. Then, parameters a and b are found. By using a and b parameters and new equation y (probability) versus x (measurements) can be calculated. Also, with inverse equation x (measurements) can be calculated with given y (probabilities). Measurements with given return periods are calculated with this method in this study which shows risks of rainfall.
All analyses and visualizations were carried out using the Python programming language. It was also emphasized that the Python programming language can be an effective tool for analyzing data.
Since processing the data in Excel is time-consuming, an SQL database was created to gather the data. Sqlite was used in this manner. After this stage, reading the data from the database became sufficient for applying trend and risk analyses. Mainly pandas, numpy and matplotlib libraries were used to analyze and visualize the data.
As part of the study, a graphical user interface was created using the Python programming language, and all visualizations were made using this interface. Tkinter library was used to handle this issue. GUI that is created has many widgets to use. There are radio buttons related with each trend and risk analysis methods. Information labels and tables to show results of Mann-Kendall test and some geographical and statistical information about meteorological stations. Also there is a combobox which user can choose station to analyze. After choosing the meteorological station from a combobox, trend and risk analyses are applied automatically on the data in seconds. So all results can be seen and examined through this interface.
Considering from the perspective of both trend and risk analysis, such a comprehensive study was first conducted using the Python programming language. This study could serve as an example for those who want to conduct trend and risk analyses on precipitation data and could facilitate researches in this area. The data used in the study were obtained by the General Directorate of Meteorology (MGM). The data obtained from stations in various locations in Turkey contains daily maximum precipitation values between 1961-2020.
As for the trend analysis results, it has been observed that the stations in Çanakkale, Çorlu, and Edirne, located in the northwest of Marmara and Thrace regions of Turkey, show an unstable increasing trend. For the D-ITA method, it can be stated that the second part and third part of the data either show no trend or have a stable increasing trend. As we move towards the west, the Dikili station shows a non-monotonic increasing trend, indicating an unstable trend. Among the stations in the southern region, Dörtyol demonstrates a stable increasing trend. On the other hand, the trend determination of Şanlıurfa station shows an unstable trend. For ITA results it can be both said that there is an absence of a trend or the presence of a decreasing trend. In the Central Anatolia region, Niğde shows an unstable increasing trend, while Yozgat shows a non-monotonic increasing trend with an unstable trend behavior. Moving towards the Black Sea region, an increasing trend is observed in Zonguldak, showing an unstable non-monotonic decreasing trend. On the contrary, Inebolu shows a stable increasing trend.
When examining the results of the risk analysis, it can be observed that the risks increase in the stations of Thrace, the northwest of Marmara, the Central Black Sea, and the Mediterranean regions, as well as in Niğde in Central Anatolia. On the contrary, the opposite situation is observed in the Western Black Sea and Southeastern Anatolia regions, where the risks appear to decrease based on the analyzed data. Looking at the Dikili station in the Aegean and the Yozgat station in Central Anatolia, it is seen that the risks tend to decrease for small precipitation values but increase for large precipitation values.
In conclusion, the trend analysis was conducted through the application of ITA and its derivatives, as well as the risk analysis performed using the alternative Burr XII distribution. Results generally indicate a dominant increasing trend. This suggests that maximum daily precipitation has increased and there is not a threat of drought in Turkey as a result of the past sixty years data. It can be concluded that effects of climate change are beginning to seen in different regions of Turkey.