1 Introduction

Over the recent years, there is a rise in global water demand as a result of population surge, climate change and an increased surface water pollution which led to water stresses including over reliance on groundwater sources [23]. In Sub Saharan Africa (SSA), 78% of its people struggle to access safe and quality water for drinking and sanitation [6]. Despite the fact that 97% of the earth is covered by water, only about 3% of it is accessible as freshwater, however out of this a minute 0.01% is available for human consumption and the remaining is saline water [31]. By a large magnitude, the groundwater sources are becoming the most reliable source of safe water for domestic, irrigation and industrial uses in the SSA which is also accessible throughout the year [26]. It’s reported that 2 billion people on globe relies on the groundwater for their day-to-day primary needs [41]. Unfortunately, geogenic variables, which are even distributed over a very flat and small area, can sometimes cause the deuteriation of the groundwater quality [24, 26]. Moreover, anthropogenic factors such as industrial and agricultural waste infiltration and other miscellaneous processes including weather changes, seawater intrusion, subterranean septic intrusion, may also cause groundwater to become dangerous for ingestion, particularly in metropolitan areas [13]. Prior to human consumption, these call for routine groundwater quality evaluation. According to evaluations of groundwater around the world, consuming groundwater has significant detrimental consequences on health, especially in large cities in China [12, 48], South Africa [30], India [15], and the United States [3] to mention a few. It is also estimated that over 80% of diseases facing human beings are associated with consuming polluted water [40]. Furthermore, global estimates indicate that 1.8 million people die every year due to diarrheal diseases which is linked with consuming contaminated water [40].

With an estimated 5.3 million population, Dar es Salaam is Tanzania's capital and largest metropolis (URT, 2023) which is not exempted from water stresses as other developing countries [23]. Majority of the population estimated to be greater than 50% in the city relies on groundwater due to intermittent water supply from the mandated institution which is Dar es Salaam Water and Sewerage Authority (DAWASA) [29]. DAWASA treats and supplies water mainly from Ruvu River which over the years has experienced drought and threats from anthropogenic activities including farming and livestock keeping [14, 28]. The climate change leading to the rise in evaporation of surface water and human activities has increased the sedimentation and pollution along urban rivers hence decreasing the quality and quantity of water levels [46]. This has made water supply to be unreliable to the population of Dar es Salaam in most of the time [29]. As a result, groundwater from privately owned wells is a more dependable source of water for drinking and urban irrigation [23, 29]. There are estimated of over 7500 active boreholes/wells in the city and annual withdrawals from the aquifer exceeds 69 million cubic meters of water [29]. Nevertheless, the saline water from the Indian Ocean has been reported to seep into the water table and influence the quality of groundwater along the Dar es Salaam and Coastal Region [2]. In addition, urbanization, urban agriculture, industrial operations, and domestic wastes may all have a negative impact on the city's groundwater quality indirectly [2]. On the other hand, there are no published validated analytical data on the quality of groundwater and its suitability for agriculture and domestic uses in the study area. This has inspired us to look into the potentials of groundwater's quality and determine whether it is suitable for domestic and agricultural use in Kigamboni Municipality.

In order to understand the chemistry controlling the physicochemical nature of the water and the interrelationship among the factors influencing the quality of the groundwater, the statistical multivariate principal components analysis (PCA) and hierarchical cluster analysis (HCA) can be utilized [39]. The PCA and HCA can be applied to trace the sources of pollution such as industrial and agricultural activities, contributing to deterioration of the groundwater quality. Here the large set of data is dimensionally reduced into a few interpretable components characterizing the groundwater while keeping the information unchanged [8]. The HCA on the other end, is a multivariate statistical tool that can be used to classify groundwater sources or individual samples from the sites according to varying levels of water quality [4]. HCA runs without drawing any presumptions about the lithology of the aquifer, confinement, the style and rate of water–rock interaction, or any other elements that might affect categorization as it is a data-driven method [4]. Without establishing an assumption about the number of categories, each sample is assigned to one water-quality category.

