1 Introduction

Water is a fundamental human need and according to the statistics groundwater is the main source of drinking water for more than 1.5 billion people in the world[1]. With a better understanding of the importance of drinking water quality to human health, there is a great need to assess groundwater quality [2]. Moreover, it is a need for studies on how groundwater will be managed. For efficiency, the management and assessment of groundwater resources need an understanding of hydrogeochemical and hydrogeological features of the aquifer [3, 4]. Furthermore, groundwater quality depends on several components such as topographic relief, rainfall, mineral dissolution, ion exchange, oxidation, reduction, human and natural activities, use of fertilizers and pesticides [5,6,7,8].

In arid and semi-arid areas, principally in coastal areas, an increase in the salinity is being confirmed in most of the major aquifers being used for water supply in coastal regions, which led to the deterioration in water quality [9,10,11,12,13,14]. This deterioration is due to the inflow of saline water because of over-exploitation of groundwater, and/or mobilization of saline formation waters (combining with ancient seawater trapped in the sediments). However, the assessment of groundwater quality in these areas is essential for better management and protection of this resource.

In recent decades, several tools have been used to quantify status and water chemistry. Among these tools, the water quality index [15, 16] is one of the most effective tools for assessing and obtaining a comprehensive picture of groundwater quality. It is a mathematical technique used to transform high quantities of water characterization data into one simple indicator that expresses overall water quality, to differentiate between very clean water and polluted water at some location and time [17,18,19,20,21].

Essaouira Basin, the subject of this study, is one of the semi-arid basins of Morocco. In this coastal basin, groundwater is the main water resource. During the last decades, this basin has experienced a succession of drought episodes under the climate change effect leading to a qualitative and quantitative degradation of this resource [22].

However, the main objective of this study is to evaluate and map the groundwater quality status of krimat aquifer situated in Northwestern Morocco by using Water Quality Index and Geographic Information System.

2 Study area

The Ouazi Basin is located in the east and north of the Essaouira city between the coordinates 100,000 and 140,000 (m) for the X and between 80,000 and 140,000 (m), 31°23′53.12″N and 9°25′45.78″W (geographic system projection), with an area of 1000 km2 (Fig. 1). It is limited in the north by Hadid anticline, by Meskala region in the south, by Mramer wadi in the east, and Atlantic Ocean in the west. This basin is controlled by a semi-arid climate, with an average annual rainfall of 300 mm and temperatures of 20 °C [23]. In geomorphological terms, the Essaouira synclinal zone is less rugged, with a lower relief characterized by low hills and shaped by a sparse water system. Concerning the hydrogeological aspect, the Ouazzi Wadi sub-basin is a sedimentary basin, mainly composed of two main aquifers (Fig. 1). The first is the Plio-Quaternary phreatic aquifer with marine or dune sandstone–limestone matrix, and a primary hydraulic conductivity due to porosity. The wall of this aquifer is formed by the Senonian grey marls; the subcrop anti-Pliocene shows that the Plio-Quaternary can be in direct contact with the Triassic and Cretaceous other levels [24]. The second is the Cenomanian–Turonian carbonate aquifer; it is mainly formed by limestones and dolomitic-limestone layers (Fig. 1). The base of the Cenomanian–Turonian system corresponds to lower Cenomanian grey clays and the top to the Senonian white marls [25]. This reservoir is the main food resource of drinking water of Essaouira city as well as the surrounding villages. It is also a source of modest agricultural use (food-type) [26]. In addition, the chemical composition of groundwater is controlled by many factors that include composition of precipitation, geological structure, and mineralogy of the watershed sand aquifers and geochemical processes within the aquifer [27,28,29,30]. The piezometric study shows that the natural discharge zone of the studied aquifer is the Atlantic Ocean and that the groundwater flows mainly from south-east to north-west upstream and from east to west downstream (Fig. 1). This direction of flow is conditioned by the geometry of the aquifer and the tectonic.

Fig. 1
figure 1

Geographic situation, location of groundwater sampled points in Wadi Ouazi basin, geological and cross section of the study area

3 Materials and methods

3.1 Chemical analysis

Groundwater samples were collected in March 2018, from 38 wells capturing the krimat aquifer and representing a homogeneous spatial distribution on the whole aquifer (Fig. 1).

