{'fraction_non_alphanumeric': 0.028939988782950083, 'fraction_numerical': 0.01948027668723126, 'mean_word_length': 4.522609952508776, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Modeling behaviour of wet and dry days in Iran from the perspective of Markov chains

The current study aims to model the behaviour of wet and dry days in Iran using Markov Chain Models. To this end, data related to daily precipitation of 44 synoptic stations for a 25-years interval (1991-2015) was obtained from Iran Meteorological Organization. Then, the Markov features of dry and wet days of Iran including stationary probabilities of dry and wet days occurrence, the expected length of dry periods, the expected length of wet periods, dry-wet spells cycle, return periods for dry or wet episodes and finally, the possibility of occurrence of the continuity of dry days for 5, 10, 15, 20, 25 and 30 days were calculated for all the synoptic stations in a seasonal scale. The results showed that there is the occurrence of dry short continuities (5 and 10 days) in three seasons of autumn, winter and spring with different possibilities all over Iran. However, the possibility of occurrence of long-term dry continuities (more than 20 days) is variable in terms of season and place so that in winter, no possibility of occurrence of this type of continuities is obvious in the northern half of Iran. As in autumn and spring those are the end and beginning of long-term stability conditions of the atmosphere in the upper atmosphere levels of Iran, the possibility of periodical occurrence of 30-days dry days, particularly in the southern half of Iran increases. In addition, the expected return periods for dry days is almost steady for every part of Iran and is in the range between 1 and 2 days. However, the number of return days to a precipitation period does not follow this rule and varies for every part of Iran so that from 2.15 days in autumn to 79 days in spring is variable, pointing to the climate diversity of Iran.


Introduction
Precipitation, as the most important climatic element, has had always special complexities in Iran. These complexities that are mostly due to the geographical status of this broad land have made precipitation not to have a uniform spatial and temporal distribution. In the last few years, the precipitation features of Iran have been studied from different aspects. One of these aspects is to study the structure of wet days in Iran and its regionalization by using multivariate statistical methods (Nazaripour, 2011). Another important aspect considered by Babaie and Farajzadeh (2002) was to study the spatial-temporal changes patterns of precipitation in Iran. Movahedi et al. (2012) also considered the variability of precipitation regimes by using harmonic analysis. Also, the ratio of maximum daily precipitation to Iran's annual precipitation is another subject considered by Zolfaghari et al. (2009).
From the perspective of water resource management, only relying on short-term and medium-term predictions of precipitation in a region cannot be enough, but a comprehensive understanding of the spatial-temporal behaviour of wet and dry periods is also considered as a necessity (Lana and Burgueno, 1998). In order to achieve this comprehensive understanding, a set of statistical methods is needed to model some important aspects like the length of consecutive dry periods or probabilities of consecutive dry days.
Since the length of dry periods is considered a discrete variable by using daily precipitation data, thus discrete models like geometric distribution or truncated negative binomial (De Arruda and Pinto, 1980) can be used to study it. However, using continuous distributions like the exponential distribution in these studies is not very unusual (for example see the study of Burgueno et al. (1994)). Using Markov chains, due to their abilities in comparison to other models, can give us a complete description of the behaviour of wet and dry days dependent on a meteorological station.
Among the classic references that explained this statistical method in a completed way, the studies of Kemeny & Snell (1960), Cox and Miller (1965) and Benjamin and Cornell (1970) can be mentioned. Markov chains, especially the Markov chains of the first-order and second-order, have been widely used in climatology for modeling the behaviour of wet and drought periods or transfer from a wet period to a dry one. Gabriel and Neumann (1962) were among the first people who used this model to study the features of daily precipitation occurrence. According to this model, they showed that daily precipitation in Tel Aviv has the features of twostate first-order Markov chain. In other words, there is a dependency between today's precipitation occurrence and yesterday's governing conditions. However, after the study of Gabriel and Neumann (1962), more complicated models were suggested to estimate the statistical distributions on meteorological data, but using this model has still a special place in climatology and meteorological studies. So that, Todorovic and Woolhieser (1975) used this model to study n-day precipitation and Hopkins and Robillard (1964) studied the daily precipitation of Prairie Province in Canada with this model. Victor and Sastry in 1979 studied the probability features of daily precipitation in Indian agricultural research institute by using this model for a 30-year time period from June to September. The results of this study show that daily precipitations of this station in the studied four months have the best fit at α = 0.01 probability level with first-order Markov chain and at α = 0.05 probability level with the second-order Markov chain for two months of June and September. Singh et al. (1984) also showed that the second-order Markov chain during the summer Monsoon of semi-dry regions in India has the best fit on daily precipitation data in this part of India. Thus, they used this model to study and analyze the probabilities of precipitation in this region. Subramanian and Sanjeeva (1989) are two other researchers who studied the occurrence of dry and wet monsoons of south Andhra Pradesh with the aim of achieving an appropriate crop calendar for dry farming by using the mentioned model. They used the weekly statistics of a 30-year period of precipitation from June to September. The intended threshold of these researchers to determine wet and dry weeks was 20 mm per week because they believed that this amount of precipitation can supply all the water requirements of the plants in then studied region during one week. First-order Markov chain model was the first model selected by these researchers to study the precipitation of this region. Other studies that used this model to identify the precipitation features of one region are the studies of Chin (1977), Jones andThornton (1993), Steineman (2003), Moon et al. (1994), Martin-Vide and Gomez (1999), Lu & Berliner (1999) and Penal and Liano (2006).
Many studies have been carried out in Iran by using this model. They can be classified into two groups in terms of spatial scale: the first group includes the studies that examined the behaviour of wet and dry days in the daily scale (Saligheh et al., 2012;Amini et al., 2011;Asakereh, 2008;Asakereh and Mazini, 2010;Tavousi et al., 2010;Banivahab, 2012;Jalali et al., 2011) and the second group includes the studies that examined the behaviour of dry and wet behaviours in the monthly, seasonal and annual scales Bashirzadeh and Araghi Nejad, 2010;Raziei et al., 2007;Alijani et al., 2012). Mahmoudi et al. (2013) in a comprehensive study regionalized Iran according to the length of dry spells. They fitted Markov chains of different orders according to the length of dry spells with 0.1 mm threshold to show that at the studies with very long dry spells, the Markov chains with lower orders have the best fit, but at the stations that the length of dry spells is not long, the Markov chains with higher orders show the best fit.
In general, the review of available references on the use of Markov chain models in studying the spatial- temporal behaviour of dry and wet days showed that no comprehensive and complete study has been carried out in Iran to include the entire country as a whole unit. All of the previous studies that modeled the behaviour of wet and dry days or examined either one Meteorological station or one province. Thus, the purpose of this study is to model the behaviour or wet and dry days in Iran and extract some of its statistical features by using Markov chain models in order to develop the climatological knowledge of wet and dry days in Iran.