Furthermore, the water quality indices WQI, beside tracing the sources of pollution they can as well be applied to identify the usability of the water source based on their quality rate [39]. The main idea of WQI is to transform a number of selected variables, which are quantitative and intensive, into a single variable which is qualitative, ordinal and intensive [25]. The water quality index (WQI) using weighted arithmetic method is widely utilized to evaluate suitability of water mainly for various purposes [43]. The WQI method is preferable due to its capability of incorporating multiple water quality data of different parameters and also need few parameters [20]. Meanwhile, different irrigation water quality variables such as pH, electrical conductivity (EC) and some indices including sodium adsorption ratio (SAR), sodium percentage (Na%), permeability index (PI) and magnesium hazard (MH) can be applied to determine the suitability of groundwater for irrigation [23, 27]. These methods are important tools for formulating suitable policies for real-time and sustainable management of groundwater assets.

Groundwater quality in urban areas has been extensively studied around the world [2, 8, 19, 25]. However, there is limited research on groundwater quality in rapidly developing coastal towns, where saltwater intrusion, on-site sewage systems, and agricultural activities can all impact underground reservoirs. This is especially true in Sub-Saharan Africa, which is facing the simultaneous challenges of urbanization, climate change, and groundwater exploitation. Our study is the first to investigate groundwater quality in the coastal municipality of Kigamboni, Tanzania, where residents rely heavily on limited local water sources for domestic and irrigation purposes and water quality data is also scarce. The study collected and analyzed groundwater samples from densely populated neighborhoods during dry periods, when aquifer stress is highest. This integrated approach provided timely information about the suitability of groundwater for drinking and irrigation, which can be used to develop focused management strategies for securing safe and sustainable groundwater supplies in Kigamboni area. Therefore, the purpose of this study was to determine the physiochemical quality of the groundwater in a particular location of the city of Dar es Salaam and determine whether it was suitable primarily for drinking and irrigation purposes using multivariate and water quality index.

2 Materials and Methods

2.1 Study Area Descriptions

Kigamboni Municipal Council extends along the Indian Ocean in Dar es Salaam city and was selected for this study based on its location and the dependency of its people on the groundwater for both drinking and farming activities. The area is located in the geographic coordinates 6° 49′ 20ʺ S, 39° 31′ 56ʺ E as shown in Fig. 1. Kigamboni is a small district and a part of Dar es Salam region located in the eastern Tanzania with a total population of 317,902 people including 156,400 males and 161,502 females (URT 2022). Just like other places of Tanzania the months of December–January is the most wet period when groundwater recharges and dilution occurs while June–July is the driest period and generally characterized as the semi-arid area and represents the worst groundwater withdrawal in the area. The area has annual temperature of 26.89 ºC, with an estimated of 140.27 mmHg per year (Bakari et al. 2012).

Fig. 1
figure 1

Map of Kigamboni Municipal showing groundwater sampling location

2.2 Chemicals and Materials Used

All the chemicals and reagents used in this study were of a high purity standard. The glassware was washed using 0.1 M nitric acid and then cleaned by distilled water. Stock solutions of analytes and all standard solutions were prepared using deionized water. The standard solutions for the determination of chemical composition of water (F, NO3, HCO3 CO32−, Total Hardness, and SO42−) were 1000 mg/L. Standard solutions for major cations used for the analysis of K+, Ca2+, Mg2+, and Na+ were also 1000 mg/L. The chemicals and standards used in this study were purchased from Aqualab located in Dar es Salaam, Tanzania.

2.3 Water Sampling and Preservation

Groundwater samples were collected from twenty-five (25) protected water wells within a study area between June and July 2022. This study was specifically carried out during dry season so as to establish groundwater quality in a period when there is less dilution caused by rainfall and hence provides the worst likely condition of groundwater quality in terms of ionic composition. Ideally, it is expected that during rainfall season, there is recharge of groundwater leading to dilution of mineralogical compositions [23, 29]. The points where samples were collected are indicated as number 1–25 in Fig. 1. The water samples were pumped for five (5) minutes to remove any dirt before being collected and stored in a pre-cleaned polyethylene plastic bottle (1L). The sample were placed in an ice box at 4 °C for preservation after a short time of collection and then transported to the Water quality laboratory of the Water Institute located in Dar es Salaam for analysis.