A portable GPS was used to locate the sampling wells and polyethylene bottles were carefully rinsed two to three times by the water collected before filling. The physicochemical parameters (pH, temperature, electrical conductivity) were measured in situ immediately after sample collection, using the Multi-parameter HI 9828. The depth of the water level was measured using a piezometric probe with 200 m of length.

Chloride ions are determined by Mohr's method. Concentrations of HCO3 were determined by titration, using 0.1 N HCl. Sodium (Na) and potassium (k) ions are determined by flame atomic absorption spectrometry. The sulphates are determined by spectrophotometry method using a Hach Lange DR 3800 spectrophotometer. Concentrations of calcium by following the complexometry (EDTA) and magnesium (Mg) were obtained from total hardness. These chemical analyses were carried out at the Laboratory of Geosciences and Environment (LGE) of Ecole Normale Superieure, of Marrakech, Morocco. The accuracy of the chemical analysis was verified by calculating ion balance errors in Eq. (1), which is based on the principle that the sum of major anions and the sum of the major cations are equivalent (concentrations expressed as (meq/L)) and the error in % is given by (1)

$${\text{IB}} = \left( {\frac{{\sum\nolimits_{{{\text{cations}}}} {} - \sum\nolimits_{{{\text{anions}}}} {} }}{{\sum\nolimits_{{{\text{cations}}}} {} + \sum\nolimits_{{{\text{anions}}}} {} }}} \right) \times 100$$
(1)

A chemical analysis of the waters is not considered representative and acceptable only when the ionic balance is equal to or less than 10% [31].

3.2 GIS analysis

There are two main interpolation techniques: deterministic and geostatistics. Deterministic interpolation techniques create a surface from measured points, based on their extent of similarity [e.g. inverse distance weighted (IDW)] or the degree of smoothing (e.g. radial basis functions). Geostatistical interpolation techniques utilize the statistical properties of the measured points [32].

For this study, a weighted inverse distance interpolation (IDW) method was used to produce thematic spatial distributions for each parameter: EC, TDS, pH, NO3, Ca, Mg, K, Na, Cl, HCO3 and SO4, and water quality index (WQI) of the study area of krimat aquifer. Interpolation technique is the procedure of predicting unknown values using the known values in the vicinity. This technique uses a defined or selected area of sample points to estimate the value of the output grid cell.

3.3 Water quality index

The WQI is a very simple technique for evaluating the overall water quality of any region and communicating this information with the decision-makers; analysis of the water samples for various parameters is done as per WHO standards [33]. From the estimation of a water quality index is determined the degree of pollution of groundwater by using Geographical Information System Software (GIS) issues by integrating complex data and generating a score, which ultimately describes the water quality status [34,35,36]. The methodology used is summarized in the flowchart established in Fig. 2. The results of the physicochemical analyses are summarized in (Table 1).

Fig. 2
figure 2

Flow-chart of the methodology adopted

Table 1 Physicochemical parameters of groundwater samples of study areas

4 Results and discussion

4.1 Groundwater hydrochemical facies

Hydrochemical facies is a useful tool for determining groundwater chemistry. It is used to represent the similarity and dissimilarity in the chemistry of groundwater samples based on the anions and dominant cations of all samples [37, 38]. In addition, these trilinear diagrams used for tracing hydrochemical data were independently developed by [39, 40].

The projection of the analysed samples on the Piper diagram (Fig. 3) shows that the majority of the samples are Ca–Mg–Cl, while two points have a Ca–SO4 facies.

Fig. 3
figure 3

Piper trilinear diagram

In order to highlight the different mechanisms that contribute to groundwater mineralization, the relationships between major elements were investigated in several bivariate diagrams plotted (Fig. 4). These diagrams that were plotted take into account the most abundant minerals (calcite, dolomite) and evaporates (halite, gypsum) generally existing in sedimentary deposits.

Fig. 4
figure 4

Correlation diagram: a Na versus Cl; b Ca versus Mg; c Ca versus SO4; d Ca versus HCO3

The binary diagram for Na and Cl (Fig. 4a) shows a positive correlation between these two ions, with R2 = 0.83 for the Ouazzi basin. This positive correlation indicates the same source of the two ions. Some samples are close to the halite dissolution line. Other samples are placed below the line, indicating a deficit of Na v Cl; this Na deficit is balanced by an excess of Ca2+ and Mg2+, indicating a cation-exchange process [14].

