1 Introduction

As the mother of major external factors, climate change has led to extreme weather events such as temperature fluctuations, humidity changes, and heavy rainfall, resulting in huge economic losses [33]. Variations in the hydrological cycle have become a challenge that has affected society and the environment [8]. Precipitation, which directly affects water resources, ecosystems, floods, and droughts, is a major hydro-climatic variable [9, 21]. Therefore, thorough information on the spatiotemporal changes in rainfall characteristics is needed to calculate possible fluctuations in the hydrological structure [7]. Climate change is one of the main concerns of modern humans in the twenty-first century. It not only affects precipitation but also other important characteristics, such as precipitation intensity, the length of the rainy season, the actual dates of rainfalls, and trends in a given season. According to the previous research, it has been determined that more and more extreme events of weather exist worldwide, and the proposed trend has continued in current years ([11, 29, 31, 34], Reason 2017).

A weather forecast is a statement of estimated weather at a particular location and duration of time [5]. Therefore, it is difficult to overestimate the consequences and the comparative rate of weather predictions. Weather forecast needs continuous observation of conditions related to weather. To monitor these situations, a developing estimation system needs to be established. Although the most important research tasks are still overdue, scientists are quite ready for the rise of mechanical weather forecasting systems that convert these interpretations into the sound analysis. Rainfall prediction is important for mitigating and managing environmental flows and floods and water demand in various parts. However, due to complex atmospheric processes, quantitative rainfall forecasting is challenging [24]. Changes in rainfall patterns affect many sectors of a country such as agriculture, economy, and disaster management [15]. Based on this evidence, the researchers are more and more interested in rainfall forecasting and use deterministic solvers [3, 26] and random programs to provide different accurate and reliable forecasts [10, 14, 19, 20, 22, 25, 32].

Pakistan is an agricultural and agronomic country. The climate is diverse and uneven, from arid to semi-arid. Agriculture depends on the occurrence and quantity of rainfall. Due to unfriendly environmental activities, the country’s temperature change is exceeding its normal limit, which has an optimistic impact on crop production, and this climate change has caused problems such as melting glaciers, floods, and severe droughts in different regions. The parts of the country that sway and influence social and economic conditions particularly affect people who rely mainly on agriculture for their basic needs. A climate change-based report of Pakistan was submitted by the Task Force on Climate Change (TFCC) [26]. Based on the report of TFCC, Pakistan is suffered from several natural adversities, which contains heavy precipitation, torpedoes, severe droughts, earthquakes, and unchanged floods.

Trend analysis of rainfall on a local and regional based has been determined by various researchers. These studies aimed to evaluate monthly, seasonal, and annual precipitation trends for an individual or group of stations. According to the latest research on climate change in Pakistan, rainfall follows very unpredictable, uneven, and unreliable patterns in the area. A difficult situation was created by this type of climate for the individuals living in this atmosphere, and it is necessary to make suitable arrangements and solutions for their livelihood needs. For instance, because of heavy rain in certain areas of Khyber Pakhtunkhwa, Pakistan faced a catastrophic flood on July 29, 2010. It was estimated that there were about 2,000 people died and 700,000 houses were destroyed. The 24-h rainfall in Peshawar reached a record-breaking 274 mm, which exceeds the previous maximum rainfall of 187 mm in April 2009. On the contrary, the central and southern areas of Pakistan suffered severe drought ranging from 1998 to 2001. The primary purpose of the proposed study was to analyze the precipitation trends and weather forecast accuracy in three parts of the country, i.e., Peshawar, Dera Ismail Khan, and Saidu Sharif. This includes an understanding of trends or fluctuations in temperature and rainfall in the area. Considering the reservations related to temperature and precipitation patterns will provide data for better management of irrigation, hydropower, agriculture, and supplementary water-related activities in selected areas.

2 Methodology

2.1 Brief explanation of research region

