Monthly Precipitation over Northern Middle Atlas, Eastern Morocco: Homogenization and Trends

: The lack of a complete and reliable data series often represents the main difﬁculty in carrying out climate studies. Diverse causes, such as human and instrumental errors, false and incomplete records, and the use of obsolete equipment in some meteorological stations, give rise to inhomogeneities that do not represent climatic reality. This work in the northern part of the Moroccan Middle Atlas used 22 meteorological stations with sometimes-incomplete monthly precipitation data from 1970 to 2019. The homogenization and estimation of the missing data were carried out with the R software package Climatol version 3.1.1. The trends in the series were quantiﬁed by the Mann–Kendall nonparametric test. The results obtained show a low root mean square error (RMSE), between the original and homogenized data, of between 0.5 and 38.7 mm per month, with an average of 8.5 mm. Rainfall trends for the months of December through June are generally downward. These negative trends are signiﬁcantly stronger in the southern and eastern parts of the study area, especially during the month of April (the wettest month). On the other hand, July shows positive trends, with 71% of stations having an increasing precipitation tendency, although only ﬁve (or 1/3) of these are statistically signiﬁcant. From August to November, generally positive trends were also observed. For these months, the percentage of series with a positive and signiﬁcant trend varied between 55 and 77%.


Introduction
Since the early 1970s, the water sector in Morocco has been among the major concerns for public authorities due to its decisive role in the country's food security [1].Decisionmakers are committed to a water management policy and strategies that allow the country to have a water storage capacity and a significant infrastructure [2].However, in the context of current climate change, Morocco is strongly confronted with water scarcity [3].This resource is highly vulnerable to the variability of the climatic conditions.Recent decades seem to have had a significant decrease in rainfall, with an irregular spatio-temporal distribution and more frequent drought seasons [4,5].The significant contribution of the agricultural sector to employment and gross domestic product makes it the main pillar of the Moroccan economy [6].Consequently, socio-economic stability in Morocco is also sensitive to climate change, especially since most agricultural activities, especially cereals, are on rainfed land [7].The rural and poor populations are the most likely to be affected by this change.
Serious concerns have been raised about potential variations in the volumes of water resources and their influence on social and environmental components [8].Thus, several studies have been carried out on the spatio-temporal evolution of climatic parameters as an indicator of these variations [9][10][11][12].
However, unlike temperatures which exhibit consistently large changes coherent with global warming conditions, precipitation exhibits high temporal variability and inconsistent spatial patterns in terms of trends [13,14].Yet, precipitation is of great importance in various climatic settings, especially in semi-arid and arid regions where it is the main source of surface water [15].
It is necessary to study the variability of precipitation on a small scale, in order to deepen our knowledge of rainfall patterns and therefore on the availability of water resources in the different territorial units in a given region [16].Here, we focus on the northern Middle Atlas region.Such work is very interesting for decision-makers and actors in several regions, given that this area is considered a water tower for Morocco, feeding most wadis and rivers.
Particularly in semi-arid areas, rainfall is the most important element of the climate, both for populations and natural environments [17].The occurrence and variability of rainfall largely determine the availability of water resources, the species that can live and the crops that can grow in different regions of the world.The study of rainfall variability, in the context of climate change, draws its importance from water and food security concerns that are strongly raised today.However, direct analysis of the raw data can be misleading due to non-climatic disturbances (such as errors in the observations or in their transmission) and changes in the instrument used both in the location of the observatory, and in its immediate environment [16,18,19].Therefore, quality control and the assessment of the homogeneity of climate data are necessary before undertaking climate research [20].Moreover, series of climatic data may contain gaps, which requires a reconstitution of the missing values.
To avoid erroneous conclusions about the detected changes, the best way to deal with heterogeneity in climatic data series is to examine each station's metadata for accurate information about the historical context of the station, such as changes in measuring device type and observation site, and other relevant documented information [21].Unfortunately, it is usually difficult to obtain complete and reliable metadata, especially in developing countries such as Morocco, where even the recorded climate data available are very limited.To identify irregularities in observed climate data sets, and to make their subsequent adjustments, several statistical homogeneity testing techniques are available [22].These techniques are generally classified into two groups, called absolute and relative methods [23].The choice of which method to use generally depends on the task and the state of available resources and data [20].
For our study, we opted for the Climatol relative method (version 3.1.1)developed by Guijarro [24].This is available as an open-source R package and uses an adaptation of the Paulhus and Kohler [25] method.The choice of this method is justified by the simplicity of its software implementation; the short time length it requires; and its robustness in the homogenization of the series and the filling of the climatic gaps [26], even if the different station records do not cover the same observation period [27,28].We used Climatol here to process the data of 22 stations, without needing to carry out manual homogenization.
The assessment of spatial and temporal trends in precipitation plays an important role for actors and decision-makers in a given region.In this context, several studies have been conducted in many countries and regions to detect spatial and temporal changes in climate parameters [29][30][31][32][33]. Several statistical methods and tests have been defined and used by researchers.A brief literature review of the latter showed the parametric and nonparametric methods widely used to detect significant trends within hydrometeorological series.Among these, the Mann-Kendall test is one of the most frequent non-parametric methods [34][35][36].This test allows us to show the trend significance of a statistical series, assuming that any trend is monotonic but not necessarily linear.
Therefore, this work aims to homogenize the rainfall series that cover the northern Middle Atlas.Further to this, we evaluated the precipitation trends in the homogenized series at a monthly scale, using the Mann-Kendall test.

