1 Introduction

Groundwater is an indispensable part of human living space and the hydrological cycle, providing high-quality freshwater resources for human beings. It is important for global domestic, industrial, and agricultural use [1]. Furthermore, water is the foundation of life, a necessary input for social and economic development, and a key element of environmental sustainability [24]. One of the greatest pressures on freshwater resources in agriculture is food production. Agriculture is responsible for nearly 80% of global freshwater withdrawals when all factors are included (up to 90% in some rapidly growing economies) [2].

Today, the quantity and quality of groundwater have become critical issues for many places [5, 6]. Indeed, rapid population growth and socio-economic development have increased water resource demand. These actions would have had several long-term impacts on groundwater resources, including a general drop in water levels, an increased likelihood of saltwater intrusion, and degradation of water quality [2]. Groundwater pollution in arid and semi-arid areas can have a wide range of environmental, social, and economic effects and cause health and livestock problems [5].

Apart from its consumptive and domestic functions, groundwater is a major natural gift that contributes to the expansion of any country's agriculture, industrialization, and socio-economic development [24]. The chemical characteristics present and their concentration, mainly obtained by geological and other anthropogenic processes in a given region, determine groundwater quality [24]. The rapid population development, industrialization, agricultural pesticides, and disposal of urban and industrial waste have all played key roles in groundwater contamination, putting immense pressure on water resources [24].

In the Essaouira basin, several studies have already been carried out. Based on the application of geochemical and isotopic techniques, these investigations have discovered and defined some of the main factors responsible for water quality degradation in this region's particular coastal areas [7, 8]. These investigations have shown that runoff and precipitation contribute to groundwater recharge in the Essaouira basin, (ii) that water–rock interaction plays an important role in groundwater mineralization, and (iii) that anthropogenic pollution has been detected [7, 8]. The novel coronavirus (COVID-19) began to spread worldwide towards the end of 2019 [9, 10]. With infections across 210 countries and a rising number of deaths, the World Health Organization (WHO) declared the COVID-19 outbreak a global pandemic and health emergency [9, 10]. As of April 3, 2022, 493,673,607 confirmed cases of COVID-19 worldwide have been reported to WHO, including 6,169,931 deaths (WHO COVID-19 Dashboard). Due to the direct and indirect effects of the COVID-19 pandemic, there has been a noticeable environmental recovery. According to satellite data, significant NO2 (nitrogen dioxide) reductions have been observed in major cities in China, Europe, the United States, and India [9, 10]. Many researchers [911] reported on the influence of COVID-19 on water resources, and Krishan and Khan [10, 11] reported on its impact during and after COVID-19. In recent years, groundwater quality assessment and spatial analysis based on combining Geographic Information Systems (GIS) with WQI methods have proven to be a powerful tool for spatial information management of groundwater resources [1214]. The WQI is an efficient tool to access water quality and its suitability for drinking. It was first developed by Horton and Brown [13, 14] and has been widely used in numerous water quality assessment studies.

The main objective of this study was to examine the favorable influence of closure on environmental indicators such as water quality in the Essaouira region (Morocco). This was a unique opportunity to assess the impact of reduced human activity on groundwater quality. This period was separated into a pre-closure phase (March 2019) and a post-closure phase (July 2020). According to several research studies [911], containment has become a viable remedial technique to improve the quality of various environmental resources.

The objective of this study is to:

  1. 1.

    Assess the suitability of the groundwater for human consumption and irrigation purposes by using two methods WQI and IWQI.

  2. 2.

    Map the spatial distribution of the groundwater quality (WQI and IWQI) between two years 2019 and 2020.

  3. 3.

    Determine recharge sources and groundwater dynamics using stable isotopes (δ18O and δ2H) before and during confinement due to the COVID-19 pandemic in the Essaouira region.

The conclusions of this study are important for the long-term exploitation and management of groundwater in the Essaouira basin.

2 Study area

2.1 Location and climate

The geographical situation of the city of Essaouira is located 100 km south of the city of Safi and 130 km north of the city of Agadir in the extreme western part of the High Atlas. It extends into a coastal area largely open to the Atlantic Ocean, with a rectilinear shape with a general NNE-SSW direction (Fig. 1). The Meskala-Ouazzi sub-basin has an average elevation of 382 m, with the lowest and the highest elevations of 4 m and 714 m, respectively. Two rivers cross the Meskala-Ouazzi sub-basin: Wadi Ouazzi and Wadi Igrounzar, whose natural outlet is the Atlantic Ocean [1517].