Khyber Pakhtunkhwa (Kp) is situated from 31.25° to 36.95° North Latitude and 69.83° to 74.11° East Longitude. The province contains two ecological regions known as the small hilly mountains in the south, the mountains in the north, and the Trans-Indus Plain. The hilly areas include the Hindu Kush and the Himalayas, as well as the Kohistan Swat and Dir mountains. Asymmetrical boundary through hilly areas and Indus plains are considered as the river of Kabul. Kp, containing Federally Administrated Tribal Areas (FATA), covers 25.4 million acres of area. The province has 6.27 million acres of arable land. The province's irrigated land includes tube wells, canals, and lifting irrigation programs (total area of 2.29 million acres). The irrigated area of the region is 4.44 million acres.

Pakistan Metrology Department (PMD) provided the data for the current research study. The sites comprised in the data collection are Dera Ismail Khan, Saidu Sharif Swat, and Peshawar (Fig. 1). The analysis of the data was carried out using the techniques described below.

Fig. 1
figure 1

Source: Unpublished thesis

Kp map indicating the particular station.

2.2 Data source and acquisition

Long-term high-resolution rainfall data were obtained from Pakistan Meteorological Department (PMD), Islamabad, and Regional Meteorological Centre (RMC), Peshawar, Pakistan, for the period 1960–2020. Before providing the precipitation dataset, the Pakistan Meteorological Department (PMD) takes all the necessary quality control measures on a standard basis. These measures include homogeneity and extreme value examination, removal of errors either coding or typing in station data, scrutiny of missing data in each station, etc. To interpolate the rain gauge data, a statistical technique named inverse distance weighted interpolation was used. The descriptive statistics for the three stations are shown in Tables 1, 2, and 3, respectively.

Table 1 Statistical information of rainfall data for Peshawar station from 1960 to 2020
Table 2 Statistical information of rainfall data for Dera Ismail Khan station from 1960 to 2020
Table 3 Statistical information of rainfall data for Saidu Sharif station from 1960 to 2020

2.3 Reason for choosing three specific localities

In the past few decades, some areas (Peshawar, Dera Ismail Khan, and Said Sharif) of Pakistan have seen unprecedented rainfall, causing catastrophic floods of more than 400,000 cusecs, surpassing the 1929 Floods (250,000 cusecs) which badly affected the designated three regions in the Kp Province, Pakistan. Due to changes in weather patterns, Pakistan’s Kp province, especially the locations selected in this study, has often been threatened by floods and droughts in recent years [30, PDMA 2012]. However, most of the past studies have focused on the analysis of climate trends in other parts of the province. There is no precipitation trend research focused on these three stations. The proposed study fills this research gap. The criteria of length, uniformity, and completeness were also considered to select these sites.

2.4 Mann–Kendall test

It is a nonparametric statistical technique which is commonly used to determine the trend in hydrological and climatic time series data. The data need not be normally distributed for this test. According to this test:

  • H0: There is no trend in time series data.

  • H1: There is a trend in the data.

If the results of the test follow the null hypothesis (H0), it means that the data will not have a positive or negative trend. Similarly, if the result follows the alternative hypothesis (H1), then the data will have a positive or negative trend. The mathematical equation for the test is:

$$S = \mathop \sum \limits_{k = 1}^{n - 1} \mathop \sum \limits_{j = k + 1}^{n} {\text{sgn}} (x_{j} - x_{k} )$$
(1)

The test can be used for time series data xk, if k = 1, 2, 3,…, n − 1, and xj ranges from j = i + 1, i + 2, i + 3, …, n. Then,

$${\text{sgn}} \left( {x_{j} - x_{k} } \right) = \begin{array}{*{20}c} {1\;{\text{ if}} \left( {x_{j} - x_{k} } \right) > 0} \\ {0 \;{\text{if}} \left( {x_{j} - x_{k} } \right) = 0} \\ { - 1\;{\text{ if}} \left( {x_{j} - x_{k} } \right) < 0} \\ \end{array}$$
(2)

Here, xj and xk are values of chronological data, and n = length of the data set.

If a sample has a value larger than 10, then the normal distribution is used to test the null and alternative hypothesis. In this case, the mean and variance can be calculated as:

$${\text{Var}}\left( S \right) = \left[ {\frac{1}{{18}}n\left( {n - 1} \right)\left( {2n + 5} \right) - ~\mathop \sum \limits_{{p = 1}}^{q} t_{p} \left( {t_{p} - 1} \right)\left( {2t_{p} + 5} \right)} \right]~$$
(3)

where,

tp = Data points number in the pth tied group.

q = tied group number in the data set.

Zmk known as standardized test statistics can be calculated as:

$$Z_{mk} = \left[ {\frac{S \pm 10}{{\sqrt {{\text{Var}}\left( s \right)} }}} \right]$$
(4)

Zmk value indicates the Mann–Kendall test statistic which followed the standard normal distribution, which has an average value and variance of zero and 1, respectively. If − Z1 − α/2 ≤ Zmk ≤ Z1 − α/2 in a two-way trend test, then the null hypothesis H0 will be accepted, where α is an important level indicating the strength of the trend.

2.5 Sen’s slope

A nonparametric technique that can be used for determining the extent of the trend in a time series data [30]. This method can be implemented to evaluate the actual slope of an existing trend, such as the amount of variation per year. The process can also be applied in case of the linear trend such as:

$$f\left( t \right) = Qt + B$$
(5)

In the above equation, Q is the slope of the data while B is a constant value.

To determine the slope of the data, the following equation can be used.

$$Q_{i} = \frac{{x_{j} - x_{k} }}{j - k}$$
(6)

where xk and Xj indicate values of the data during the year k and j where j > k. Suppose we have n values of xj in the time series, then, N = n (n 1)/2.

The median of N values of Qi is known as Sen’s slope.

$$Q = \frac{1}{2}\left( {Q_{{\left[ {\frac{N}{2}} \right]}} + Q_{{\left[ {\left( {N + 1} \right)/2} \right]}} } \right)\quad {\text{if }}N{\text{ is even}}$$
(7)
$$Q = Q_{{\left[ {\left( {N + 1} \right)/2} \right]}} \quad {\text{if }}N{\text{ is odd}}$$
(8)

Based on the Normal distribution and using the nonparametric procedure, we can achieve a two-sided confidence interval about the slope of 100(1 − α) %. An increasing or upward trend is obtained if the value of Qi is positive, while the trend will be decreasing or downward if the value of Qi is negative.

2.6 Weather forecast accuracy

Different parameters can be used to check weather forecast accuracy. In the current study, the weather forecast accuracy of two weather factors (precipitation, temperature) was tested. The degree of precision of precipitation was tested by comparing actual and forecasted precipitation. Correspondingly, a comparison of the forecasted minimum and maximum temperature was tested with the actual temperature to examine the accuracy of the temperature.

2.7 The basic aim of comparing actual and predicted temperature and rainfall

During the last few years, global warming has fascinated great attention from scientists. Global warming is related to the increasing average temperature of the earth's surface, which in turn leads to climate change. Global warming can lead to changes in rainfall patterns and temperature, rising sea levels, and widespread effects on plants, wildlife, and humans. Therefore, the importance of comparing global temperature and rainfall forecasts has been increased.

2.8 Results and discussion

The existing work was done in three parts of Kp, Pakistan (Dera Ismail Khan, Saidu Sharif, and Peshawar) to examine rainfall trends and explore the weather forecast accuracy. To better understand the rainfall trend and weather forecast accuracy, the following section presented and explained the consequences of the existing study.

2.9 Trend analysis of annual and monthly rainfall.

A summary of trend analysis is shown in Tables 4, 5, 6 and Figs. 2, 3, 4, 5, 6, 7 for three stations, Peshawar, Dera Ismail Khan, and Saidu Sharif. The analysis was made using Sen’s Slope and Mann-Kendal test for the proposed stations. The analysis was carried out using average monthly and annual rainfall for each station. The average annual rainfall for Peshawar station shows a positive increasing trend for which the value of the Mann–Kendall test (Z) is 0.425. The average annual rainfall trend is statistically significant for Peshawar station. Similarly, the average monthly rainfall for Peshawar station shows a negative decreasing trend and it is also statistically significant. Similar results were presented by Salma et al. [29] which indicate that the annual rainfall for Peshawar station shows a significant increasing trend. The annual precipitation in Peshawar is more affected by the winter than monsoon rains because the sub-mountain Punjab and Kp have almost equal proportions of winter and summer precipitation Sadiq and Qureshi [28].