2.4 Water Sample Analysis

The groundwater samples were analyzed for their physical chemical properties, as well as biological characteristics. Parameters of interest were selected based on analytical capabilities of the laboratory, available resources as well as previous studies done in Dar es Salaam region on groundwater pollution that revealed high concentration of major ions and fecal contamination with less heavy metals in groundwater [18, 23, 29, 32, 38, 44]. The pH, total dissolved solid (TDS), and electrical conductivity (EC) were analyzed in situ using a multiparameter probe meter (YSI pH100A, USA) based on potentiometric principle. Total hardness (TH) and Ca2+ were quantified by complexometric titration with ethylenediaminetetraacetic acid (EDTA), using Eriochrome Black T indicator. Meanwhile, the CO32− and HCO32− were determined by acidimetric titration with sulfuric acid using methyl orange indicator. Argentometric titration with silver nitrate and chromate indicator was used to measure Cl in a water sample.

The turbidity (TB) on the other end was measured by nephelometry, using a nephelometric turbidity unit (NTU) meter applying principle of light scattering. The flame atomic emission spectrometry was utilized to quantify Na+ and K+ based on emission of light at 589 nm and 766 nm wavelengths, respectively when excited in a flame. Meanwhile, UV–visible spectrophotometry was utilized to measure SO42− and NO3 through absorbance at 420 nm and 220 nm, respectively. Fe2+ and Mn2+ were determined by spectrophotometry using colorimetric reagents 1,10-phenanthroline and formaldoxime, respectively. Total coliforms and Escherichia coli were quantified by membrane filtration. Summary of the specific method applied to each of the parameters is shown in Table 1. All analyses followed standard methods of water and wastewater analysis as described in Federation and Association, [9] and they were conducted at the Water Institute's Water Quality Lab, Dar es Salaam, Tanzania.

Table 1 Techniques used for evaluation of groundwater quality parameters

2.5 Quality Control and Quality Assurance

To ensure the quality of the samples and validity of the data obtained, various quality control and assurance were observed including analysis of samples in triplicate. The instruments were also recalibrated each time before being used and then tested using certified reference materials (standard solution). After every 8 analyses the internal quality control retesting of the standards for the major anions and cations were conducted to ensure the relative standard deviation is maintained at ≤ 5%. When the RSD was above 5% the analysis was reconducted.

2.6 Evaluation of Groundwater Quality for Drinking Purpose

The evaluation of quality and suitability of the groundwater for drinking purpose was assessed by using the arithmetic weighted quality index AWQI. The AWQI is the single value calculated from different water parameters summarizing the overall effect of individual physical and chemical characteristics for consumption. The AWQI (Eq. 1) involved calculating relative weight of each parameter W (Eq. 3). Then the quality rating scale (Qn) was calculated by dividing concentration of each parameter to its standard value multiplied by 100 (Eq. 2). Water quality index by weighted arithmetic mean method AWQI was then established by using Eq. 1:

$$AWQI = \mathop \sum \limits_{i = 1}^{n} Qi*Wi$$
(1)
$$Qn = \frac{{\left[ {C_{n } - C_{O} } \right]}}{{\left[ {C_{s} - C_{o} } \right]}}*100$$
(2)
$$W = \frac{K}{{C_{S} }}\,{\text{while}}\,K = \frac{1}{{\sum \frac{1}{Co} }}$$
(3)

Cn measured concentration of n parameter, Cs is a WHO standard limit of a parameter n, Co ideal parameter in pure water Co = 0 (for pH = 7), Qn sub index quality rating for each parameter, W is a unit weight and K is (K = unit weight of parameter).

2.7 Evaluation of Water Quality for Irrigation Purpose

It is crucial to assess the irrigation water quality because it can have a detrimental effect on crop development. As a result, the suitability of the groundwater for its suitability for irrigation was analyzed using various indicators such as Sodium Adsorption Ratio (SAR), Na%, Magnesium Hazard, and Permeability Index as described by Selvakumar et al. (2017).

Sodium Adsorption Ratio (SAR):