Fig. 1
figure 1

Map of the study area, showing sampling locations and geological

The study area was selected to assess the groundwater quality of the Meskala-Ouazzi sub-basin, which is located in the Essaouira basin in the southwestern region of Morocco (Fig. 1). It is bounded to the north by the Jbel Hadid anticline, to the south by the Oued Igrounzar, to the east by the Bouabout region, and to the west by the Atlantic Ocean; the present study area covers an area of 1184 km2 (Fig. 1). The Essaouira basin has a semi-arid climate with an annual rainfall of about 300 mm and temperatures between 20 and 30 degrees Celsius [1517]. Four hundred thousand people live in this predominantly rural region. The area of the Essaouira basin is 6000 km2 and is characterized by scarce and irregular water resources [15,16,17].

2.2 Geological and hydrogeological settings

On the geological plan, the upstream part of the study area (east) is dominated by the middle and upper Cretaceous outcrops, particularly Albian-Vraconian, Cenomanian, and Turonian deposits, which dominate the study area geologically [18]. These formations consist of banks of limestone and dolomitic intercalated with marls and sandstones. The Albian and Vraconian are represented by green marls (with a thickness of 150 m) and dolomitic limestones (with a thickness of 140 m). In modest quantities, an alternating series of gray marls with laminated anhydrite, lumachellic limestones (0–15 m), dolomitic limestones, and sandstones characterize the Cenomanian. It has an average thickness of 200 m [19]. The Turonian consists of limestones, where silica is very abundant [20]. The outcrop of the Plio-Quaternary formations characterizes the downstream part of the study area (west) [1820]. These are represented by conglomerates, alluviums, colluviums, and sandstones (Fig. 1).

The study area has two main aquifer systems: (1) a multi-layer aquifer made primarily of detrital deposits (sandstones, conglomerates, and sands) from the Plio-Quaternary aquifer, which supplies the majority of the water to the population; and This has direct contact with the Triassic and Cretaceous strata underneath; and (2) Cenomanian–Turonian calcodolomitic layers, which Rachid et al.[18] claim indicate a karstic aquifer. Between 400 and 700 m above sea level (a.s.l.) on the Jbel Kchoula, the Turonian horizon disappears, while the Plio-Quaternary layers disappear between the sea level and 400 m a.s.l [1820].

The transmissivity levels are approximately 4.5 × 10–5 to 6 × 10–2 m/s, while the hydraulic permeability is 3.2 × 10–2 m/s in the study area [19, 20].

3 Materials and method

3.1 Sample collection and analysis

In the study area, 58 groundwater samples were collected before COVID (March 2019) and 61 samples during the COVID period (July 2020) according to standard procedures of the American Public Health Association [21]. The positions of the sampling sites were recorded using a portable GPS. To ensure the reliability of the groundwater sampled, the wells were pumped for at least 5 min until the chemical conditions of the groundwater were stable. Before sampling, all samples were collected in disposable polyethylene bottles that had been washed and rinsed 3–5 times. A 200 m piezometric probe was used to assess the water depth in the wells. To overcome the environmental impact, all physical parameters, such as temperature, pH, and electrical conductivity (EC), were immediately measured in the field with portable multiparameter equipment (Hanna HI9829). Great care was taken when transporting the groundwater samples to the laboratory to preserve their chemical characteristics.

The physico-chemical parameter analyses of the water samples taken during the 2019 campaign were carried out at the Ecole Normale Supérieure (ENS) Laboratory of Geosciences and the Environment in Marrakech city (Morocco country). The nephelometric approach was used to determine the sulfate concentration (SO4). The calcium (Ca) concentration was determined using the complexometric method (EDTA), while the chloride (Cl) and magnesium (Mg) concentrations were determined using the Mohr method. Flame photometry was used to determine sodium (Na) and potassium (K) concentrations [21]. Titration with a sulfuric acid solution was used to determine bicarbonate (HCO3) concentration [21]. For the 2020 campaign, the chemical analyses were conducted in Mohamed VI Polytechnic University of Benguerir-UM6P-(Morocco) labs. The samples analyses for Ca, Mg, Cl, SO4, NO3 and HCO3 were performed using a SKALAR San++ Continuous Flow Analyzer (CFA), while Na and K concentrations were measured using Atomic Absorption Spectrophotometry (AAS).