Study Area Description
The northern Middle Atlas is bounded by the Prerifan hills to the north of the Fez-Taza corridor, the Guercif basin to the northeast, Oued Moulouya river to the east and the central Middle Atlas to the west and southwest (Figure 1).It is located between 33 • 10 and 34 • 20 north and between 4 • 50 and 5 • 30 west.This mountain area is classified among the best-watered mountain ranges in Morocco and is of great hydrogeological interest.The annual precipitation varies between 200 and 500 mm in most of the territory, and average annual temperatures are generally higher, reaching 22 • C. The significant elevations and the relatively complex structure of the limestone and dolomitic terrains have allowed the formation of several natural lakes.The particularly favorable climatic factors (precipitation) and the predominance of karst also make it one of the greatest underground water reservoirs, supplying and regulating the upper tributaries of the most important rivers in the country (Sebou and Moulouya) [37].

Study Area Description
The northern Middle Atlas is bounded by the Prerifan hills to the north of the Fez-Taza corridor, the Guercif basin to the northeast, Oued Moulouya river to the east and the central Middle Atlas to the west and southwest (Figure 1).It is located between 33°10′ and 34°20′ north and between 4°50′ and 5°30′ west.This mountain area is classified among the best-watered mountain ranges in Morocco and is of great hydrogeological interest.The annual precipitation varies between 200 and 500 mm in most of the territory, and average annual temperatures are generally higher, reaching 22 °C.The significant elevations and the relatively complex structure of the limestone and dolomitic terrains have allowed the formation of several natural lakes.The particularly favorable climatic factors (precipitation) and the predominance of karst also make it one of the greatest underground water reservoirs, supplying and regulating the upper tributaries of the most important rivers in the country (Sebou and Moulouya) [37].
In the Middle Atlas, agricultural land covers only 20% of the area.This low rate is explained by the fact that the local economy was once linked to pastoralism [38].Currently, it is based on unsophisticated agriculture associated with extensive livestock farming and the exploitation of the forest (State domain), which occupies 24% of the space (while 56% is occupied by non-forest rangelands).
This territory is very seldom studied from a climatic point of view, despite its importance in terms of the supply of water for both drinking and agriculture.In the Middle Atlas, agricultural land covers only 20% of the area.This low rate is explained by the fact that the local economy was once linked to pastoralism [38].Currently, it is based on unsophisticated agriculture associated with extensive livestock farming and the exploitation of the forest (State domain), which occupies 24% of the space (while 56% is occupied by non-forest rangelands).
This territory is very seldom studied from a climatic point of view, despite its importance in terms of the supply of water for both drinking and agriculture.

Observed Climate Data Sources and Station Selection
The climatic data used in this work are monthly rainfall series recorded in 22 observation stations.With the exception of the Taza station, which belongs to the National Directorate of Meteorology (DMN), the other stations belong to the hydraulic basin agencies of Moulouya (ABHM) and Sebou (ABHS).These administrations are responsible for collecting all possible climatic and hydrological data in their respective basins.The records collected do not all cover the same time period (Figure 2).Since the spatial coverage of measurements in the study region is quite low, we have used all available stations in and around the area (Figure 1) in order to fill in the gaps and identify any inhomogeneities, for the period from 1970 to 2019.The geographical coordinates of the stations are given in Table 1.