Table 4 Trend Analysis for Peshawar Station from 1960 to 2020.
Table 5 Trend Analysis for Dera Ismail Khan Station from 1960 to 2020.
Table 6 Trend Analysis for Saidu Sharif Station from 1960 to 2020.
Fig. 2
figure 2

Source: Pakistan Meteorological Department and Regional Meteorological Centre

A plot of average annual rainfall for Peshawar station. Data

Fig. 3
figure 3

Source: Pakistan Meteorological Department and Regional Meteorological Centre

A plot of average monthly rainfall for Peshawar station. Data

Fig. 4
figure 4

Source: Pakistan Meteorological Department and Regional Meteorological Centre

A plot of average annual rainfall for Dera Ismail Khan station. Data

Fig. 5
figure 5

Source: Pakistan Meteorological Department and Regional Meteorological Centre

A plot of average monthly rainfall for Dera Ismail Khan station. Data

Fig. 6
figure 6

Source: Pakistan Meteorological Department and Regional Meteorological Centre

A plot of average annual rainfall for Saidu Sharif station. Data

Fig. 7
figure 7

Source: Pakistan Meteorological Department and Regional Meteorological Centre

A plot of average monthly rainfall for Saidu Sharif station. Data

The Dera Ismail Khan station showed an increasing trend of annual rainfall although it is statistically not significant. Similarly, the average monthly rainfall indicated a non-significant decreasing trend for which the Mann–Kendall test (Z) value is − 0.121. Rahman and Dawood [25] conducted a similar study in different districts of Kp, indicating that Dera Ismail Khan showed a mix of increasing and decreasing trends for annual and monthly precipitation data.

The results obtained from the analysis of Saidu Sharif station revealed that the average annual and monthly rainfall showed a significant decreasing trend. Similar results were presented by Ijaz et al. [18] specifying significant positive trends from January to June and October to December, and negative trends in July and August.

3 Weather forecast accuracy

3.1 Temperature and precipitation comparison for Peshawar Station

Figure 8 shows the actual average temperature and rainfall of the Peshawar station for three months (January, February, and March 2015) compared to the predicted average temperature and rainfall. Under-estimation was perceived during the first ten days of January, whereas over-estimation was documented during the last ten days. The first ten days of February displayed over the forecast, whereas the residual twenty days were below forecasts. Similarly, the first ten days of March indicated over-forecast, while the last ten days of the month showed slight under-prediction.

Fig. 8
figure 8

Source: Regional Meteorological Centre

Plot of actual and predicted temperature and rainfall comparison for Peshawar station. Data

The January results for rainfall comparison determined that mostly over-forecast occurred during the first two decades of the month, while the third decade shows a lower forecast. The first and third decades of February showed over the forecast, while in the second decade there was a lower forecast. The first and second decade of March indicated that it exceeded the forecast, while the third decade indicated that it was lower than the forecast.

3.2 Temperature and precipitation comparison for Dera Ismail Khan station

Figure 9 demonstrates an assessment of the actual temperature and rainfall and the forecasted average temperature and rainfall at Dera Ismail Khan for the proposed three months, i.e., January, February, and March 2015. In the first ten days of January, there was a slightly over-forecast situation, while in the remaining two decades there were under-predictions. At the beginning of February, the recorded temperature was lower than expected, while the rest of the month showed that the average daily temperature forecast was higher than the actual. Usually, the temperature recorded was lower than expected in March.

Fig. 9
figure 9

Source: Regional Meteorological Centre

Plot of actual and predicted temperature and rainfall comparison for Dera Ismail Khan station. Data

The January rainfall results determined that most of the over-forecast happened in the first and last ten days of January, while the second-decade results indicate a lower forecast. Keeping in view the February results, it was found that insufficient forecasts were found throughout the month. The forecasts for the first and third decades were lower than expected, while the forecasts for the second decade exceeded expectations for March.