3.2 Stable isotope data (δ 18 O and δ 2 H) analysis

The refrigerated water samples collected for stable isotopes (δ18O and δ2H) were analyzed at C2TN/IST (Portugal) laboratories, using the mass spectrometer SIRA 10 VG-ISOGAS for δ2H and δ18O determinations. To improve analytical precision, each sample was measured three times using the procedures proposed by Friedman [22] and Epstein and Mayeda [23] for δ2H and δ18O, respectively. The water samples were equilibrated with CO2 and H2 to quantities of δ18O and δ2H values, respectively, using the standard method [21]. Then, the instrument was calibrated to determine the δ18O and δ2H composition by analyzing IAEA standards, i.e., Vienna standard mean ocean water (VSMOW) with a precision range ± 1.0‰ for δ2H and ± 0.1‰ for δ18O. The results of the isotopes are expressed in terms of per mil (‰) relative to VSMOW using the ‘δ’ notation and Eq. (1).

$$\delta \;\left( \permille \right)\; = \;\left( {\left( {R_{{{\text{sample}}}} \; - \;R_{{{\text{standard}}}} } \right)/R_{{{\text{standard}}}} } \right)\; \times \;100$$
(1)

here Rsample is the ratio of δ18O/ δ16O and 2H/H isotopes for the collected groundwater sample, and Rstandard is the ratio of δ18O/ δ16O and 2H/H isotopes for the standard water sample. The reference standard is usually considered IAEA VSMOW, and the measurement precision is ± 0.1‰ and ± 1‰ for δ18O and δ2H, respectively. The isotope data reported in this paper correspond to VSMOW.

3.3 Quality analysis of hydrochemical data

For quality control and analytical accuracy, the concentrations of total cations and total anions of each sample were recalculated from (mg/L) to (mEq/L), and the ionic equilibrium error was calculated using Eq. (2), considering those samples that were within the acceptable limit of ± 10% [24].

$${\text{IB}}\; = \;100\; \times \;\frac{{\sum {\text{Cations}}\; - \;\sum {\text{Anions}}}}{{\sum {\text{Cations}} \; + \;\sum {\text{Anions}}}}$$
(2)

Within the ± 10 range, all analyzed samples were balanced.

3.4 Water quality

Water quality for drinking use will be assessed using the water quality index (WQI) method. WQI is an index that reflects the composite impact of various water quality parameters [1719]. Water quality explains the physical and chemical properties of water. Various water quality indicators (WQI) have been developed to monitor and analyze the quality of freshwater fit for human consumption. Furthermore, WQI is a well-defined and complicated method for expressing groundwater quality in a single number by combining the values of various physicochemical parameters [25]. Each of the eleven parameters was assigned a weight (wi) according to their relative importance in the overall quality of water for drinking purposes [2528] (Table 1). The maximum weight of five was assigned to a parameter TDS and NO3 because of its major importance in water quality assessment. A minimum weight of one was assigned to those parameters deemed insignificant to the overall water quality like Mg. Other parameters were assigned weights between 1 and 5 based on their relative significance in the water quality evaluation [26]. The following equations (Eq. 3) and (Eq. 4) were used to calculate the water quality index using the weighted arithmetic index technique.

$$WQI = \sum {\left[ {W_{i} \times \left(\frac{{C_{i} }}{{S_{i} }}\right) \times 100} \right]}$$
(3)
$$W_{i} = \frac{{\omega_{i} }}{{\sum {\omega_{i} } }}$$
(4)
Table 1 Groundwater standards World Health Organization (WHO)

WQI levels are categorized as follows: 0–50, excellent; 50–100, good; 100–200, poor; 200–300, extremely poor; and > 300, unfit for drinking [14].

To evaluate water quality for irrigation purposes, the Wilcox diagram was used [29], which uses percent sodium (Na%) obtained by Eq. (5), classifying the water into five categories (excellent, good, acceptable, ordinary, and inadequate).

$$Na\% = \frac{{Na^{ + } + K^{ + } }}{{Ca^{2 + } + Mg^{2 + } + Na^{ + } + K^{ + } }} \times 100$$
(5)

The SAR is an important irrigation quality index, which also evaluates the contents of cations expressed in milliequivalents per liter [30] according to Eq. (5):