Quality Controls
Over long periods, it is difficult to find complete climate data series without errors or gaps [27].In the case of Morocco, the problem of homogenizing climate data is a key one for many kinds of climate research [16].This situation requires quality control of the statistical series.For this, it is essential to look for a method or tool that can help us solve these different difficulties [22].
The first step was to fill in the missing data.After filling, data were checked both for outliers and/or change points of non-climate origin, and heterogeneity in the data sets.
Although several climate-data quality-control techniques are available, there is no single approach recommended and generally accepted by all researchers [21,39].The Climatol tool (version 3.1.1)(https://www.climatol.eu/,accessed on 15 June 2022), chosen here, is frequently used in the climate literature for data homogenization, filling in missing data and correcting outliers [16,18,24].

Homogenization of Precipitation Series
Our work begins with the gap-filling and homogenization of the collected precipitation series.This step is based on the Climatol procedure cited in the work of Guijarro [24].The method used is based on orthogonal regression, widely known as reduced major axis (RMA).It examines the linear relationship between two continuous variables: a response (Y) and a predictor (X).In orthogonal regression, both the response and the predictor are assumed to a contain measurement error, which is not the case in simple linear regression (least squares regression) [40].Climatol uses RMA for its simplicity, and to allow the use of neighboring series even if they do not have a common observation period with the problem series, which would prevent the fitting of linear regression models [41].
Assuming the linear regression model y = α + βx + ε, where y and x are dependent and independent variables, respectively; α and β are ordinary least squares (OLS) regression coefficients; and ε is a random error term, the RMA slope coefficient is βRMA = β/|ryx|, where ryx is the Pearson correlation coefficient between y and x.The standard error (SE) of βRMA is equal to the SE of β.The RMA intercept coefficient is αRMA = y − βRMAx, and the SE of αRMA is equal to the SE of α [42,43].The Climatol program first aims to complete the missing data in each series, using the provisional averages and standard

Quality Controls
Over long periods, it is difficult to find complete climate data series without errors or gaps [27].In the case of Morocco, the problem of homogenizing climate data is a key one for many kinds of climate research [16].This situation requires quality control of the statistical series.For this, it is essential to look for a method or tool that can help us solve these different difficulties [22].
The first step was to fill in the missing data.After filling, data were checked both for outliers and/or change points of non-climate origin, and heterogeneity in the data sets.
Although several climate-data quality-control techniques are available, there is no single approach recommended and generally accepted by all researchers [21,39].The Climatol tool (version 3.1.1)(https://www.climatol.eu/,accessed on 15 June 2022), chosen here, is frequently used in the climate literature for data homogenization, filling in missing data and correcting outliers [16,18,24].

Methodology 2.4.1. Homogenization of Precipitation Series
Our work begins with the gap-filling and homogenization of the collected precipitation series.This step is based on the Climatol procedure cited in the work of Guijarro [24].The method used is based on orthogonal regression, widely known as reduced major axis (RMA).It examines the linear relationship between two continuous variables: a response (Y) and a predictor (X).In orthogonal regression, both the response and the predictor are assumed to a contain measurement error, which is not the case in simple linear regression (least squares regression) [40].Climatol uses RMA for its simplicity, and to allow the use of neighboring series even if they do not have a common observation period with the problem series, which would prevent the fitting of linear regression models [41].
Assuming the linear regression model y = α + βx + ε, where y and x are dependent and independent variables, respectively; α and β are ordinary least squares (OLS) regression coefficients; and ε is a random error term, the RMA slope coefficient is β RMA = β/|r yx |, where r yx is the Pearson correlation coefficient between y and x.The standard error (SE) of β RMA is equal to the SE of β.The RMA intercept coefficient is α RMA = y − β RMA x, and the SE of α RMA is equal to the SE of α [42,43].The Climatol program first aims to complete the missing data in each series, using the provisional averages and standard deviations, and recalculates them again with the completed series.Then, the originally missing data is recalculated using the new parameters, which will lead to new means and standard deviations; the process is iterated until there are no mean changes to within the initial number of decimal places of the data.Once the means are stabilized, all data (existing or filled-in, in all series) are normalized [24].
The algorithm organizes stations into a tree structure, where clusters that show high correlations are grouped in the same branch.Outlier and artificial break detection are addressed through quality control of anomalies, using a predefined threshold and relative inhomogeneity detection using the Standard Normal Homogeneity Test (SNHT) [44].In addition, this program builds a tree of clusters of stations with similar rainfall variabilities and monthly regimes.This operation is repeated before and after the homogenization of the data, which allows us to map groups of stations with similar precipitation patterns.

Monthly Trend Analysis
As we mentioned in the introduction, to analyze trends in monthly data series, the classic Mann-Kendall test [45,46] is used.Statistical trend tests identify and/or estimate the existence or non-existence of a trend in a time series according to the desired degree of significance.Mann-Kendall is a nonparametric test requiring only that the data be serially independent, without assuming the normality of the distribution [47].The Mann-Kendall statistic S is calculated as follows: where n is the length of the data series, xi and xj are the data values in time series i and j (j > i), respectively, and sgn(xj − xi) corresponds to the following sign function: The variance (V) of S is calculated as: In equation number 3, n is the number of data points, m is the number of linked groups, and tk is the number of links of extent k.A related group is a set of data samples with the same value.In cases where the sample size n is greater than 10, the standard normal test statistic ZS is calculated using the following equation: Positive Z values indicate increasing trends, while negative values indicate decreasing trends.The trend test is performed at a specific α significance level.When |Z| > Z 1 − α/2 , the null hypothesis is rejected and a significant trend exists in the time series.Z 1 − α/2 is obtained from the standard normal distribution table [48].In this study, the significance levels chosen are α = 0.01 (or 99% confidence intervals), α = 0.05 (or 95% confidence intervals), and α = 0.1 (or 90% confidence intervals).At the levels of significance 1%, 5% and 10%, the null hypothesis "absence of trend" is rejected if |Z| > 2.57, 1.96 ≤ |Z| < 2.57, and 1.64 ≤ |Z| 1.96 [49], respectively.Kisi and Ay [50] stated that in the case of long-term rainfall trend analysis, the MK test performs better than parametric tests.

Data Homogenization
The study area is marked by some of the greatest rainfall variability in North Africa [51].For this reason, and after reviewing the diagnostic plots of data generated by Climatol, we decided to re-tune the outlier detection threshold.Instead of ±5 standard deviations, the threshold was set to −10 and +14 standard deviations.This was done to avoid suppressing or correcting real data reflecting extreme climate signals and/or microclimate singularities in the context of a high spatial variability of precipitation [40].After this setting, only four outliers were detected at stations S1, S15, S17 and S21, and they were corrected.
Missing data were estimated by Climatol from nearby stations by adapting the method of Paulhus and Kohler [25].In all, about 50% of the data were filled in.
The values of the correlation coefficients of the monthly data, as a function of distance, show a remarkable variation between the raw series and the homogenized series.Indeed, before homogenization, the values are more dispersed compared to those after homogenization (Figure 3).Moreover, the two correlograms of the monthly correlations between the stations show relatively high correlations (>0.6) for the stations located within about 25 km of each other.The correlation coefficient decreases progressively with the distance, reaching a low value of 0.22 in the stations located at a distance of approximately 100 km (Figure 3).This is not surprising, given the strong variations in both the geographical location of each station in the topographic context and the exposure of the slopes to moist air masses.Orographic discontinuity can give opposite precipitation regimes over short distances.
proximately 100 km (Figure 3).This is not surprising, given the strong variations in both the geographical location of each station in the topographic context and the exposure of the slopes to moist air masses.Orographic discontinuity can give opposite precipitation regimes over short distances.
It should be noted that for the raw series, where the correlation coefficients reach negative values in stations located at a distance that does not exceed 50 km, the homogenized series' correlogram looks more physically plausible.

Regionalization of Stations
The station maps in Figure 4 show the cluster analysis of the rainfall series, giving an idea of the different regions of precipitation at the level of the northern Middle Atlas.Climatol limits cluster analysis to a maximum of 100 stations by default.This makes it possible to avoid dealing with overly large correlation matrices, and also to avoid very dense graphs that are difficult to read.However, this can be changed by the user to include all series in the analysis (using the nclust argument in the homogeneous function).It should be noted that for the raw series, where the correlation coefficients reach negative values in stations located at a distance that does not exceed 50 km, the homogenized series' correlogram looks more physically plausible.

Regionalization of Stations
The station maps in Figure 4 show the cluster analysis of the rainfall series, giving an idea of the different regions of precipitation at the level of the northern Middle Atlas.Climatol limits cluster analysis to a maximum of 100 stations by default.This makes it possible to avoid dealing with overly large correlation matrices, and also to avoid very dense graphs that are difficult to read.However, this can be changed by the user to include all series in the analysis (using the nclust argument in the homogeneous function).Additionally, Climatol limits the number of clusters to a maximum of nine [19].Given the limited number of stations (22), these defaults are acceptable.Additionally, Climatol limits the number of clusters to a maximum of nine [19].Given the limited number of stations ( 22), these defaults are acceptable.
The results obtained display four clusters for the raw data, and two clusters for the homogenized data.The grouping of the homogenized data follows the exposure of the slopes, and the altitude to a lesser extent (Figures 1 and 4).The two blocks of stations were separated by the mountain range of Jbel Bouiblane, where the altitude reaches 3000 m.
Moreover, the two clusters produced after the homogenization procedure have different monthly and seasonal rainfall regimes.Indeed, the stations in the northwestern part of Jbel Bouiblane generally record maximum rainfall in the month of February.Meanwhile, the stations to the south and southeast parts record peak precipitation in April.Moreover, it is very remarkable that the amount of precipitation falling on the first cluster is higher than the other (Figures 5 and 6).
The figures of the seasonal precipitation regimes also show a spring regime for the southern and southeastern parts, and a winter regime for the northern and northwestern parts (Figure 6).The results obtained display four clusters for the raw data, and two clusters for the homogenized data.The grouping of the homogenized data follows the exposure of the slopes, and the altitude to a lesser extent (Figures 1 and 4).The two blocks of stations were separated by the mountain range of Jbel Bouiblane, where the altitude reaches 3000 m.
Moreover, the two clusters produced after the homogenization procedure have different monthly and seasonal rainfall regimes.Indeed, the stations in the northwestern part of Jbel Bouiblane generally record maximum rainfall in the month of February.Meanwhile, the stations to the south and southeast parts record peak precipitation in April.Moreover, it is very remarkable that the amount of precipitation falling on the first cluster is higher than the other (Figures 5 and 6).Method performance and data quality are assessed using the root mean square error (RMSE) values.The RMSE is calculated by comparing the estimated and observed data in each series.High values of this parameter indicate poor quality of the series, or that the station is located in a particular site with a distinct microclimate [19].
The results obtained show RMSE values oscillating between 0.5 and 38.7 mm, with an average of 8.5 mm for all the series studied.These values generally remain low, and indicate a certain reliability of the data (Figure 7).On the other hand, the geographical location of station S21, which recorded the maximum value of RMSE, is in a depression The figures of the seasonal precipitation regimes also show a spring regime for the southern and southeastern parts, and a winter regime for the northern and northwestern parts (Figure 6).Method performance and data quality are assessed using the root mean square error (RMSE) values.The RMSE is calculated by comparing the estimated and observed data in each series.High values of this parameter indicate poor quality of the series, or that the station is located in a particular site with a distinct microclimate [19].
The results obtained show RMSE values oscillating between 0.5 and 38.7 mm, with an average of 8.5 mm for all the series studied.These values generally remain low, and indicate a certain reliability of the data (Figure 7).On the other hand, the geographical location of station S21, which recorded the maximum value of RMSE, is in a depression between the mountains, which gives it a somewhat special microclimate compared to neighboring stations.Furthermore, the values of the SNHT oscillate between 2.5 and 26.6, with an average of 6.28 (Figure 7).Method performance and data quality are assessed using the root mean square error (RMSE) values.The RMSE is calculated by comparing the estimated and observed data in each series.High values of this parameter indicate poor quality of the series, or that the station is located in a particular site with a distinct microclimate [19].
The results obtained show RMSE values oscillating between 0.5 and mm, with an average of 8.5 mm for all the series studied.These values generally remain low, and indicate a certain reliability of the data (Figure 7).On the other hand, the geographical location of station S21, which recorded the maximum value of RMSE, is in a depression between the mountains, which gives it a somewhat special microclimate compared to neighboring stations.Furthermore, the values of the SNHT oscillate between 2.5 and 26.6, with an average of 6.28 (Figure 7).

Monthly Precipitation Trend
The application of the Mann-Kendall test on the monthly rainfall series of 22 stations over a period of 49 years shows generalized downward trends for the months of January, February, March, April, May, June and December (Table 2 and Figure 8).During these months, the percentage of series with a negative trend (not necessarily statistically significant) varies between 68% for the month of January and 100% for the month of April.These trends toward a decrease in rainfall remain insignificant, except for the stations of S5 (Belfarah), S6 (Bni Bouilloul), S7 (Berkine), S8 (Guercif), S10 (Mrija) and S22 (Rechida) (Table 2 and Figure 8), which are significantly different from zero at the 90% confidence level.It should be noted that all of these last rainfall stations are located in the southern and eastern part of the study area, sheltered from the mountain range of Jbel Bouiblane (Figure 1).In this part, April is the wettest month of the year.
The month of July is seen as a transformation point towards positive trends.For July, 71% of the series have an increasing trend, although only five series have statistically significant trends (Table 2).For the months of August, September, October and November, generalized positive trends were observed.The percentage of series with a positive and significant trend varies between 55 and 77% (Table 2).These results show a probable transformation of a winter and spring rainfall regime towards a more autumn regime throughout the northern Middle Atlas.

Discussion
The test of the impact of homogenization on the quality of the data used in this study was carried out through the comparison between the results from the raw data and those from the homogenized series.The correlograms of the correlation coefficients show a remarkable change towards more physically plausible correlation patterns related to the correction and the reconstruction of the data.On average, the difference between the originally-recorded and homogenized precipitation is 8.5 mm.This result is consistent with the results of the work of Kessabi et al. [16] carried out in the Fez-Meknes region (very close to our study area), where the average found is 6 mm.The work of Abahous et al. [40], carried out on the Sous Massa basin, displays an RMSE between 11.7 and 23.4.This shows that our data was not strongly affected by homogenization.
The importance of homogenization is observed more in the shortest series, which contain many gaps, particularly in the mountainous part where the density of the network of stations is sparse.On the other hand, this operation has less importance in the correction of the data in our field (given the microclimatic particularities of each group of stations), which required accepting sometimes-large differences in precipitation over small distances.The same result was reported by Abahous et al. [18] and by Kessabi et al. [16].
The power and robustness of the Climatol tool also appear in the regionalization of statistical series using clusters, which groups together stations with similar rainfall variability and precipitation patterns.This technique allowed us to find two different climatic zones.The first one has a winter regime, is located in the west of the mountain range of Jbel Bouiblane, and is exposed to disturbances from the north and west.The second, considered arid to semi-arid, has a spring regime and is located east of Jbel Bouiblane.Our results on regionalization are consistent with those of Kessabi et al. [16], and close to those of Singla et al. [52] who carried out a regionalization of rainfall throughout the country.Despite the low number of stations used in his work compared to the study area size, Hanchane [53] presented similar results on the regionalization of precipitation in Atlantic Morocco, particularly with regard to the western part of Jbel Bouiblane.
The analysis of the monthly rainfall trends of the homogenized data was carried out using the Mann-Kendall test at the alpha thresholds 0.01, 0.05 and 0.1%.The main results show a widespread significant increase in precipitation from August to November.In their work carried out on the Melloulou wadi basin, Addou et al. [54] showed an increase of annual rainfall between 2000 and 2014, directly linked to a significant trend in autumnal rainfall.In addition, the results of a study carried out on the northwestern part of Algeria by Nouacer [55] addressed positive annual rainfall trends.This author explained this increase as the result of the increase in the number days of extreme rainfall events (which generally occur in summer and Also, Sebbar et al. [56] found similar results in southern Morocco.At the level of the northeastern part of Tunisia, Laignel et al. [57] reported that there had been a return of precipitation since the beginning of the 2000s.These last authors did not determine the month or months of the year that accounted for this increase.
With their stormy character, the autumn precipitations at the level of the study area are very localized in time and space.The violent floods generated cause huge losses of agricultural land, and settle on the low fluvial terraces of the main rivers.Moreover, and in the context of the scarcity of surface water storage units, the autumn rains are unfortunately not effective for agricultural activities, especially for rainfed agriculture that relies on winter and early spring precipitation.

Conclusions
Our work aimed to study the rainfall trends in the northern Middle Atlas.This is an important area for precipitation climatology and trend analysis; given its potential in terms of surface and underground water resources, this territory is considered a water tower in the country.The first problem we faced was the temporal heterogeneity of the data and the large number of gaps in the series collected.The research problem therefore became the gap-filling, homogenization and trend analysis of the monthly data at the level of the study area.Indeed, a data quality control and homogenization process, to improve the reliability of monthly rainfall records, was applied initially.Secondly, we analyzed trends in monthly series over the period from 1970 to 2019.
The results obtained show an increase in the quality of the final data, and a good robustness of the chosen Climatol tool for filling gaps and for the regionalization of the data.This step was validated by our knowledge of the climatic characteristics of the terrain.The correlations between stations' monthly precipitation, using the adjusted data, are relatively high (>0.6)for stations located approximately 25 km apart.The correlation coefficient decreases progressively with the distance, reaching a low value of 0.22 in the stations located at a distance of about 100 km.This is not surprising, given the strong variations in both the geographical location of each station in the topographic context and the exposure of the slopes to moist air masses.Orographic discontinuity can give opposite precipitation regimes.
The RMSE values oscillate between 0.5 and 38.7 mm, with an average of 8.5 mm for all the series studied; the values of the (SNHT) oscillate between 2.5 and 26.6, with an average of 6.28.These low values indicate the reliability and good quality of the data.
Rainfall trends generally show drier conditions for the months of January, February, March, April, May, June and December.These trends are significantly stronger in the southern and eastern parts of the study area, and only during the month of April, the wettest month.It appears that the month of July is seen as a transformation point towards positive trends.Indeed, 71% of the series have a tendency towards the increase of precipitation, although only five (or 1/3) of them have statistically significant increases.From August to November, generalized positive trends were observed.The percentage of series with a positive and significant trend varies between 55 and 77%.These results show a probable transformation of a winter and spring rainfall regime towards an autumn regime throughout the northern Middle Atlas.This change can disrupt an entire agricultural system that depends on water inputs from the Middle Atlas for irrigation.

Figure 1 .
Figure 1.Geographical location of the northern Middle Atlas.Figure 1. Geographical location of the northern Middle Atlas.

Figure 1 .
Figure 1.Geographical location of the northern Middle Atlas.Figure 1. Geographical location of the northern Middle Atlas.

17 Figure 2 .
Figure 2. Data availability per year.The green and red lines mark the desired and critical number of the data availability threshold, respectively.

Figure 2 .
Figure 2. Data availability per year.The green and red lines mark the desired and critical number of the data availability threshold, respectively.

Figure 3 .
Figure 3. Correlograms of the first differences of the series stations' raw data (on the left) and adjusted data (to the right).

Figure 3 .
Figure 3. Correlograms of the first differences of the series stations' raw data (on the left) and adjusted data (to the right).

Figure 4 .
Figure 4. Clusters of stations (A) before and (B) after homogenization.

Figure 4 .
Figure 4. Clusters of stations (A) before and (B) after homogenization.

Figure 4 .
Figure 4. Clusters of stations (A) before and (B) after homogenization.

Figure 8 .
Figure 8. Spatialization of monthly precipitation trends of all data series.Figure 8. Spatialization of monthly precipitation trends of all data series.

Figure 8 .
Figure 8. Spatialization of monthly precipitation trends of all data series.Figure 8. Spatialization of monthly precipitation trends of all data series.

Table 1 .
Geographical location of stations; code of the coordinate system used is EPSG:26191.

Table 2 .
Monthly precipitation trends of all data series.Trends at the 0.1 significance level if 1.64 ≤ Z < 1.96, ** Trends at the 0.05 significance level if 1.96 ≤ Z < 2.57, * *** Trends at the 0.01 significance level if 2.57 < Z.