$${\text{SAR}} = \frac{{{\text{Na}}^{ + } }}{{\sqrt {\frac{{{\text{Ca}}^{2 + } + {\text{Mg}}^{2 + } }}{2}} }}$$
(4)

Sodium Percentage (Na %):

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

Magnesium Hazard (MH):

$${\text{Na\% }} = { }\frac{{{\text{Mg}}^{2 + } }}{{\left( {{\text{Ca}}^{2 + } + {\text{ Mg}}^{2 + } } \right)}} \times 100$$
(6)

Permeability index:

$$PI = \frac{{\left( {Na^{ + } + \sqrt {CO_{3}^{2 - } } } \right)}}{{ Ca^{2 + } + Mg^{2 + } + Na^{ + } }}*100$$
(7)

Where the unit of concentration of ions are in meq/L.

2.8 Statistical Analysis

Descriptive analysis including the means and standard deviations were calculated using Microsoft excel version 10. The OriginPro2016 software was also utilized to analyze and develop Pearson’s correlation and Box plot, while the Grapher 13 was used to plot Wilcox diagram. Principal component analysis (PCA) and Hierarchical cluster analysis (HCA) were used to assess the nature of physicochemical characteristics of the groundwater samples and established interrelationship between analyzed parameters.

3 Results and Discussion

3.1 Suitability of Groundwater for Drinking Purposes