$$SAR = \frac{Na + }{{\sqrt{\frac{1}{2}} (Ca^{2 + } + Mg^{2 + } )}}meq/L$$
(6)

3.5 Geospatial analysis

The spatial distribution of the WQI and IWQI was carried out using the Inverse Distance Weighting (IDW) interpolation method of the spatial analysis tool in ArcGIS 10.2.2 software. IDW was chosen over Kriging and other interpolation methods as the region is almost homogenous with less irregularity in the measured and calculated values of the parameters and indices. IDW is a deterministic approach to determining the anticipated value by averaging all known locations and giving neighboring spots more weight.

4 Results and discussions

4.1 Water-table monitoring

Water-table monitoring and piezometric determinations show a slight water level rise of more than 2 m between March 2019 and July 2020 (Fig. 2). The groundwater piezometric investigation in the Meskala-Ouazzi sub-basin revealed the groundwater flow direction, recharge zones, and linkage between these two aquifer layers for shallow (downstream part) and deep aquifers (upstream part). The piezometric analysis of the studied region revealed that the waters of the Meskala-Ouazzi sub-basin flow from northeast to northwest and northeast to southwest, respectively.

Fig. 2
figure 2

Differences in water-level depth in piezometers, comparing March 2019 and July 2020

For the 2019 campaign, piezometric levels will range from 4.8 to 50.3 m, and for the 2020 campaign, piezometric levels will range from 4.9 to 53.8 m (Fig. 2). The main recharge zones may be found around the Bouabout and Maskala regions in the upstream section of the research area, resulting in a mainly NE–NW groundwater flow direction from upstream to downstream of the sub-basin, and eventually to the Atlantic Sea.

4.2 Hydrochemical characterization and water type

In this study, the trilinear Piper diagram [31] (Fig. 3) was used in identifying the groundwater types, which revealed that the mixed Ca–Mg–Cl type of water is the dominant facies for the campaigns in 2019 and 2020, respectively, in the study area.

Fig. 3
figure 3

Piper diagram of groundwater samples in the study area

4.3 Groundwater quality for irrigation

The relatively high concentration of one ion compared to the other has a negative impact on soil, water and ultimately plants. Therefore, the present study analyzes the quality of groundwater in the region regarding various indices such as electrical conductivity (EC), sodium adsorption ratio (SAR), percent sodium (%Na), and IWQI.

4.3.1 Electrical conductivity

The groundwater in the study area is moderately to highly salinized. For the 2019 campaign, electrical conductivity (EC) ranges from 615 to 5738 μS/cm, with an average value of 4479 μS/cm (Table 2). Electrical conductivity (EC) ranges from 541 to 4890 μS/cm for the 2020 campaign, with an average value of 2061 μS/cm. The decrease in salinity between 2019 and 2020 indicates an improvement in water quality.

Table 2 Chemical composition of analysed samples of the campaign 2019 and 2020

4.3.2 Sodium adsorption ratio (SAR)

Another indicator of water quality for agricultural irrigation is the sodium adsorption ratio (SAR). High SAR can cause a deterioration in soil permeability and structure. Furthermore, this can lead to soil salinization in arid climates, which decreases plant capacity through the roots and poor drainage [3234]. Higher salinity decreases osmotic activity by preventing water from reaching plant branches and leaves, resulting in a lower yield. Groundwater is classified by SAR as low (SAR < 10), medium (10 < SAR < 18), high (18 < SAR < 26), and very high (SAR > 26) sodium hazard. Sodium salinity hazard is due to higher SAR values, which reduce soil water availability, affecting crop growth and reducing the magnesium and calcium nutrient ratio. [34]. Salinity hazards are classified as very high salinity water (C4), high salinity water (C3), medium salinity water (C2), and low salinity water (C1). However, alkalinity hazards are divided into four categories: very high sodium water (S4), high sodium water (S3), medium sodium water (S2), and low sodium water (S1). However, SAR was employed as an alkalinity hazard, while EC was used as a salinity hazard [29].