The correlation diagram for Ca and Mg (Fig. 4b) shows a positive correlation between the two cations reflecting the same source with R2 = 0.60. A few samples are plotted around the dissolution line of dolomite, indicating a limited contribution of this mineral to groundwater mineralization [9].

The correlation between Ca and SO4 (Fig. 4c) shows a high positive correlation between these two ions in the samples with R2 = 0.89. This positive correlation indicates that these two ions have the same source. In addition, Fig. 4c shows that only few samples are close to the dissolution line of gypsum, indicating that the dissolution of gypsum and anhydrite is limited [25].

The relationship between Ca and HCO3 (Fig. 4d) is low with R2 = 0.013. This weak correlation supports the absence of a relationship between these two ions. From Fig. 4d, it can be seen that the Ca2 concentration increases, while the HCO3 concentration remains relatively constant [9].

4.2 Multivariate statistical analysis

To understand different water types in the study area, statistical approach of the obtained results must be of high importance. However, hierarchical clustering analysis method (HCA) and principal component analysis (PCA are used to distinguish between water groups that have similarities in hydrochemical composition [41]. Indeed, HCA and PCA were carried out on 38 individuals (water samples) and 9 variables (TDS and 8 major elements) using Ward method with Euclidean distance.

Dendrogram of variables allowed separating two groups (Fig. 5). Group 1 is formed by SO4, Cl, and HCO3, while group 2 is formed by Ca, Mg, NO3, Na, and K. The correlation between these variables is presented in Table 2.

Fig. 5
figure 5

Dendrogram of variables

Table 2 Correlation matrix of the major ions and the TDS for the study area

As shown in Table 2, TDS, Na, and Cl have a strong correlation with a correlation coefficient of 0.77 and 0.85, respectively. This suggests that the dissolution of evaporitic minerals and the paleo-seawater intrusion contribute to the groundwater mineralization in the study area [2, 42]. The strong positive correlation between Ca and Mg indicates that they are probably due to carbonate and dolomite dissolution, base exchange, and paleo-seawater intrusion [2, 42]. The low correlation between HCO3 and Ca (0.03) and between HCO3 and Mg (0.35) confirms the contribution of carbonate mineral dissolution and paleo-seawater intrusion in the groundwater mineralization in the study area. A strong positive correlation between SO4 and Ca was observed. This correlation is probably due to the evaporitic mineral dissolution. The weak correlation between SO4 and NO3 with a correlation coefficient of − 0.08 confirms this hypothesis.

Variable projection on the F1–F2 plane, which explains 71.12% of the total variance, indicates that all the variables, except NO3 and HCO3, are positively correlated with the F1 axis (Fig. 3). As a result, this axis represents the cluster responsible for the mineralization of water in the study area. However, the more the F1 axis components are positive, the more the wells have a high concentration of major ions (Fig. 6). NO3 and HCO3 are positively correlated with the F2 axis; therefore, the positive components on this axis are enriched by the nitrates and the bicarbonate. This reflects the presence of another phenomenon responsible for these ions [14].

Fig. 6
figure 6

Principal component analyses; variables projection on F1 and F2 plane

4.3 Physicochemical parameters

Groundwater temperatures (Table 1) varied from 16.2 to 23.4 °C, with an average and standard deviation values of 20.7 °C, and 1.9 °C, respectively.

The pH values vary from 7.15 to 8.83 (Table. 1) indicating that groundwater is slightly alkaline. All samples had a pH values within the acceptable limit “6.5–8.5” except two samples with values above the permissible limit fixed by WHO [33]. Usually, pH has no direct impact on consumers. It is one of the most important operational water quality parameters with the optimum pH required often being in the range of 7.0–8.5 by WHO [33]. The spatial distributions of pH concentrations (Fig. 7) shown that the majority of the samples have a neutral pH with value below the desirable limit.

Fig. 7
figure 7

Spatial distribution of electrical conductivity, TDS, and pH in the study area

As for conductivity, it informs on the quantity of ionic matter dissolved in water and depends on the nature of the soil. According to WHO [33], the desirable limit of EC for drinking water is fixed at 1500 µs/cm. For the analysed samples, the EC varies between 578 and 5041 µs/cm with an average of 2356 µs/cm. The spatial distribution of EC (Fig. 7) shows that more than 90% of water samples are not permissible for drinking.

As for TDS, the low values (390–874 mg/l) were observed in samples S1, S3-9, S15, S18, and S23 (Fig. 7), while the rest of the samples show high values (958 to 2520 mg/l), from east to west direction of groundwater flow. According to WHO standards, 70% of samples exceed the permitted limits. However, the majority of the wells tested are unsuitable for direct consumption without prior treatment.

Chlorides are inorganic anions contained in varying concentrations in natural waters. In the study area, the chloride (Cl) concentrations range from 99.4 to 1178.6 mg/l with an average of 427.5 mg/l (Table. 1, Fig. 8). The standard values prescribed by the WHO for chloride concentration are 250 mg/l. It was found that chloride concentration of all samples of exceeds the maximum allowable limit. These high levels of Cl are mainly due to the dissolution of halite [10]. The sodium concentration in the study varies between 10.4 and 303.3 mg/l with an average value of 134.2 mg/l (Table. 1, Fig. 8).

Fig. 8
figure 8figure 8

Spatial distribution of potassium, magnesium, calcium, chloride, sodium, nitrate, and sulphate in the study area

Calcium and magnesium in water are used to assess the appropriateness of water use. In addition, Ca and Mg are directly related to the hardness of the water. This increases with the increase in magnesium and calcium levels. For the study area, calcium concentrations range from 65.7 to 583.6 mg/l, with an average value of 185.7 mg/l (Table. 1, Fig. 8). As for the magnesium, it varies between 36.9 and 329.5 mg/l with an average value of 123 mg/l (Table. 1, Fig. 8).

Sulphates are found in natural waters as SO4 ions with very different concentrations. According to the WHO [33], the concentration of sulphate (SO4) in water can probably react with human organs if it exceeds the maximum allowed limit of 400 mg/l and causes a laxative effect on the human system with the excess of magnesium. For the analysed samples, the sulphate contents vary between 11.3 and 2221.2 mg/l and the average concentration of the sulphate index is 332 mg/l. However, the waters of the study area are below the recommended limit. The spatial distribution of the groundwater sulphate concentration in the study area (Fig. 8) shows that only S17, S19, S24, S35, and S38 show concentrations above 600 mg/l, reflecting poor quality (not permissible).

The concentration of bicarbonates (HCO3) in natural waters depends on carbon dioxide, pH, cations, temperature, and more dissolved salts. For the study zone, the bicarbonate concentrations vary between 256.3 and 689.5 mg/l with an average of 396 mg/l. All samples exceeding the permissible limits of bicarbonate (200 mg/l) thus reflect a poor quality of the groundwater with respect to this ion.

Potassium is generally the least abundant element in water after Na, Ca, and Mg. It contributes very little to the mineralization of natural water. In the study area, the potassium concentration ranges from 0.3 to 36.5 mg/l (Fig. 8) with an average value of 5.6 mg/l. All samples had a potassium value within acceptable limits with the exception of three samples S6, S10, and S38 with values above the allowable limit (12 mg/l).

As for nitrate contents, they range from 3.5 to 166 mg/l with a mean value equal to 35.4 mg/l (Table. 1). Some samples exceed the permissible limit of 45 mg/l (WHO). High concentrations of NO3 would come from domestic pollutants. Only the catchment points are polluted and this pollution originates from the traditional methods of drawing. These result in a significant amount of water flowing around the catchment wells, constituting quasi-permanent pools that are enriched in NO3 by livestock waste during watering [43].

5 WQI

5.1 Estimation of water quality index (WQI)

The WQI has been calculated to evaluate the suitability of groundwater quality for drinking purposes of the krimat aquifer. The selection of the parameters that will make up the index depends on several factors, such as the purpose of the index, the importance of the parameter, and the availability of data. Physicochemical parameters TDS, pH, EC, Cl, SO4, HCO3, NO3, Ca, Mg, Na, and K were determined.

Four steps are followed to estimate WQI. In the first step, we have chosen onz parameters and each of the parameter has been assigned a weight (wi) conforming to the relative importance in the overall water quality (Table. 3).

Table 3 Weight and relative weight of each parameter used for the WQI calculation

The top weight 5 was assigned to nitrate (NO3) and total dissolved solids (TDS), considering that these often influence groundwater quality the most, weight 4 has been assigned to pH, electrical conductivity (EC), and sulphate (SO4), weight 3 has been assigned to chloride (Cl) and bicarbonate (HCO3), and weight 2 has been assigned to parameters potassium (K), calcium (Ca), and sodium (Na) depending on their signification in the overall quality of water for drinking purposes. The minimum weight 1 has been assigned to parameter magnesium (Mg) which rarely plays an insignificant role in groundwater quality.

In the second step, the relative weight (Wi) is computed by Eq. (2) using a weighted arithmetic index method given below [15, 16] and the following steps [44,45,46,47].

$$w_{i} = {{w_{i} } \mathord{\left/ {\vphantom {{w_{i} } {\sum\limits_{i = 1}^{n} {w_{i} } }}} \right. \kern-\nulldelimiterspace} {\sum\limits_{i = 1}^{n} {w_{i} } }}$$
(2)

where Wi is the relative weight, wi is the weight of each parameter physiochemical, and n is the number of parameters.

In the 3 step, the quality rating scale (qi) for any parameter was determined using Eq. (3).

$$q_{i} = (c_{i} /s_{i} ) \times 100$$
(3)

where qi is the quality rating, Ci is the concentration of each chemical parameter in each water sample, and Si is the drinking water standard for each chemical parameter according to the guidelines of the WHO [33].

In the final step, the Sii is first determined for each chemical parameter Eq. (4), which was then used to calculate the WQI as per the following Eq. (5):

$$s_{{{\text{ii}}}} = w_{{\text{i}}} \times q_{{\text{i}}}$$
(4)
$${\text{WQI}} = \sum {Sl_{i} }$$
(5)

where Sii is the subindex of all variables; the value is between 0 and 100 and qi is the rating based on concentration of the parameter Tables 1 and 3.

WQI range and category of water can be classified in Table 4; in this study, the calculated WQI values have a range from 82.3 to 390.9 and this can be categorized into 4 water types, good water to unsuitable water for drinking (Table 4). This indicates that no sample location comes under ''excellent category''.

Table 4 Water Quality Classification based on WQI

The calculation of WQI for groundwater samples is shown in (Table 5). A total of 38 samples were analysed for WQI. The results show that 6% of the groundwater samples come under 'Good category', 61% of the samples belong to 'poor category', 18% come under 'Very Poor category', and 16% have been registered under the 'Unfit category'. The WQI shows that 5% of groundwater samples were found as good water.

Table 5 Water quality index (WQI) classification for individual samples

The spatial distribution of WQI (Fig. 9) shows that groundwater with very poor quality is observed in the central and downstream part of the study area, while water with poor quality is recorded in the north and east. This deterioration of the quality of the subterranean waters could be explained by the dissolution of the evaporation formations rich in salts (halite, gypsum, and anhydrite), the contamination by livestock waste, the remoteness of the recharge zone of the aquifer studied, and by the residence time. From this classification, it can be concluded that the use of groundwater in the studied aquifer requires treatment before consumption.

Fig. 9
figure 9

Spatial distribution of groundwater quality index in the study area

6 Conclusions

In arid and semi-arid zones, groundwater is an essential element for socio-economic development. In recent decades, this resource has experienced significant qualitative and quantitative degradation. For this reason, the krimat aquifer of the Essaouira basin was used as an example.

To evaluate the state of this resource, we used the hydrogeochemical approach based on the WQI index and a geographical information system.

The study of chemical facies shows that the groundwater of the study area is of type Ca–Mg–Cl and Ca–SO4 with the dominance of the first type. Evaluation of physical parameters (pH and electrical conductivity (EC)) shows those groundwater is neutral with generally high mineralization. Indeed, 90% of the analysed samples have EC values higher than 1500 μs/cm reflecting a poor quality (no admissible). The spatial distribution of the chemical elements shows that the highest concentrations are observed in the central and downstream part of the study area, following the dissolution of the evaporite formations rich in salts and the remoteness of the recharge zone.

The results of the calculation of WQI show that 6% of the samples are classified as "Good", 61% in the "poor" category, 18% in the "Very poor" category, and 16% in the "unsuitable for drinking" class.

The spatial distribution of groundwater quality shows that groundwater with very poor quality is observed in the central and downstream part of the study area, while poor quality water is recorded in the north and east. This could be explained by the dissolution of the evaporation formations rich in salts (halite, gypsum, and anhydrite), the contamination by livestock waste, the remoteness of the recharge zone of the aquifer studied, and time of residence. This classification makes it possible to conclude that the use of groundwater in the studied aquifer requires pre-treatment for consumption.

However, the results obtained could be a basis for regional decision-makers for better management, planning, and protection of this resource.