Data and methodology
To model the behaviour of wet and dry days in Iran and achieve a collection of appropriate patterns in this field, the data related to daily precipitation of 44 synoptic stations for a 25-year period (1991-2015) were extracted from Iran meteorological organization. These data were classified in 4 seasons of winter (December, January and February), spring (March, April and May), summer (June, July and August) and autumn (September, October and November). Distribution and scattering of the studied stations in Iran were given in Fig. 1.
After extraction and formation of a database, the second step of the procedure was to determine a threshold to distinguish wet days from dry days. There is much disagreement among climatologists on determining this threshold, so that they suggested different criteria like 0.01, 0.1, 0.15, 0.2, 0.25 and 0.3 for this purpose (Domroes and Ranatung, 1993). Also, the World Meteorological Organization (WMO) defined a wet day with at least 1 mm of precipitation for 24 hours (Alijani et al., 2014). In this study, according to environmental conditions of Iran and low number of wet days at some stations during the year, the value of 0.1 mm precipitation per day was determined as the threshold of a wet day. Now by determining the threshold and isolating days into two groups of dry days with precipitation threshold less than 0.1 mm ) 0 (  t X and wet days with precipitation threshold more than 0.1 mm , the data are ready for fit on Markov chain. The most usual model of Markov chain is the first-order Markov chain that is defined as follows: In this regard, r P is conditional probability and indicates that the result of such process at t+1 depends only on conditions at time t. in other words, the prediction of tomorrow conditions is exclusively carried out by today's data and the yesterday's data do not provide any additional data. The first step to use the Markov chain model is to provide transition frequency matrix for calculating transition probability matrix. Transition frequency matrix for two-state first-order Markov chain is presented as follows: where, ij n shows the frequency of transition states from state i to other possible states j (Moon et al., 1994). In the next step, the transition probability matrix of stations must be calculated by using equation (2) (Alijani et al., 2014). This equation shows that if time series at time t-1 is at state i, the probability of the next value of time series as j t X  1 will be equal to ij P . The matrix obtained from the results of this equation is called as transition probability matrix that is as follows: shows the transition probability from state i to other states j (Moon et al., 1994). After providing transition frequency matrix and transition probability matrix, the independence test is used to study the dependent or independent wet and dry days. In the independence test, the null hypothesis is based on the idea that the series are independent of each other. That is, the data do not follow the first-order Markov this test is based on observed values of crosstab table (O) and expected values (E) under null hypothesis (Asakereh, 2008).
where, is the total rows of each frequency matrix and is the total columns of each frequency matrix. Thus, finally the test statistic is obtained from the following equation: Also, the critical value is calculated based on α = 0.05 and df = − 1 − 1 . Here, r and c are the rows and columns of matrix, respectively. If 2 > , the null hypothesis at the supposed significance level is rejected in which is the corresponding critical value from chi square distribution with − 1 − 1 degree of freedom.
Transition probability matrices make the calculation of different aspects of dry and wet days behaviour at each synoptic station possible in terms of different states and orders of Markov chain as follows (Lana and Burgueno, 1998): The probabilities of detecting n consecutive dry days at a synoptic station according to first-order Markov chain include: The probability of n-day state occurrence after a fixed starting state accuracy to the concept of two state first-order Markov chain matrix 1 2 , can be calculated as follows: That V will be the vector of components (0, 1), if the starting state is related to a wet day and it will be the vector of components (1, 0) if the starting state is a dry day.
A more interesting aspect is to determine starting values for the components of matrix P1 2 n that will show the probabilities of stationary transition for different states of transition.

Figs. 2(a-d). Frequency percent of dry days for seasons in Iran. (a) Winter, (b) Spring, (c) Summer and (d) Autumn
These equations respectively show the columns of the first and second starting of matrix 1 2 . The 2×2 starting matrix is then composed with 2 columns. The first column is the starting probability of a dry day at a synoptic station and second column is a wet day.
The components of transition matrix provide the context for the calculation of the expected length of dry or wet period in addition to the expected length of a dry-wet cycle. Thus, to calculate the length of wet-dry cycle, first the probabilities of detecting n consecutive wet or dry days must be calculated.
Then, the expected length of a dry-wet period can be calculated as follows: Also, the probabilities to return to a dry day after n consecutive days, ER(d), or one wet day after n consecutive days, ER(r), can be stated as follows:

Results
The frequency percent of dry days was calculated for all 44 studied stations in 4 seasons and their results were given as 4 maps in Figs. 2(a-d). According to these maps, it is observed that the average percent of dry days on the south coast of the Caspian Sea is less than 70% in autumn and it reaches to more than 94% in Oman Sea coast in southeast Iran. In this season, Bandar Anzali with 52.9% and Jask with 96.9% had respectively the minimum and maximum frequency percent of dry days.
In winter that is considered as the wettest season in Iran, these values change slightly than autumn, so the south coast of the Caspian Sea in this season had less than 67% and south coasts of southeast Iran had an average more than 91%. The minimum and maximum frequency percent of dry days in this season belong to Rasht station with 55.5% and Jask station with 92.1% respectively.
In spring, the number of wet days in some parts of Iran significantly reduces and this reduction is clearly seen in the map related to spring in Figs. 2(a-d). In this season, Chabahar station with 99% in southeast Iran had the maximum frequency percent of dry days and Ardabil station in northwest Iran with 68.2% had the minimum frequency percent of dry days.
In summer, subtropical high pressure on the upper atmosphere of Iran, there is a very dry season in Iran, so that except the northern coast of Iran, the whole country has more than 90% dry days and at Zabol station, 100% of the studied days were dry.
To model the behaviour of dry and wet days in Iran, the first-order Markov chain was used. Thus, for all 44 studied stations, first transition frequency matrices and then transition probability matrices were adjusted. The number of matrices prepared at this step included 352 matrices; 176 matrices were related to transition frequency matrix and 176 matrices were related to transition probability matrix. After the adjustment of matrices, the chi-square test 2  was used for goodness of fit of firstorder Markov chain at the frequency of different states of wet and dry days at stations. The obtained results were given in Table 1. In this table, the seasons that the frequency of their wet and dry days was not consistent with first-order Markov chain, i.e., their dry and wet days were independent from each other, were shown with red color. In this table, it is observed that in summer, the firstorder Markov chain was not consistent with most stations because there were a few wet days but in winter, due to the high number of wet days that first-order Markov chain is consistent with the frequency of different states of dry and wet days at stations.
The other reason that only first-order Markov chain was used in this study and Markov chains with higher orders were not used was due to two reasons. Firstly, the first-order Markov chain except summer showed the best conformity with frequency of different states of dry and wet days at most stations in three other seasons. The second reason was related to limited number of databases at stations because the small size of databases on the one hand and high number of states related to wet and dry days at higher orders of Markov chain makes some mistakes in calculation of probabilities. Thus, here the Markov features of different states of wet and dry days in Iran are explained according to two-state first-order Markov chain.

The probabilities of detecting n consecutive dry days
The possibility of occurrence of dry day's continuity of 5, 10, 15, 20, 25 and 30-days was the first Markov feature that was calculated using Equation 5 for all stations studied in different seasons of the year. The results of the calculation of the Markov feature have been presented in Tables (2-4) for autumn, winter and spring,   (Table 2).
According to the results of this Markov feature, it is observed that there is the probability of occurring 5 and 10 dry consecutives in 3 seasons of autumn, winter and spring for all studied stations with different probabilities [Tables (2-4)]. But for consecutives higher than 15 days, it is observed that at some stations and seasons, their probability of occurring becomes zero. For example, in autumn, 3 stations of Bandar Anzali, Ramsar and Rasht do not have dry periods more than 15 days due to their precipitation regime in autumn (Table 2).
In winter, with the arrival of wet waves to Iran and since the precipitation regime of most stations in Iran are winter, the probability of occurring long term consecutive dry days is very low, so that a large number of stations like Bandar Anzali, Ramsar, Rasht and Gorgan at southern coasts of Caspian sea and Khorram Abad stations, Sanandaj, Saghez, Zanjan, Hamedan and Kermanshah in western Iran do not have the probability of occurring more than 15 consecutive days [ Figs. 3(a-c)].
In spring, all stations experience 5, 10 and 25 day consecutives with different probabilities from 0.01 to 0.08. In addition, the number of stations that have 30-day consecutives has increased as can be seen in Table 4.
In contrast, the results for some stations such as Bandar Lengeh, Jask and Chabahar in autumn and spring are very much different from other stations. Considering Tables (2&4), it can be seen that the possibility of (a) (b) (c)

Stationary transition probabilities of dry and wet days occurrence
By multiplying transition probability matrix, a situation is occurred in which all rows of transition probability matrix become equal to each other, so that if the process of multiplication continues after this, no change will be observed in transition probability matrix arrays. Such a matrix is called stationary transition probability matrix. This matrix is calculated for all studied stations by using equations 7 and 8 and the results were observed in Table 5 for 3 seasons of autumn, winter and spring.
As this table shows, the long term transition probability of the studied situations from one state to another one. For example, stationary transition probability matrix of autumn in Ahwaz station shows that transition probability to one dry day is equal to 0.86 and to a wet day is equal to 0.14. The lowest transition probability to a dry day in Iran in autumn belongs to Bandar Anzali station, in winter belongs to Rasht station and in spring belongs to Ardabil, Khoy and Ramsar stations. Certainly, the maximum transition probability to a dry day in all 3 seasons belongs to Chabahar station in southeast

Figs. 5(a-c). Expected wet-dry cycle length for different seasons in Iran (in terms of day). (a) Autumn, (b) Winter and (c) Spring
Iran that is respectively equal to 0.97, 0.92 and 0.99 for autumn, winter and spring.

Dry-wet spells cycle
Another important feature that can be extracted from transition probability matrix of stations for understanding the wet and dry days' behaviour in Iran is the expected dry and wet spells length. Expected dry and wet spells length is in fact the long term average (mathematical expectation) of wet and dry spells lengths that was calculated by equations 9 and 10 for all studied stations. Their results were given in the form of contour maps [Figs. (3&4)] As Figs. 3(a-c) shows, the expected dry and wet spells length shows different behaviours in different seasons of Iran. so that, the difference between minimum and maximum expected dry spells length between the northern part and southern part of Iran in autumn is relatively high (Bandar Anzali 3.7 days and Chabahar 50 days). However, this difference reaches to its minimum amount in winter so that the difference between the northern and southern parts of Iran reaches to 12 days in this season (Rasht 3.6 days and Chabahar 16.7 days). In spring, since it is a transition spring, the difference between expected dry days length in the country increases again [ Figs. 3(a-c)].
Expected wet spells length has a more equal behaviour in comparison to expected dry spells length. In other words, there is not much difference between the expected wet spells in the northern and southern parts of Iran. In autumn, the difference between expected wet spells length between the two stations has the maximum and minimum values if almost 1.6 days (Rasht = 2.9 days and Iranshahr = 1.3 day). In winter, this value reaches to 1.4 days (Rasht = 2.9 days and Semnan = 1.5 day) and in From the total values of expected dry-wet spells length, the expected dry-wet cycle for each station is obtained. This feature of Markov chain was calculated by equation 11 for all studied stations and its results were given in the form of 3 maps in Figs. 5(a-c).
According to Figs. 5(a-c), it is observed that wet-dry spells length in winter is not very long for the entire Iran and this is due to the climatic status of this country in this season. The shortest wet-dry cycle length in this season belongs to Gorgan station with 5.7 days and its longest length belongs to Chabahar station with 8.2 days. In autumn, the difference between maximum and minimum dry-wet cycle length between the southern and northern parts of Iran increases (Ramsar = 6.3 days and Jask = 51.9 days) and in spring, this difference reaches to its maximum level (Ardabil = 8.1 days and Chabahar = 101.3 days).

Return periods for dry or wet episode
Figs. (6&7) show the return periods obtained for a new dry or wet day. In Figs. 6(a-c), as can be seen, the expected return periods for dry days is almost fixed for the entire Iran, so that in autumn, it is between 1.03 to 1.87 days, in winter is between 1.09 to 1.82 days and in spring is between 1.01 to 1.46. Thus, it is concluded that there cannot be a significant difference between different parts of Iran.
But the number of return days to a new precipitation period for autumn is between 2.15 to 33.5 days, for winter is between 2.21 to 12 and in spring is

Conclusions
The behaviour of dry and wet days in Iran was modeled according to Markov chains. For this modeling, the transition frequency matrix of first-order Markov chain was adjusted for all studied stations, for goodness of fit test to determine the appropriateness of first-order Markov chain, the chi square test was used. The results of this test showed that different states of wet and dry consecutives in Iran in summer had no Markov behaviour. Thus, summer was excluded from calculations. Then, according to the conformity of twostate first-order Markov chain at different states of wet and dry days, it was made a decision to select first-order Markov chain for extraction of behavioural features of dry and wet days in Iran.
The average frequency percent of dry days in Iran shows that in winter that is considered as the wet season in Iran, changes about 55.5 % in northern Iran to 91% in southeast Iran. This value varies from 52.9 to 96.9% in autumn, from 68.2 to 99.1 % in spring and from 90 to 100% in summer.
There is the occurrence of 5-10 dry days' consecutives in 3 seasons of autumn, winter and spring with different probabilities for the whole country. But the probability of occurring dry consecutives more than 20 days is very variable according to season and place. So that, in winter with the arrival of western waves to Iran, we see the lack of occurrence of these consecutives more than 20 days in the half north of Iran. in two seasons of spring and autumn that are the end and start of long term sustainable conditions in the upper atmosphere of Iran, the probability of occurrence of 30-day dry spells increases very high especially in the southern part of Iran.
The lowest transition probability to one dry day in autumn belongs to Bandar Anzali station, in winter belongs to Rasht station and in spring belongs to Ardabil, Khoy and Ramsar stations that show the wet state of these stations in Iran. But the important point is that this Markov chain feature is related to two stations of northwest Iran, i.e., Ardabil and Khoy stations in spring. The reason that these two stations in this season have the lowest transition probability to a dry day is hidden in the precipitation type of this season in this region because apparently the most precipitations of this region in this season are of convective type especially in comparison to southern coast of Caspian Sea.
Expected return periods for dry days is almost constant throughout Iran and is in a range from 1 to 2 days but the number of return days to a precipitation period does not follow this rule and is very variable for the whole country, so that it varies from 2.15 days in autumn to 79 days in spring that represents the climatic diversity of Iran.
Finally, it can be concluded that the two-state firstorder Markov chain model except summer can model the behaviour of dry and wet days in Iran and reveal most of its hidden features.