Groundwater samples from the 2019 campaign revealed SAR values ranging from 0.22 to 18.53, with an average of 2.57. (Table 3). SAR values below 10 are found in all of the examined samples, which are mostly found at the foot of the surrounding hills, indicating excellent irrigation water quality and, as a result, no threat (Fig. 4). One sample (E4) obtained from wells near Meskala village in the center has SAR values above 10, indicating precipitation produced by salt leaching and dissolving, which might degrade soil texture and impair plant survival and growth [29]. Groundwater samples were divided into three categories based on the plot of SAR versus electrical conductivity (US salinity diagram) [39]. (Fig. 4). The C2–S1 classes are represented by 3.44% of samples in this plot, highlighting high salinity and low to medium SAR. However, C4–S1 and C4–S2 samples account for 41.37% of all samples, indicating high salinity and medium sodium hazard. Furthermore, 55.17% of water samples were classified as C3–S1, indicating significant salinity and sodium toxicity.

Table 3 Values of SAR. Na%. and WQI in the Meskala-Ouazzi sub-basin for the groundwater of the campaign 2019 and 2020
Fig. 4
figure 4

Irrigation water classification diagram United States Salinity Laboratory (USSL)

SAR values for the Meskala-Ouazzi sub-basin groundwater samples range from 0.47 to 5, with an average value of 2 for the 2020 campaign. (Table 3). SAR values below 10 are found in all of the examined samples, which are mostly found at the foot of the surrounding hills, indicating excellent irrigation water quality and, as a result, no threat (Fig. 4). Groundwater samples were divided into three categories based on the plot of SAR versus electrical conductivity (US salinity diagram) [39]. (Fig. 4). The C2–S1 classes are represented by 6.55% of samples in this plot, highlighting low sodium water (S1 to medium SAR). However, 36.05% of samples are classified as C4–S1 or C4–S2, indicating low salinity and a medium sodium threat. Furthermore, 57.40% of water samples were classified as C3–S1, indicating significant salinity and sodium toxicity. To summarize, samples that fall into the C4–S1, C4–S2, and C4–S3 categories are undesirable for irrigation in all soil types, except for extremely permeable soil with considerable drainage capacity and the selection of salt-tolerant plants [33]. In reality, using these water types for irrigation will decrease crop output and cause soil structure and texture deterioration. On the other hand, groundwater samples in the C3–S1 group should only be used to irrigate salt-tolerant crops produced on well-drained soils with high permeability under regular salinity monitoring [33]. Thus, 95% are in the C3 and C4 classes of the 2020 campaign, which have the highest salinity and medium to high sodium risks and can only be used on plants that tolerate high salinity.

The distribution map of SAR for the campaigns 2019 and 2020 (Figs. 5a, 5c) indicates that most of the groundwater samples cannot be utilized for safe drinking due to evaporation, rock–water interaction, and reverse ion exchange processes in the north-western parts as well as saltwater intrusion in downstream of the study area toward the Atlantic Ocean.

Fig. 5
figure 5

Spatial distribution map of SAR and Na (%) of the campaign 2019 and 2020, respectively

4.3.3 Sodium percentage (%Na)

Excess salt can limit soil permeability; hence the sodium percentage was computed to offer information about the suitability of groundwater for irrigation [29]. Large levels of sodium in groundwater (over 60%) can generate sodium accumulations, disrupting soil formation [12, 33, 35, 36].

For the 2019 campaign, the %Na in groundwater samples from the Meskala-Ouazzi sub-basin ranges from 4.30 to 85.60%, with a mean value of 27.18%. The groundwater samples of the study area have been divided into four categories based on the Wilcox diagram, which displays the evolution of sodium percent of EC. About 29.31% of groundwater samples collected from wells in the recharge area's upstream section fell into the "Good to Permissible" category, indicating minimal mineralization (Fig. 6). In addition, 37.93% of samples fell into the "Doubtful to Permissible" group, indicating modest mineralization. Almost half of the groundwater samples (27.58%) are unfit for irrigation, indicating significant mineralization (EC > 3000 S/cm). Only 3.44% of groundwater samples are deemed ideal for irrigation (Fig. 6).

Fig. 6
figure 6

Suitability of groundwater for irrigation in the Wilcox diagram