The results of physicochemical quality of the groundwater analyzed, their mean, minimum, maximum and standard deviation is presented in Table 2. The color taste and odor of the water samples were found to be within TZS and WHO standards in all water sample analyzed. Moreover, there was no variation on the levels of Mn2+ and Fe2+ as all water samples had < 0.001 mg/L. The Mn and Fe levels were within recommended Tanzania and WHO limit for drinking purposes. This suggests the nature of the aquifer in the study area is not of iron based or there is absence of dissolution inducer of the rocks such as reductive dissolution of Fe/Mn oxides [45]. The groundwater sample were found to be uncontaminated by Eschericial coli (E. Coli) and Total coliform (0 CFU) indicating absence of contamination from domestic and municipal wastewater runoff. Furthermore, the absence of microbes in the groundwater could justify lower levels of Fe/Mn due to the lack of microbially mediated redox process that, can lead to the mobilization of Fe and Mn into groundwater (C. [47]. Therefore, these parameters were not used to correlate with other parameters and were not considered in a further discussion of this study and hence not included in Table 3.

Table 2 Physicochemical characteristics of groundwater quality samples collected from Kigamboni, Dar es Salaam, Tanzania
Table 3 Pearson’s correlations of groundwater physical and chemical parameters in the study area

3.2 Physical Parameters (pH, EC, TDS and TB)

The pH value was found to be in a range of 6.8–8.6 with an average value and standard deviation of 7.8 ± 0.6. The range was within the acceptable range of TZS and WHO for a drinking purpose while the small deviation from the mean could suggest slight variation in the nature of rock-water interaction among the water wells. Moreover, the lack of correlation between pH and other parameters EC, TDS and TB indicate the pH to be irresponsible in controlling the groundwater chemistry [40]. The EC (195–5860 µS/cm) was found to exhibit an average value of 976 µS/cm and the TDS (99.7–2680 mg/L) with the mean value of 530 mg/L, their mean values were within the limit, though individual values in some sampled boreholes were above TZS and WHO standards as shown in Table 2. The levels of both TDS and EC values depend on the amount of dissolved ions in water and as expected the two exhibited strong correlation between them (r = 0.95). This was also revealed by the Pearson correlation which indicated that the cations of Ca2+, Mg2+, Na+ and K+ and the anions of Cl and CO32− contributed to the TDS and EC due to their positive correlation with r > 0.6. The same observations were reported from previous studies [29, 47].

Nevertheless, analysis of the EC and TDS revealed that 60% and 24%, respectively of the samples were above the acceptable WHO limits while only 8% of the samples were above Tanzania standards. The lower values of TDS of around 76% of the groundwater samples may suggest absence of the influence of anthropogenic sources in the physicochemical properties of the groundwater [7]. This implies the natural processes such as rock weathering, ion exchange and evaporation could be responsible for the observed level of TDS [10]. The turbidity that mainly refers to the suspended solids in water was found to be in a range of 2–20 NTU. The WHO and TZS propose the levels of turbidity in drinking water be kept below 5 NTU. The correlation analysis revealed absence of correlation between turbidity and other parameters while only 16% of the samples were above the recommended limits. This finding is in agreement with the previous studies [23, 34, 38], that reported the EC and TDS of groundwater in Dar es Salaam to be at an average of 700 and 882 mg/L and characterized by a low turbidity.

3.3 Major Cations in Groundwater (TH, Ca2+, Mg2+, K+, Na.+)

The total hardness (TH) was observed to be in a range of 30–855 mg/L with a mean value of 194.80 mg/L. The WHO and TZS recommend that up to 500 and 600 mg/L of the TH can be tolerated, this qualifies 99% of the samples as safe in term of hardness. The TH has shown a strong correlation to Ca2+ (r = 0.89) and Mg2+ (r = 0.79) suggesting that there was a possible leaching of the mineral rocks leading to the low to moderate hardness of the groundwater observed [29].

The average calcium concentration in the groundwater samples was 37.20 mg/L, with values ranging from 2.4 to 266 mg/L. The World Health Organization (WHO) and Tanzanian (TZS) drinking water guidelines recommend calcium levels below 75 mg/L and 150 mg/L, respectively. Only 8% of the samples had calcium levels above the threshold, indicating that the water quality generally meets drinking water standards. However, 12% of the samples had magnesium concentrations above the WHO limit of 100 mg/L. Calcium and magnesium in groundwater are primarily derived from the weathering of limestone, calcite, and magnesite deposits [29, 40, 44]. The weak correlation between calcium and carbonate (r = 0.33) suggests that calcite and limestone dissolution may not be the main source of calcium in this aquifer. In contrast, the strong correlation between magnesium and carbonate (r = 0.71) indicates that magnesium carbonate (magnesite) dissolution is the likely source of alkalinity and magnesium in the groundwater [33].

The TH exhibited positive correlation (r) with Ca2+ (0.89), Mg2+ (0.79), K+ (0.6), Cl (0.77) and Na+ (0.59), indicating the prevalence of both divalent and monovalent species and the moderately hard nature of the groundwater. The correlation between Mg2+ and CO32− (r = 0.78) implies dissolution of magnesium-bearing minerals like magnesite during rock weathering, thereby increasing Mg2+ levels in the aquifer [21, 36]. Most samples fell in the slightly hard to moderately hard range of total hardness. Additionally, the proximity to the Indian Ocean raises the prospect of seawater intrusion contributing to the elevated hardness by importing Na+ and Cl. ions into the groundwater [29]

The mean level of Na+ was recorded to be 150 mg/L at a range of 2.07–1065 mg/L. Four samples (16%) were above the 200 mg/L WHO and TZS recommended level. Moreover, the minimum concentration of K+ was 0.5 and the maximum of 27 mg/L, 12% of which were recorded above the WHO limit of 12 mg/L. K+ and Na+ has shown positive correlation to Cl, TDS, EC and TH. Both Na+ and K+ are known to occur naturally in water and their concentration increases due to the solubility of rocks leading to the erosion from rocks. The most important correlation is that of Na+ and K+ to Cl+ (0.95) suggesting salinity of the groundwater to be dominated by ions of Na+, K+ and Cl. This potentially indicate possible sea water intrusion into groundwater [36].

3.4 Major Anions in Groundwater (NO3 2−, SO4 2−, HCO3 , CO3 2−, PO4.2−)

The average concentration of NO32− in the samples was 0.059 mg/L with the highest level recorded as 0.24 mg/L from the lowest of 0.015 mg/L. None of the samples exhibited nitrate level above WHO recommended limit of 50 mg/L. This suggests inexistence of anthropogenic influences on the groundwater quality [37]. Furthermore, the mean concentration of carbonates of the groundwater samples was recorded as 104 mg/L from a range of 30–300 mg/L which is within WHO limit value of 400 mg/L. Bicarbonate on the other hand has a mean value of 154 with minimum value of 41 and a maximum value of 661 mg/L. The relatively large standard deviations (SD) of 80 and 103 for carbonate and bicarbonate respectively, point to considerable differences in the geological formations within the study region [16]. The chloride (Cl) concentrations in the groundwater samples exhibited an average value of 289 mg/L, exceeding the World Health Organization (WHO) permissible limit of 200 mg/L for potable water. A considerable fraction (36%) of the analyzed samples displayed Cl levels above the threshold, rendering the groundwater unsuitable for drinking purposes in these locations. In contrast, the sulfate (SO42−) content in all sampled groundwater sites was observed to be below the WHO benchmark of 250 mg/L. The mean SO42− concentration was quantified as 25 mg/L, with individual values ranging from 1.89 mg/L to 169 mg/L. The high Cl level and widespread occurrence above the WHO threshold point to significant saltwater intrusion-related pollution [5, 33]. The SO42− profile, on the other hand, indicates a negligible level of industrial contamination and verifies that, throughout the research area, the groundwater complies with this parameter's drinking water standards. Meanwhile, the strong positive correlation between Cl and Na+ (r = 0.96), K+ (r = 0.95), Mg2+ (r = 0.79) and TDS (r = 0.988) were observed further suggesting these ions to be responsible for the salinity of the groundwater in the study area as a result of seawater intrusion.

3.5 Suitability of Groundwater for Drinking Purposes by Water Quality Index

The groundwater samples were tested for suitability for drinking purpose using the Weighted Arithmetic Water Quality Index (AWQI). According to the AWQI the water quality can be ranked in the order of 1–25, 26–50, 51–75, 76–100, 100 > as excellent, good, poor, very poor and unsuitable water quality {Shah, 2017 #1}. Findings of this study indicated that 16% of the samples were found to be within excellent quality, 40% fall in a appears to be good for domestic use, 28% were poor, while the other 12% had a very poor quality and 4% of the groundwater was unsuitable for drinking purposes (Table 2; Fig. 2). 44% of the water samples were unsuitable for drinking due to high levels of chloride (Cl−), sodium (Na +), and total dissolved solids (TDS). Overall, the water sources described in the category of poor, very poor and unsuitable pose a moderate to high probability of causing chronic health problems in populations that rely on them contaminated waters over many years [1].

Fig. 2
figure 2

Pie diagram for classification of Kigamboni groundwater based on AWQI

3.6 Suitability of Groundwater for Irrigation Purposes

Apart from domestic uses, groundwater is one of the main sources of water for irrigation in the study area. To evaluate the suitability of groundwater quality for irrigation purposes several parameters including EC, pH, SAR, PI and MH were analyzed [1]. The pH values of all groundwater samples fell within the permissible range of 5.5–9.5 for irrigation [17]. Furthermore, TDS, which correlated positively with EC and salinity, is an important parameter for assessing irrigation water quality. Thus, according to the classification of water based on EC value, the EC < 250 (excellent); 250 -750 (good); 750–2000 (permissible) and > 3000 (unsuitable) [1, 17]. Based on the scale rate, the number of groundwater samples; 5, 11, 7, 2 fall in the categories of excellent, good, permissible and unsuitable, respectively.

The first visualization of the data for their suitability for irrigation purposes were made from the plot of the SAR against EC represented by a Wilcox diagram (Fig. 3). The Wilcox diagram is a graphical tool for analyzing the suitability of water for irrigation based on its chemical composition. It contributes to determining the impact of water quality on soil structure and crop productivity [1, 17]. It classifies water into for groups as excellent (C1S1), good (C2S2), permissible (C3S3) and unsuitable (C4S4) depending on which box data falls in [17]. The diagram suggests most of the samples (88%) fall in a class of low EC and low SAR, (C1S1, C1S2 and C2S1) levels making them suitable for irrigation. Only three samples equivalent to 12% fall in a C3S1, C4S1 and C1S4 suggesting they are not suitable for irrigation purpose [17].

Fig. 3
figure 3

Wilcox diagram for Kigamboni groundwater

The quality of the groundwater for irrigation was further assessed by using other parameters including SAR. The amount of sodium in water samples is important as it controls the infiltration of water into the soil. The Na%, Kelly ratio (KR) and SAR are indexes that measure the effect of sodium levels in irrigation water [17, 35]. The average Na % of the groundwater samples was 59%, the lowest value being 3.4% and the maximum value of 82.6%. The classification of the water quality for irrigation based on Na % suggests that when the value is < 20 (excellent), 21–40 (Good), 41–60 (permissible), 61 – 80 (Doubtful) > 80 (unsuitable). Only 1 sample fall in excellent quality, sample with good quality is also 1, while 9 and 10 samples are in a permissible and doubtful range, respectively and 3 are unsuitable for irrigation as shown in Table 4.

Table 4 Classification of groundwater quality based on suitability of water for irrigation purposes

Moreover, the sodium adsorption ratio (SAR) provides a measure of sodium hazard and classifies water quality similarly to sodium percentage. The SAR analysis revealed that 13 samples can be applied for irrigation with excellent quality, 9 have good quality and the remaining 3 were in the permissible range, while none of the samples had poor or unsuitable quality. The KR value < 1 suggests water to be safe while > 1 water is regarded as unsuitable. Based on this criterion, 7 samples were deemed safe while the remaining 18 were unsafe. The divalent ions of Ca2+ and Mg2+ promote equilibrium of groundwater chemistry [11]. When the amount of Ca2+ and Mg2+ is higher, the soil quality becomes alkaline in nature resulting into a decrease in crop yield [11, 22]. The magnesium hazard (MH) quantifies this effect, with values below 50 indicating suitable water and above 50 denoting unsuitable irrigation water. Findings from this study revealed that fourteen samples appeared to be unsuitable while 11 were suitable.

3.7 Data evaluation Using Box Plot

The Box plot was used to depict time-based concentration and influence of key ions. The graphic estimates the mean, median, and standard deviation of groundwater. The rectangular box's top and bottom correspond to the parameters' upper and lower quartiles, and its bottom is the line at which ions are to be compared. The size of the box denotes the spores of the centre value, and the middle line stands in for the median. In a study area, the box plot of groundwater revealed that the influencing parameters were in the order of Na+ (NA) > Ca2+ (CA) > Mg2+ (MG) > K+ (K) for cations and Cl (Cl) > CO32− (CB) > HCO3 (BCB) > SO42– (SO) for anions (Fig. 4). The Box plot revealed the chemical composition of groundwater in Kigamboni to be dominated by Na+ and Cl. This finding is similar to what was reported from previous studies [29].

Fig. 4
figure 4

Box plot of the major ions in Kigamboni, Dar es Salaam

3.8 Analysis of Groundwater Quality by Principal Component Analysis (PCA)

The fourteen parameters in the 25-groundwater samples of the Kigamboni were further analyzed for the significant principal component on the basis of Kaiser criterion. Factors with eigenvalues > 1 were considered for further discussion. Four principal components that explain 78.92% of the cumulative variation, which could identify the main sources in the hydrochemistry of the groundwater were established as shown in Table 5. The seven parameters dominated the PC-1 in the groundwater physiochemical characteristics by variability of 46.8% and the highest eigenvalue of 7.92 which show low loading of TDS, EC, TH, Mg, Cl, K and Na (PC > 0.3). This suggests the water could be of K-Cl, Na-Cl, Mg-Cl (Mg/K/Na-Cl) type. The anions of SO42− and PO43− accounted for 14.06% of the PC-2 with moderate loading of 0.38 and 0.55, respectively and none of the cations appearing in this class. The Ca2+ appeared in a PC-4 showing weak influence of the calcium in a characteristic of the groundwater samples. The dominance of Na+, Cl and Mg.2+ further revealed the influence of seawater intrusion in a groundwater characteristic which also coincide with previous studies [14, 28, 29, 44]

Table 5 Loading factors of groundwater parameters

Physical chemical parameters were further ploted using biplot between results from PCI and PC2. Results indicated that three main groups were formed including a group of PO43−, SO42−, NO3, CO32− and TA, the second group comprised of Ca2+, Mg2+, EC and TDS while the third group had pH and Turbidity (TB) as shown in Fig. 5. Fluoride forms another independent group showing not to be associated with other parameters. Groundwater in Dar es Salaam, geologically have no fluoride content [24]. Parameters in the same component/group indicates the possible common potential sources [23, 42].

Fig. 5
figure 5

Biplot between PCI and PC2 among pysical chemical parameers analyzed in groundwater

The physicochemical nature of a groundwater in Kigamboni was further evaluated using the Piper diagram as shown in Fig. 6. The cation triangle shows the samples were enriched primarily in potassium (K+) and sodium (Na+) ions. The anion triangle indicates chloride (Cl) and carbonate were the predominant anions, with negligible sulfate concentrations. he diamond-shaped field reveals the overall groundwater chemistry is dominated by chloride of sodium and potassium. This composition, enriched in Na+, K+, CO32−, and Cl ions, is consistent with groundwater chemistry observed in other coastal regions [12, 23, 42]. This further suggest the chemistry of groundwater in Kigamboni is mostly a mixture of Na+, K+, and CO32−, Cl which coincide with a study done along coastal region [28, 29].

Fig. 6
figure 6

Piper diagram of groundwater in Kigamboni

3.9 Hierarchical Cluster Analysis of the Groundwater Samples

Figure 7 depicts the variables obtained from hierarchical cluster analysis (HCA) and how they relate to the groundwater quality in the study area. HCA was attained for water quality metrics in a study area by using a multivariate analysis of the parametric data. The HCA uses distance measurements between objects to cluster parameters and identify them. The metrics selected determine the geometry of the cluster that is generated [7]. This is due to the fact that clusters that are close together are associated in one way or another. High similarity objects are clustered into one cluster, whilst low similarity objects are in different clusters [7, 42].

Fig. 7
figure 7

Dendrogram diagram of groundwater variables

Five clusters of the physicochemical parameters were revealed in the study area at the distance of 0.25. The first cluster comprises of TB and pH, both of these were not correlated to any of the other parameters in a Pearson correlation, similar in a PCA, TB and pH appeared significant in PC-3. The second cluster included the groundwater sources characterized by three ions, K+, Na+ and NO3; the K+ and Na+ being more similar revealing their common source in the groundwater. The third Cluster contains six ions dominated by hardness. This cluster is composed with ions of Ca+, Mg2+, TH, Cl, EC and TDS more similar to the PC-1 of the principal component. Another cluster (Cluster 4) is defined by higher concentrations of anions of SO42−, CO32−, and HCO3. The last group of groundwater sources comprises of fluoride and phosphorous. However, viewing the clusters at 0.75 distance, only three major clusters were formed compared to those clusters at a closer distance of 0.25 signifying that the quality of groundwater across the study area are related [23].

4 Conclusion

Findings of this study indicated that groundwater quality is characterized by hard and very hard water with major ions in the order of Na+ > Ca2+ > Mg2+ > K+ and anions in the order of Cl > CO32− > HCO3 > SO42−. Water quality index indicated that the quality of groundwater in the study area is categorized to be suitable for drinking purposes accounting for 56% of all sampled wells and 44% had a poor to unsuitable quality for drinking, while the Wilcox diagram classified 88% of all sampled boreholes to be suitable for irrigation and only 12% are not suitable for irrigation purposes. HCA revealed that at 0.75 distance only three groups of ions were formed indicating that groundwater quality in the study area exhibits similar characteristics. Boreholes that are of poor quality for drinking (44%) and irrigation (12%) should be used with caution after household treatment. This underscores the need for stakeholders to be involved in implementing groundwater treatment before consumption and selecting crops that are salt-tolerant in the area.

This study provides essential baseline data on a poorly studied region. It uses a rigorous analytical approach to generate useful recommendations for ensuring safe water supplies in this vulnerable coastal community. However, because this was an observational study, it was not possible to identify the causal factors that affect groundwater quality. Without further research, the findings may not be applicable to other coastal cities. Additionally, the sampling was only conducted during the dry season, and collecting samples throughout the year could reveal more about temporal variations.