3.3 Temperature and precipitation comparison for Saidu Sharif station

Figure 10 explains the association between the actual and predicted average rainfall and temperature at the Saidu Sharif station for the already planned three months known as January, February, and March 2015. In most cases, January indicates that the average temperature exceeded forecasts but also recorded some under-predictions. Many fluctuations were recorded in February, most of which were below average daily temperature forecasts, while some were above average. The first ten days of March showed over forecasts, while the last ten days showed lower forecasts.

Fig. 10
figure 10

Source: Regional Meteorological Centre

Plot of actual and predicted temperature and rainfall comparison for Saidu Sharif station. Data

The January rainfall results revealed under forecast during the first and second decades, but the third decade indicates over the forecast. Taking into consideration the February results, it was noticed that below-prediction was detected in the first and last ten days, whereas over-forecast was examined in the middle ten days of Feb. The average daily rainfall in March showed lower than predicted values but higher than predicted values were also recorded during the first and third decades.

Many research studies fully or partially supported the existing research, i.e., [1, 6, 34]. The first study develops a univariate model for the prediction of monsoon precipitation. The remaining studies also predict the actual and forecasted precipitation and temperature.

4 Discussion

Trend analysis of meteorological parameters is very important for the decision-making of researchers and legislators because rainfall plays a leading role in determining the use of the water available in the area. Climate assessment includes a comprehensive understanding of temperature and rainfall patterns. Therefore, there are many factors to consider when studying climate. According to the results of this study, like many developed and developing countries, Pakistan’s urban areas are also facing land-sea-atmosphere problems caused by global warming. Usually, time series data will give a very significant trend, where the Mann–Kendall trend (Z statistics) and Sen's slope amplitude (Q statistics) values will increase (positive) or decrease (negative).

These findings of this study fully or partially follow the same statistical trends reported in Northwest Pakistan [27]. These findings are consistent with the results of [12, 16], where they found a statistically significant increase in annual precipitation in Northwest Pakistan. The results of this study also support the results of Hanif et al. [17], which found that the summer rainfall has changed significantly. These changes in rainfall trends may lead to more water-related disasters such as drought and floods in Pakistan in the near future. Basistha et al. [4] proposed possible reasons for changes in precipitation trends, such as global climate change, reduction of global monsoon circulation [13], and decline in forest coverage [2, 23] and increased aerosols produced by human activities [27].

5 Conclusions and recommendations

The basic purpose of this study was to determine the trend in monthly and annual rainfall as well as the accuracy of predicted over actual temperature and rainfall. The data were collected from the Pakistan Meteorological Department (PMD) and Regional Meteorological Centre (RMC). The period of the study is six decades from 1960 to 2020. Two nonparametric techniques, i.e., the Mann–Kendall test and Sen’s slope estimator, were used to determine the trend in rainfall. These tests were conducted at a 5% level of significance. The test results revealed that a significant increasing trend was presented by the annual rainfall for Peshawar and Dera Ismail Khan stations, while a negative decreasing trend can be observed by the average monthly rainfall data for all stations. The accuracy of predicted and actual temperature and rainfall indicated that mostly over-forecasting occurred in Saidu Sharif and Peshawar. Maximum precipitation and temperature records in Dera Ismail Khan showed below-forecasts, but some over-forecasts also occurred.

Rainfall is a very important agro-climatic variable. It determines the crop planting system and overall agricultural productivity in rainfed areas in Pakistan, and this increase in annual and seasonal rainfall can be used to better plan water resource development and management strategies and soil moisture protection in the research area of Kp, Pakistan. Based on the above conclusions, it is recommended that analysis of changes in precipitation patterns can be applied as benchmark information for upcoming investigations in hydrology and agricultural arenas. Water supply inside an irrigation system should be built on long-standing precipitation patterns. The existing work was done in only three districts of Khyber Pakhtunkhwa (Kp). The same work should be carried out in other districts of the province. To map precipitation in each region of the KP, GIS and remote sensing and other modern techniques should be used.