For the 2020 campaign, the %Na in groundwater samples from the Meskala-Ouazzi sub-basin ranges from 4.82 to 48.66%, with a mean value of 25.1%. The groundwater samples of the Meskala-Ouazzi sub-basin have been divided into four categories based on the Wilcox diagram, which displays the evolution of sodium percent EC. A total of 47.54% of groundwater samples obtained from wells in the recharge area's downstream section fell into the "Good to Permissible" category, indicating little mineralization (Fig. 6). In addition, 24.59% of samples fell into the "Doubtful to Permissible" group, indicating modest mineralization. Almost half of the groundwater samples (21.31%) are unfit for irrigation, indicating excessive mineralization (EC > 3000 S/cm). Only 4.91% of groundwater samples are deemed suitable for irrigation (Fig. 6). The Wilcox diagram observed that 6.5% of the samples from the 2020 campaign are excellent to use for irrigation, 53.25% of the samples lie in the acceptable class, about 20.11% of the samples lie in the doubtful region, and about 20.14% of the samples lie in the unsuitable region, meaning they cannot be used for irrigation due to the adverse effects they may cause.

According to this classification, most groundwater collected in the Meskala-Ouazzi sub-basin of the campaigns 2019 and 2020 (Fig. 5b, 5d) is suitable for irrigation.

4.3.4 Irrigation water quality index

Irrigation water quality index is a technique for determining the suitability of plant life and soil constituents [12, 36]. It has also been shown that the composite impacts the mineral constituents' effects in groundwater monitoring. The worldwide standard is used to determine irrigation appropriateness for groundwater quality. The types of soil influence a plant's growth and the quality of the water it consumes, with water being the most important factor. When poor quality water is used for farming, it impacts crop output. Intense agricultural methods, as well as a higher rate of chemical fertilizers that use saline on the coast and mix with groundwater, have significantly impacted groundwater quality. The IWQI model was presented in this study based on the integration of eleven hydrogeological groundwater quality parameters: pH, Cl, NO3, HCO3, %Na, sodium adsorption ratio (SAR), permeability index (PI), magnesium hazard (MH), kelly index (KI), potential salinity (PS), and electrical conductivity (EC). This irrigation groundwater quality criterion was derived based on recommendations published by [36], and water quality is categorized into five categories: excellent (IWQI < 50), good (50 < IWQI < 100), poor (100 < IWQI < 200), extremely poor (200 < IWQI < 300), and improper (IWQI > 300) [36]. According to the results, the IWQI values for the two campaigns (2019 and 2020) varied from 40.88 to 154.61, with an average of 76.56. When compared to water quality classification, it was discovered for the 2019 campaign that groundwater samples were mostly "excellent water" (6.2%), "good quality water" (75.6%), and "bad water" (7.2%) (Table 3) (Fig. 7a). Groundwater samples for the 2020 campaign were mostly "excellent water" (8.2%), "good quality water" (83.6%), and "poor water" (8.2%) (Table 3) (Fig. 7b).

Fig. 7
figure 7

Spatial distribution map of IWQI values in the Meskala-Ouazzi sub-basin in the campaigns 2019 (a) and 2020 (b)

To assess the geographic variance of groundwater quality, using ArcGIS 10.2 and interpolation techniques (IDW). To construct the different thematic spatial maps, Fig. 8 shows the spatial distribution of IWQI for the three campaigns in 2019 and 2020. These maps show where areas of poor groundwater quality are located so that treatment procedures can be implemented to improve quality by increasing crop productivity.

Fig. 8
figure 8

Spatial distribution map of WQI values in the Meskala-Ouazzi sub-basin in the campaigns 2019 and 2020

4.4 Quality of drinking water

The WQI was calculated using the values of eleven physicochemical parameters: pH, EC, TDS, Ca, Mg, Na, K, Cl, HCO3, SO4, and NO3 as only these eleven parameters were considered [13, 14], which are very important for the quality of drinking water. The variation of WQI at different sites in the pre-COVID-19 during and after the lockage periods is shown in Figs. 8a and 8b for the 2019 and 2020 campaigns, respectively.

According to the WQI calculations for the 2019 campaign, 12.07% of the sample sites have good water. On the other hand, more than 56.9% of the sample is poor water, 22.41% of the sample sites have very poor water, and 8.62% are unfit for drinking (Table 3) (Fig. 8a). It can be observed from this graph (Fig. 8a) that there is no excellent water in the study area.

According to WQI for the 2020 campaign during lockdown COVID-19, the total study area has been split into 32.8% (good areas), 44.3% (poor areas), 21.3% (very poor areas), and 1.6% (unfit areas), respectively, and no excellent groundwater areas have been identified (Table 3) (Fig. 8b). Additionally, Fig. 8b showed that water quality has improved compared to the old 2019 campaign in some places.

The spatial distribution of WQI in the Meskala-Ouazzi sub-basin of groundwater samples collected in 2019 and 2020 is represented in Fig. 8. It is evident that in most areas of the sub-basin of Essaouira, the phreatic water was of poor or good quality. Following the results of the two years of water quality index, we observed that water quality is deteriorating, particularly in the downstream part of the Essaouira basin.

The confinement due to COVID-19 has significantly improved the water quality of the Meskala-Ouazzi sub-basin. Instead, approximately 50% of sites showed improved water quality when assessed through the calculation of the Water Quality Index. It is obvious from the spatial distribution maps (Fig. 8a, 8b) that the groundwater in the study area is not of acceptable quality for human consumption.

In the Meskala-Ouazzi sub-basin, areas were determined to present “poor”, “very poor”, and “unfit” quality for consumption should not be used for drinking without some prior treatment; otherwise, there could be various health problems. Water quality is poor due to several factors, such as a combination of natural (interaction of water with the geological environment) and anthropogenic (infiltration of agrochemicals, sewage and overexploitation of wells that produce seawater intrusion) processes.

4.5 Stable isotopes (δ18O, δ.2H) 

Water molecules have stable isotopes of oxygen δ18O and hydrogen δ2H, which include origin characteristics and, therefore, can be used to trace the source and mode of transport of water molecules [3740]. These isotopes can also be used to identify precipitation's recharge mechanisms [40]. Several locations (spring, borehole, dam and well) of the study area were collected and studied during the 2016 and July of 2020 campaigns to assess the source of aquifer recharge. The results of the isotope analyses are shown in Table 4. The stable isotope ratios of the water molecules of campaign 2016 range between − 6.01 and − 3.28 for oxygen-18 levels, with an average of − 4.89, and between − 34.5 and 20.2 for deuterium contents, with an average of − 27.98 (Fig. 9a) (Table 4). The stable isotope ratios of the water molecule range between − 6.31 and 0.58 for oxygen-18 levels, with an average of − 5.18, and between − 39.2 and 2.2 for deuterium contents, with an average of − 29.04 for the campaign 2020 (Table 4) (Fig. 9b).

Table 4 Statistical summary of the stable isotopic values of the campaign 2016 and 2020
Fig. 9
figure 9

Plot of δ2H vs δ18O for the groundwater for the campaign 2016a and the campaign 2020b

The Local Meteoric Water Line (LMWL) (δ2H = 7.55 × δ18O + 9.2 [41]) and the Global Meteoric Water Line (GMWL) (δ2H = 8 × δ18O + 10 [37] have been located on the correlation diagram of oxygen-18 versus deuterium (Fig. 9). The majority of the water samples were close to both the local meteoric water line and the global meteoric water, showing that both the groundwater and atmospheric precipitation were the primary sources.

This recharge is visible throughout the upstream sector of the study area, particularly in the Bouabout region and in the Meskala region to the southwest. Furthermore, the apparent low salinities of the samples tend to support this conclusion. Other samples with more stable isotopes, such as the dam water and a few samples in the downstream half of the study area, fall below the GMWL. Groundwater samples in the discharge area to the west and south of the research area showed higher δ2H and δ18O, indicating that surface water sources are impacting groundwater. This highlights the role of evaporation and other processes in groundwater mineralization.

4.5.1 Isotopic evidence of evaporation

Chloride concentrations were plotted against the groundwater's δ18O signature to better understand the recharging mechanism and the impact of evaporation on isotopic signatures (Fig. 10a,b) for the two campaigns 2016 and 2020. When it comes to determining the mechanism of groundwater recharge, such connections are extremely useful. Any rise in salt concentrations owing to evaporation should be shown in a linear relationship with an enrichment in δ18O signatures [42]. The dissolution of salts, on the other hand, results in an increase in salinity but not in the fractionation of water molecules. The following are the key conclusions that may be drawn from δ18O–Cl plots:

Fig. 10
figure 10

Plot of Cl vs δ.18O for the groundwater for the campaign 2016 (a) and the campaign 2020 (b)

Chloride concentrations were plotted against the δ18O signature of the groundwater to understand the recharge mechanism and the impact of evaporation on isotopic signatures (Fig. 10a, b) for both the 2016 and 2020 campaigns. When it comes to determining the mechanism of groundwater recharge, these connections are extremely useful. Any increase in salt concentrations due to evaporation should show a linear relationship with the enrichment of δ18O signatures [42]. On the other hand, the dissolution of salts increases salinity but not in the fractionation of water molecules.

The link between stable chloride and water isotopes (δ18O, δ2H) is employed to provide a reliable interest by combining chemical and isotopic data to confirm the fundamental processes governing groundwater salinity. Many previous research studies [1517, 42] in arid and semi-arid areas have found that groundwater salinity is mainly determined by dissolution or evaporation. Indeed, the graph shows a significant increase in Cl concentration and δ18O enrichment (Fig. 10).

Therefore, evaporation contributes to the increase in groundwater salinity, which is most visible downstream. A Cl vs. δ18O (Fig. 10) identifies the key mechanism controlling groundwater salinization. On the Fig. 10 a significant proportion of groundwater samples show a relatively stable δ18O with a higher chloride concentration than on the δ18O. The majority of the groundwater samples show mineral dissolution as the primary process. For the 2016 campaign, the Cl vs. δ18O relationship (Fig. 10a) shows that two groundwater samples (O3 and O4) had low chloride and δ18O values. This could mean groundwater is recharged in this area, especially in Meskala and Bouabout. This area is still characterized by the recharge zone in the 2020 campaign present at sample (EL 7) (Fig. 10b).

For the two campaigns, 2016 and 2020, two fundamental mechanisms leading to groundwater salinization in the examined aquifer were identified: (1) dissolution of evaporites, and (2) evaporation processes. In fact, the first step demonstrates a dissolving effect, with the isotopic compositions of the samples (δ18O) remaining unchanged as the chloride level increases. This model clearly supports the theory that the salinity of these waters is mainly controlled by dissolution.

For the 2016 and 2020 campaigns, two fundamental mechanisms leading to groundwater salinization in the aquifer under investigation were identified: (1) evaporite dissolution and (2) evaporation processes. The first class demonstrates a dissolution effect, with sample isotopic compositions (δ18O) remaining unchanged as chloride levels increase. This factor supports the theory that the salinity of these waters is primarily controlled by dissolution.

5 Concluding remarks

Groundwater analysis is carried out using different methods and techniques to assess the usability of groundwater for irrigation and drinking purposes and the source of aquifer recharge. The water quality index, Piper plot, Wilcox plot, USSL plot, and isotopic stability (δ18O, δ2H) were used to demonstrate whether water samples from the Essaouira region are suitable for human use. Hydro-chemical facies reveal groundwater's nature is Na–Cl, mixed Ca–Mg–Cl and SO4–Ca type in the study area. The mean EC of the samples was determined 2453.8 μS/cm for the 2019 campaign, 2061.1 μS/cm for the for the 2020 campaign.

The results of water analyses were evaluated using the WQI and IWQI methods to assess groundwater quality for drinking and irrigation water use. Knowing the quality of groundwater in the region and determining the areas of use are important in terms of the sustainability of water management. According to the results obtained by the WQI method, not all groundwater samples in the study area are suitable for use as drinking water. In addition, according to the IWQI method, the groundwater samples are suitable for irrigation. In addition, using groundwater as drinking water may be hazardous to human health, and alternative drinking water resources should be investigated. On the other hand, to ensure the sustainable use of groundwater, it is necessary to control agricultural activities in the area, monitor the use of pesticides and fertilizers, and encourage organic farming practices.

The results suggest that groundwater consumption in the study area requires treatment and that most groundwater samples are in classes C3 and C4, which have the highest salinity and medium to high sodium risks, and can only be used on plants that tolerate high salinity.

The stable isotopic composition (δ18O and δ2H) of groundwater reveals that precipitation is the primary source of groundwater recharge and shows a higher depletion value in the recharge area than the discharge. In addition, the enriched isotopic composition δ18O > 5‰ indicates that groundwater is subjected to evaporation before recharge. This demonstrates that rainfall events result from the evaporation or mixing of elements with evaporated water before infiltration into the aquifer. In contrast, most points indicate the infiltration of water without evaporation. Atlantic precipitation continuously recharges watershed recharge areas between 2016 and 2020. The comprehensive approach to better understanding groundwater dynamics presented here could be a useful tool for managers to develop appropriate strategies for exploiting this resource.