Skip to main content

River water quality index for Morocco using a fuzzy inference system



The aim of this work is to propose a new river water quality index using fuzzy logic. The proposed fuzzy index combines quality indicators’ prescribed thresholds extracted mainly from the Moroccan and the Quebec water legislations. The latter is reputed for its strict water quality assessment. The proposed index combines six indicators, and not only does it exhibit a tool that accounts for the discrepancy between the two base indices, but also provides a quantifiable score for the determined water quality. These classifications with a membership grade can be of a sound support for decision-making, and can help assign each section of a river a gradual quality sub-objective to be reached.


To demonstrate the applicability of the proposed approach, the new index was used to classify water quality in a number of stations along the basins of Bouregreg-Chaouia and Zizi-Rhéris. The obtained classifications were then compared to the conventional physicochemical water quality index currently in use in Morocco. The results revealed that the fuzzy index provided stringent classifications compared to the conventional index in 41% and 33% of the cases for the two basins respectively. These noted exceptions are mainly due to the big disparities between the different quality thresholds in the two standards, especially for fecal coliform and total phosphorus.


These large disparities put forward an argument for the Moroccan water quality legislation to be upgraded to align water and environmental assessment methods with other countries in order to mitigate the risks of failing to achieve a good ecological status.


Water quality indices aim at turning several complex indicators into a single synthesized value that describes the water quality of a particular source, and which is understandable by a wide audience including non-experts like the public or decision and policy-makers. There exist a number of water quality indices based on different indicators and aggregation methods used today throughout the world, such as the U.S. National Sanitation Foundation Water Quality Index (NSFWQI); the Canadian Council of Ministers of the Environment Water Quality Index (CCMEWQI); the British Columbia Water Quality Index (BCWQI), and the Oregon Water Quality Index (OWQI).

A general flaw with conventional water quality indices is that they depend on human expertise with subjective and ambiguous information, which might raise a number of issues in water quality assessment. Another major problem is that quality indicator concentrations, no matter how far from or close to the limits have the same impact on the final score and might fall within the same classes (Icaga [2007]). To deal with ambiguity and uncertainties, fuzzy logic, which was first introduced by (Zadeh [1965]) is commonly used as a powerful formalism in environmental evaluation and assessment such as in water or air pollution issues. Ecological impact classification and environmental decision-making using fuzzy logic are discussed in detail by (Shepard [2005]; Silvert [1997], [2000]). According to the authors, using fuzzy logic is very convenient in the assessment of environmental issues because it can solve properly the ambiguities and subjectivity inherent in these problems. It also helps conciliating conflicting observations due to human expertise, and last but not least, it can provide decision-makers with the ability to make well-informed decisions that are technically sound and legally defensible. Moreover, with fuzzy logic one can describe water quality in a location as being 10% excellent and 90% just good, which is not possible with classical approaches to water quality.

Fuzzy logic has shown a good promise in modeling new water quality indices. (Lu et al. [1999]; Chang et al. [2001]) studied the feasibility of applying Fuzzy Synthetic Evaluation (FSE) to water quality. The Fuzzy Comprehensive Assessment (FCA) method was used by (Shen et al. [2005]) to investigate pollution and evaluate the soil environmental quality of the Taihu lake watershed. (Liou et al. [2003]) applied a two-stage fuzzy set theory to river quality evaluation in Taiwan. (Ocampo-Duque et al. [2006]) used fuzzy logic and a comprehensive multi-attribute decision-aiding method based on the Analytic Hierarchy Process (AHP) to estimate the relative importance of water quality indicators. A 6-step procedure to develop a fuzzy water quality index was described in (Icaga [2007]), and was applied to lake water. In another study by (Sadiq and Tesfamariam [2008]), a Weighted Averaging Operator (OWA) was used for aggregation in developing the water quality index. (Lermontov et al. [2009]; Roveda et al. [2010]) developed fuzzy water quality indices for Brazilian rivers, and compared their performance with the conventional WQIs. A different approach was carried out by (Nasiri et al. [2007]); the authors proposed a fuzzy multi-attribute decision support system to compute the water quality index and to outline the prioritization of alternative plans based on the extent of improvements in water quality. (Mahapatra et al. [2011]) used a Cascaded Fuzzy Inference System (CFS) to design a multi-input, multi-output water quality index. In a recent study, (Gharibi et al. [2012]) developed a FWQI for which the water quality indicators were practical and easy to measure, including heavy metals, and used the index to assess water quality in the Mamloo dam for drinking purposes. A different approach based on hybrid fuzzy-probability models was adopted in (Ocampo-Duque et al. [2013]; Nikoo et al. [2011]). In a recent work, (Wang et al. [2014]) used variable fuzzy set and the information entropy theory as an assessment model to evaluate water quality of the Meiliang Bay in Taihu Lake Basin in China.

The water quality in Moroccan rivers and streams is becoming more and more of a concern because of the significant amount of pollutants discharged into these ecosystems, in most cases without any treatment. Physicochemical and microbiological measurements and analyses are performed regularly by a number of public administrations. However, these analyses remain insufficient given the diversity of chemicals and the variety of pollution sources. This said; considerable efforts have been deployed recently in Morocco to improve water quality. The adoption of the “10-95” Water Law in 1995, the establishment of River Basin Management Agencies, the adoption of national plans for integrated water resource management, the adoption of a national program for sewerage and wastewater treatment in 2008, as well as the Water Strategy in 2009 are all actions in favor of better water quality outcomes. However, the application of the “10-95” texts is slow, and there is no improvement worthy to mention as yet in water quality, which remains generally degraded. In addition, the quality indicators used in analysis remain insufficient today, and pesticides intensified by the Maroc Vert plan are not taken into account. Only a simplified set of indicators that are realistic and easy to measure are actually used in the conventional index to estimate river water quality. For the other indicators (like heavy metals); the techniques used to evaluate these indicators are either complicated, time consuming, or costly, which results in discarding them from consideration in the final assessment of water quality.

Clearly, from the deficiencies cited above, there is a need to upgrade the Moroccan legislation on water quality to include a new index. Such an index must factor in the use of indicators with direct causes on human and animal health, as well as evaluation thresholds. Our approach is progressive, and consists of providing, through fuzzy logic, a new index that captures the essence of the existing one (the conventional physiochemical index designed by a Decree in 2002 and never revised since), and yet incorporates the benefits of another well standing index. This is an initial step to improve water quality assessment through enhancement of threshold values in order to account for real water pollution, the index still needs to be improved to take into consideration contamination with heavy metals. For this purpose, the overall water quality index of Quebec (IQBP) (Hébert [1997]) was chosen. The IQBP is very comparable to the Moroccan conventional water quality index, which will be referred to in the remainder of the text as (IMBP). Both IMBP and IQBP estimate water quality based on a number of physicochemical and bacteriological indicators, and provide water quality classes for multiple usages. They are also similar in terms of the evaluation method used which is based on the “minimum operator” that assigns the lowest indicator quality to the overall water quality in a given location. Moreover, the approach used to design the IQBP index relied on a group of thirty water quality experts and professionals from different horizons (chemists, biologists, managers, etc..) who have been consulted according to the Delphi method (Linstone and Turoff [1975]). However, a quick comparison between the Moroccan water quality indicator threshold values and the ones used in Quebec reveals a big disparity between the two standards.

In this work, fuzzy methodology is used to come up with a water quality index that we will be referring to as MFWQI, by combining the Moroccan and Quebec standards. Membership functions for the different water quality indicators were developed considering boundaries from both water regulatory bodies. A fuzzy inference system was used to assess water quality with a membership grade in a number of stations along the basin under study. In the aforementioned studies about fuzzy indices, the generation of membership functions is usually done based on expert opinions, and hence remains difficult to maintain or update because they require expert consultation every time. In this paper, an easy-to-use method is introduced; it facilitates the generation of suitable membership functions based on a combination of already established standards by merging water quality thresholds in an automatic way. For any given indicator, the quality threshold values are determined in both standards; trapezoidal and triangular membership functions are then derived automatically based on interval intersection and linear interpolation. Furthermore, rules are derived automatically based on the number of variables as well as the number of membership functions, and the aggregation method used. If n is the number of required input variables, each represented with m membership functions, then the total number of rules required to model the system is m^n. Our approach in this work is to automatically generate the fuzzy index with minimum need for expert involvement.

The concepts needed to model an index using fuzzy logic, including membership functions and fuzzy inference steps are described concisely in the Methods section.

Results and discussion

The results of comparison between the MFWQI and the conventional IMBP for each sampling site of the Bouregre-Chaouia basin over the period under study are illustrated in Figure 1.

Figure 1

Comparison of IMBP and MFWQI indices for the different stations of the Bouregreg-Chaouia basin.

Based on the IMBP simplified quality grid shown in Table 1, the results of the monitoring performed during four campaigns showed that 76% of the sampled surface water points had a poor to very poor quality in January-09, as compared to 23% of good to average quality. However, in July-09 the quality improved to 44% points of good to average quality as compared to 56% points of poor to very poor quality.

Table 1 Simplified rating table for the IMBP water quality indicators (Official Bulletin N°. 5062 of 5 December 2002)

Based on the MFWQI, the results showed that 88% of the sampled surface water points had a poor to very poor quality in January-09, as compared to only 12% of good to average quality. In July-09 the quality improved to 32% points of good to average quality as compared to 68% points of poor to very poor quality.

As can be seen in Figure 1, both indices showed more or less correlated results with some sensitivity to water pollution. The IMBP and MFWQI had a correlation coefficient of 0.93, demonstrating the sound applicability of the index. In spite of this, the MFWQI resulted in a more severe assessment compared to the conventional physicochemical index. Indeed, the quality class obtained with the fuzzy index was lower for 41% of the sampled sites. In other cases, the evaluations of water quality carried out by the two indices were comparable.

The results of comparison between the MFWQI and the conventional IMBP for some sampling sites of the Ziz-Rhéris basin between 2007 and 2008 are illustrated in Figure 2. The water of Oued Ziz has a good quality upstream and becomes moderately polluted downstream near urban areas, due to urban discharges. The water of Oued Rhéris has a good quality most of the time. Here again it can be seen that the quality class obtained with the fuzzy index was lower for 33% of the sampled sites. This percentage is lower in the basin of Ziz-Rhéris since the unit is less polluted compared to the basin of Bouregreg-Chaouia.

Figure 2

Comparison of IMBP and MFWQI indices for the different stations of the Ziz-Rhéris basin.

By examining the relative distribution of these results by quality classes, it is obvious that disparities between the two indices appear throughout all of the quality classes, especially in the lower ones. It can also be noticed in Figures 1 and 2 that, when conventional and fuzzy indices do not produce a similar assessment, the gap between the quality classes is usually of a single class. These differences are observed at sites where a single indicator is always problematic (fecal coliforms or total phosphorus). Given the nature of the two indices and quality thresholds used for their calculation, this is quite normal. Fecal coliforms and total phosphorus are evaluated more harshly with the IQBP. For example, if we consider fecal coliforms, the value used in the IQBP to distinguish “poor” water quality from “very poor” quality is 3500 (cfu/100 mL), while the quality criterion used in the Moroccan index is “poor” when the FC is above 20000 (cfu/100 mL). Furthermore, there is no category for “very poor” quality for this indicator in the Moroccan index. It is important to note that individuals exposed to water contaminated with fecal coliforms have a potential health risk.

Unsurprisingly, the proposed fuzzy index revealed some discrepancies between the Moroccan water quality index and the other surface water quality standards. The fuzzy index is more effective in the sense that it is more accurate in detecting water pollution because it conciliates between water quality ranges as prescribed by the two water regulatory bodies, namely the Moroccan legislation and that of Quebec, which is considered to be stricter.

Moreover, the conventional assessment of water quality based on quality thresholds prescribed by the Moroccan legislation (IMBP) gives the results in the form of qualitative classes, such as “good”, “average”, or “poor”, and therefore the information provided by the index is very limited. A weighted method was used to quantify the index and produced both a qualitative class and a score. With the fuzzy index, not only does water quality move from a linguistic description to a quantifiable representation without further computational overhead, but it produces a membership grade that shows to what strength a stream’s water quality belongs to a class (examples are shown in Table 2). This approach gives an excellent quantitative insight, which can serve as a sound basis for further decision-making. Decision makers can assign different objectives to different parts of a river depending on the membership grade. A portion of a river qualified as being roughly halfway between “good”, with a membership grade of 0.33, and “average” quality, with membership grade 0.30, can help professionals treat it differently from a portion qualified as having “average” quality with a membership grade of 1.

Table 2 Fuzzy index scores with membership grades (GoM) for different classes


In the context of the ongoing efforts aimed at improving the environment in Morocco, a new quality index for surface waters using fuzzy logic has been developed (MFWQI). An application of the index was demonstrated for surface waters in the basins of Bouregreg-Chaouia and Ziz-Rhéris. Water quality was evaluated by means of six indicators (DO, BOD5, COD, FC, TP and NH4+). The proposed index can resolve problems of uncertainty and linguistic ambiguity inherent to this particular environmental problem. Moreover, unlike the conventional index, the new fuzzy index allows the results to be interpreted quantitatively or qualitatively along with membership grades. It also allows a better analysis since experts can describe a sampling station quality status as closer to its upper or lower limit.

A comparison between the conventional index and the new fuzzy index was carried out with the objective of being able to point out the weaknesses of the conventional approach, and to propose an upgrade to Moroccan water legislation in a simple and meaningful way. The proposed index has been shown to be more rigorous because it uses quality thresholds from the Quebec IQBP index (reputed to be very stringent), but yet it conserves the expert knowledge embodied in the Moroccan IMBP index. The conventional index does not fully comply with health expert knowledge about industrial and agricultural pollution known in the area. There is a clear need to review legislation about water quality that has been revealed by the proposed fuzzy index. The conventional index does not reflect the alarming situation of water quality; which minimizes the chances of triggering enough responses or the application of existing laws to handle the situation, and hence the use of water for drinking or for agriculture from the rivers without treatment may expose the population to health risks. While it is not expected that the proposed approach will be used for water quality assessment by local authorities, the intention is to draw attention to the need for Morocco to run an adjustment exercise to align its water and environmental assessment methods with other countries in order to mitigate the risks of failing to achieve a good ecological status.

Furthermore, the conventional IMBP is a state-oriented index, which somehow fails to reflect the socio-economic pressures that result in water quality degradation depending on different geographical zones. In Europe for example, a number of efforts have been deployed to account for the different pressures exerted by the socio-economic driving forces in addressing water problems (Borja et al. [2006]). Thus, further efforts need to be taken to perform an integrated evaluation that takes into consideration socio-economic indicators besides ecological indicators.


Fuzzy logic formalism

Fuzzy logic is an extension of Boolean logic created by (Zadeh [1965]) based on the theory of fuzzy sets, which is a generalization of the classical set theory. By allowing a condition to be partly true and partly false at the same time, fuzzy logic makes it suitable to take into account any ambiguities or uncertainties. A key concept in fuzzy logic is membership functions.

Membership functions

Let X be the universe of discourse and its elements denoted by x. A fuzzy set A in the universe X is characterized by a membership function μ A  : X → [0, 1]. The fuzzy set A can be represented by the set of pairs of an element x X and its degree of membership defined by a membership function μ A (x):

A= x , A x / x X

A degree of zero means that the value is not in the set, a degree of one means that the value is totally representative of the set, and a degree confined between zero and one means the value is partially in the set. The shape of the membership function is often chosen based on the advice of an expert or by statistical studies. A Sigmoid shape, Triangular, Trapezoidal, Gaussian or any other type can be used. The concept of membership functions discussed above allows the definition of fuzzy natural language systems that make use of linguistic variables, where the universe of discourse of a variable is divided into a number of fuzzy sets with a linguistic description attributed to each one.

Fuzzy operators

In order to easily manipulate fuzzy sets, the operators of the classical set theory are adapted to the membership functions specific to fuzzy logic, strictly allowing values between 0 and 1. Typically, the extension of the union operator (OR) to fuzzy sets A and B defined over the same set X is defined as:

μ A B x =max μ A x , μ B x

Where μ A and μ B are the membership functions for A and B respectively. Similarly, the fuzzy intersection (AND) is defined by:

μ A B x =min μ A x , μ B x

Fuzzy inference rules

In fuzzy logic, if-then rules and fuzzy set operators are used to describe the relationships between input variables and output variables of a system. Fuzzy rules are a collection of linguistic statements that describe how a fuzzy inference system should make a decision regarding classifying an input or controlling an output. A fuzzy rule has one or more antecedents, usually connected by linguistic operators such as “and” or “or”. Rules are always written in the following form:


Where x and y are the input variables and z is the output variable. Ai, Bi and Ci are linguistic values for the variables x, y and z respectively.

Basic structure of a fuzzy inference system (FIS)

A fuzzy inference system (FIS) is an inference system based on fuzzy set theory, which maps input values to outputs. The fuzzy inference process involves four main steps (Ross [1995]):

  1. a)

    Fuzzification: in this step, crisp input values are mapped into linguistic variables using membership functions. This is required in order to activate rules that are in terms of linguistic variables. The fuzzifier takes input values and determines the degree to which they belong to each of the fuzzy sets via membership functions.

  2. b)

    Rule evaluation: in this step, the consequence of a fuzzy if-then rule is computed. First, the rule strength is computed by combining the fuzzified inputs. Combination of multiple conjunctive antecedents is performed using the fuzzy intersection operation. Multiple disjunctive antecedents are combined using the fuzzy union operation. Then, the rule consequent is correlated with the strength value of the rule antecedent; the most common method for rule implication is to cut the consequent membership function at the level of the antecedent truth. This method is called clipping (alpha-cut).

c) Aggregation of rule outputs: outputs for all rules are then aggregated into a single fuzzy distribution. This is usually done by using the fuzzy union of all individual rule contributions.

  1. d)

    Defuzzification: in this step, the aggregated output fuzzy set is mapped into a crisp number. Several methods are used in practice for defuzzification, including the “centroid”, “maximum”, “mean of maxima”, “height”, and “modified height”. The most popular defuzzification method is the centroid method, which calculates the center of gravity of the aggregated fuzzy set:

    COG= a b μ A x xdx÷ a b μ A x dx

Development of the Moroccan fuzzy water quality index

The Moroccan conventional index (IMBP)

The assessment of surface water quality in Morocco is performed using the water quality index IMBP defined by water legislation (Official Bulletin N°. 5062 of 5 December 2002). The IMBP suggests recommended water quality using a number of physicochemical and bacteriological indicators, and aggregates them to produce a single quality class depending on a given usage such as fish life, irrigation, industrial uses, cooling, or raw water supply intended for drinking.

The IMBP index consists of six indicators: dissolved oxygen (DO), biological oxygen demand during five days (BOD5), chemical oxygen demand (COD), ammonium (NH4+), fecal coliforms (FC) and total phosphorus (TP). The simplified rating grid of surface waters shown in Table 1 establishes five dominant classes according to the utilization goals for which the water is intended. Each class is defined by a set of threshold values that the different physicochemical or bacteriological indicators, which are particularly important, must not exceed.

The IMBP index applies the concept of the lowest score, i.e., the “minimum operator” is used to produce the final index score. The approach dictates that the water quality in a sample corresponds to that of the indicator producing the lowest sub-index as computed for every indicator using threshold values determined by Table 1.

IMBP=minimum DO sub index , BOD 5 sub index , COD sub index , NH 4 + sub index , FC sub index , TP sub index

For example, if all the indicators have values corresponding to the “excellent” class, except one, which falls into the “average” class, the IMBP will assign the water body to the “average” class.

Preliminary indications show that the “minimum operator” approach is a more useful aggregation method than additive and multiplicative techniques. (Smith [1990]) showed that most indices based on additive or multiplicative approaches were insensitive; i.e., they were little influenced by the poor quality associated with one or two descriptors because of the aggregation method used. Another advantage of this approach is that the index ensures that a certain number of basic indicators are assessed clearly before an overall classification is assigned to a given water body. The rationale behind the method is that it is very important to understand and specify the type of water pollution and the element that resulted in water quality alteration, in order to establish a clear diagnosis and identify the water quality problem.

Since the IMBP produces only qualitative classes such as “excellent” or “poor”, a quantification method is adopted in order to obtain a quantitative value that can be easily compared to the crisp scores produced by the fuzzy index. To quantify the different classes, the values of the ranges set by the quality thresholds to evaluate water quality are transformed into dimensionless numbers ranging from 0 (for extremely poor water quality) to 100 (for absolutely excellent water quality).

The sub-index of a given indicator is elaborated by weighting, which means the index is obtained by producing a value that is proportional to its real position in a class range. The formula for calculating the weighted index (IP) is shown by Eq. 5.

IPpa=li+ ls li / bs bi bs pa


  • IPpa: the weighted index for indicator pa

  • li: the lower index

  • ls: the upper index

  • bi: the lower bound

  • bs: the upper bound

  • pa: the analyzed indicator value

The following example shows how to calculate the weighted index for BOD5 with value 3.5 mg/l. As shown in Table 1, the value 3.5 is between 3 and 5; and therefore it belongs to the “good” class. Thus, the lower bound bi is 3, the upper bound bs is 5, the lower index li is 60 and the upper index ls is 80. Hence IP BOD5 is 75.

The Quebec water quality index (IQBP)

In the late 1990s, the Quebec Department of Environment developed a bacteriological and physicochemical water quality index (IQBP) for representing water quality throughout its river network. Based on this index, water bodies are grouped into five classes according to all the potential uses.

To classify a water body, water quality is examined using ten indicators, namely: total phosphorus (TP), fecal coliforms (FC), ammonium (NH4+), nitrates (NO3)/nitrites (HNO2), total chlorophyll a (Cha), dissolved oxygen percentage (%O2), biological oxygen demand in five days (BOD5), suspended solids (SS), turbidity (TU) and pH. Table 3 presents the criteria used to assign one of the five classes to a water body.

Table 3 Class boundaries of water quality for some indicators used in the IQBP (Hébert[1997])

The IQBP requires, for each indicator analyzed, the transformation of measured concentrations into a sub-index, with a rating curve for assessing the water quality. Like the Moroccan index, the IQBP is a downgrading type index; that is to say, for a given sample, the index value corresponds to the lowest sub-index associated with the most problematic substance.

It can be noticed from the rating grids (Table 1 and Table 3) that there are differences in quality ranges between the Moroccan and Quebec standards. These differences exhibit tougher quality thresholds in the IQBP for all water indicators in common between the two standards, especially for fecal coliform and total phosphorus.

One problem with this type of highly subjective water quality assessment rendered by both the IMBP and IQBP is that the final index does not take into consideration the uncertainty about acceptable threshold values for each indicator. In the next section an alternative to the IMBP index based on fuzzy logic is proposed with more relevance to the type of uncertainties involved in this particular problem.

Building a fuzzy water quality index for Morocco (MFWQI)

In order to combine the benefits from the two standards discussed above, fuzzy methodology is used to propose a new water quality index by conciliating quality thresholds from the Moroccan and Quebec legislations. Membership functions for the different water quality indicators were developed considering boundaries from both water regulatory bodies. A fuzzy inference system was designed and built to classify water quality with a membership grade. The components of the fuzzy inference system are depicted in Figure 3.

Figure 3

The different components of the fuzzy water quality index inference system.

The method used to generate membership functions is very simple. Having two pieces of intervals about the same water quality class, these two pieces of information are fused. It can be concluded that the actual value belongs to the intersection of these intervals. If I and J respectively denote the quality ranges for a given class of water quality in the Moroccan standard and the Quebec one, then I ∩ J is considered as the interval where certainty is the highest, corresponding to a degree of membership equal to 1. Then, a linear interpolation is used for the remaining points not belonging to the intersection by linking the lower and upper bounds of both I and J to the intersection interval, which results in a trapezoidal shape. In cases where the intersection results in a single point, the shape is triangular.

For example, for FC to be considered as “good”, FC measurements must fall within [201, 1000] and [20, 2000] for IQBP and IMBP respectively. For the purpose of our fuzzy index, a trapezoidal membership function for the term “good” corresponding to the indicator FC is developed from these two intervals according to Eq. 6.

μ A x = 0 , x < 20 or x > 2000 x 20 200 20 , 20 x 200 1 , 200 x 1000 2000 x 2000 1000 , 1000 x 2000

Similarly, BOD5 is considered “good” when BOD5 measurements fall within intervals [1.8, 3] and [3, 5] for IQBP and IMBP respectively. The intersection of these intervals results in a single point, hence the shape of the membership function “good” for the variable BOD5 is triangular as shown by Eq. 7.

μ A x = 0 , x < 1.8 or x > 5 x 1.8 3 1.8 , 1.8 x 3 5 x 5 3 , 3 x 5

Overall, five fuzzy sets, which are “excellent”, “good”, “average”, “poor”, and “very poor” have been considered for this study for both input indicators and for the output water quality index.

Depending on the overlap between quality thresholds in the two standards, trapezoidal and triangular membership functions were derived from the parameters as shown in Table 4. Membership curves for input indicators and MFWQI are shown in Figure 4.

Table 4 Parameters for membership functions of the different indicators used in the MFWQI
Figure 4

Membership functions for DO, BOD5, COD, FC, NH4+, TP and MFWQI.

Using the different fuzzy sets of the considered indicators, if-then rules were then generated automatically. Initially, since the inference methodology used relates the relevant subsets of each input universal set to the subsets of the other system inputs through an intersection-rule configuration, a total number of 5^6 rules were generated, representing the model of the water quality assessment system from the set of 6 input indicators and their possible 5 classes. However, as the inference is based on the minimum sub-index, an optimization could be made using a disjunction of inputs by means of the “OR” operator: the MFWQI is considered “very poor” if one of the indicators is “very poor”, and hence the rule used for all possible combinations in that case is Rule#3 as shown below. This optimization reduced the number of rules to 4097.

The examples below show three rules for “good”, “poor”, and “very poor” water quality respectively:

Rule #1: If (DO is excellent) and (BOD5 is excellent) and (COD is excellent) and (NH4+ is excellent) and (TP is excellent) and (FC is good) then (MFWQI is good)

Rule #2: If (DO is excellent) and (BOD5 is good) and (COD is average) and (NH4+ is poor) and (TP is good) and (FC is excellent) then (MFWQI is poor)

Rule #3: If (DO is very poor) or (BOD5 is very poor) or (COD is very poor) or (NH4+ is very poor) or (TP is very poor) or (FC is very poor) then (MFWQI is very poor)

In this work, the (Mamdani [1974]) approach was used to build the MFWQI fuzzy inference engine. This approach is known for its simple structure and Max–Min inference. The implication method used is the “min” and the aggregation method is “max”. The defuzzification method used to determine the output is the center of gravity (COG) as expressed in Eq. (4). The computational tool used in modeling the overall system is the Matlab Fuzzy Logic Toolbox package 7.6.

Study area

In order to assess the proposed fuzzy index, a case study of water quality was performed using measured environmental data on each sampling site of the monitoring network of the Bouregreg-Chaouia basin collected during two primary campaigns in December-08 and April-09, and two more full campaigns that took place in January-09 and July-09 on its primary and secondary surface water networks. The total number of analyses performed over the study period for surface waters was up to 979. We also conducted a secondary case study on a less polluted area namely the basin Ziz-Rhéris during the period 2007–2008. All measurements were conducted according to standard methods.


The basin of Bouregreg-Chaouia (ABHBC [2000]) extends over a surface of 20.470 km2; that is to say nearly 3% of the national territory. Structurally, it is composed of the three following areas: 1) the basin of Bouregreg: which is the most important one; 2) the basin of Coastal rivers between Bouregreg and Oum Er Rbia. The main rivers are Owed Yquem, Cherrat, Nfefikh and Mellah, which flow into the Atlantic Ocean between Rabat and Casablanca; 3) and the Chaouia Plain.

The water quality monitoring network in the basin of Bouregreg-Chaouia was introduced in 1991. It tracks the quality status of surface water and groundwater in the region. It consists of 20 sampling stations, distributed as follows: 1) the primary network, tracked four times a year, and which contains three hydrological stations: Tsalat Grou, Lalla Chafia on Oued Bouregreg and Ras El Oued on Fathia Aguenour; 2) the secondary network, tracked twice a year, consists of fourteen sampling points. The monitoring network is depicted on the map in Figure 5, where the surface water stations are shown in triangles.

Figure 5

Location of the Bouregreg-Chaouia sampling stations, surface water stations are shown in triangles.


The basin Ziz-Rhéris corresponds to watersheds of the Ziz and Rhéris oueds. The unit extends over a surface of 24.900 km2. The region is bounded on the north by the Moulouya Basin, to the north west by the basin of Oum-Rbia, to the west by the pool Draa, on the east by the watershed Guir and south by Algeria. This unit is located largely in the province of Errachidia, only the top Todgha upstream Tinjdad is part of the province of Ouarzazate.


  1. Agence du Bassin Hydraulique du Bouregreg et de la Chaouia. 2000.

  2. Borja Á, Galparsoro I, Solaun O, Muxika I, Tello EM, Uriarte A, Valencia V: The European Water Framework Directive and the DPSIR, a methodological approach to assess the risk of failing to achieve good ecological status. Estuar Coast Shelf Sci 2006,66(1–2):84–96. 10.1016/j.ecss.2005.07.021

    Article  Google Scholar 

  3. Chang N-B, Chen HW, Ning SK: Identification of river water quality using the Fuzzy Synthetic Evaluation approach. J Environ Manage 2001,63(3):293–305. 10.1006/jema.2001.0483

    Article  Google Scholar 

  4. Gharibi H, Mahvi AH, Nabizadeh R, Arabalibeik H, Yunesian M, Sowlat MH: A novel approach in water quality assessment based on fuzzy logic. J Environ Manage 2012, 112: 87–95. 10.1016/j.jenvman.2012.07.007

    Article  Google Scholar 

  5. Hébert S: Développement d’un indice de la qualité bactériologique et physico-chimique de l’eau pour les rivières du Québec, Québec. Ministère de l’Environnement et de la Faune, Direction des écosystèmes aquatiques, Quebec; 1997.

    Google Scholar 

  6. Icaga Y: Fuzzy evaluation of water quality classification. Ecol Indic 2007,7(3):710–718. 10.1016/j.ecolind.2006.08.002

    Article  Google Scholar 

  7. Lermontov A, Yokoyama L, Lermontov M, Machado MAS: River quality analysis using fuzzy water quality index: Ribeira do Iguape river watershed, Brazil. Ecol Indic 2009,9(6):1188–1197. 10.1016/j.ecolind.2009.02.006

    Article  Google Scholar 

  8. Linstone HA, Turoff M: The Delphi method: techniques and applications. Addison-Wesley Pub. Co., Advanced Book Program, Boston, USA; 1975.

    Google Scholar 

  9. Liou S-M, Lo S-L, Hu C-Y: Application of two-stage fuzzy set theory to river quality evaluation in Taiwan. Water Res 2003,37(6):1406–1416. 10.1016/S0043-1354(02)00479-7

    Article  Google Scholar 

  10. Lu RS, Lo SL, Hu JY: Analysis of reservoir water quality using fuzzy synthetic evaluation. Stoch Env Res Risk A 1999,13(5):327–336. 10.1007/s004770050054

    Article  Google Scholar 

  11. Mahapatra SS, Nanda SK, Panigrahy BK: A Cascaded Fuzzy Inference System for Indian river water quality prediction. Adv Eng Softw 2011,42(10):787–796. 10.1016/j.advengsoft.2011.05.018

    Article  Google Scholar 

  12. Mamdani EH: Application of fuzzy algorithms for control of simple dynamic plant. Proc Inst Elec Eng 1974, 121: 1585–1588. 10.1049/piee.1974.0328

    Article  Google Scholar 

  13. Nasiri F, Maqsood I, Huang G, Fuller N: Water Quality Index: A Fuzzy River-Pollution Decision Support Expert System. J Water Resour Plann Manag 2007,133(2):95–105. doi:10.1061/(ASCE)0733–9496(2007)133:2(95) doi:10.1061/(ASCE)0733-9496(2007)133:2(95) 10.1061/(ASCE)0733-9496(2007)133:2(95)

    Article  Google Scholar 

  14. Nikoo M, Kerachian R, Malakpour-Estalaki S, Bashi-Azghadi S, Azimi-Ghadikolaee M: A probabilistic water quality index for river water quality assessment: a case study. Environ Monit Assess 2011,181(1–4):465–478. doi:10.1007/s10661–010–1842–4 doi:10.1007/s10661-010-1842-4 10.1007/s10661-010-1842-4

    Article  Google Scholar 

  15. Ocampo-Duque W, Ferré-Huguet N, Domingo JL, Schuhmacher M: Assessing water quality in rivers with fuzzy inference systems: A case study. Environ Int 2006,32(6):733–742. 10.1016/j.envint.2006.03.009

    Article  Google Scholar 

  16. Ocampo-Duque W, Osorio C, Piamba C, Schuhmacher M, Domingo JL: Water quality analysis in rivers with non-parametric probability distributions and fuzzy inference systems: Application to the Cauca River, Colombia. Environ Int 2013, 52: 17–28. 10.1016/j.envint.2012.11.007

    Article  Google Scholar 

  17. Ross TJ: Fuzzy Logic with Engineering Applications. McGraw-Hill, New York, USA; 1995.

    Google Scholar 

  18. Roveda SRMM, Bondança APM, Silva JGS, Roveda JAF, Rosa AH: Development of a water quality index using a fuzzy logic: A case study for the Sorocaba river. 2010 IEEE International Conference on Fuzzy Systems (FUZZ) 2010.

    Google Scholar 

  19. Sadiq R, Tesfamariam S: Developing environmental indices using fuzzy numbers ordered weighted averaging (FN-OWA) operators. Stoch Environ Res Risk Assess 2008,22(4):495–505. 10.1007/s00477-007-0151-0

    Article  Google Scholar 

  20. Shen G, Lu Y, Wang M, Sun Y: Status and fuzzy comprehensive assessment of combined heavy metal and organo-chlorine pesticide pollution in the Taihu Lake region of China. J Environ Manage 2005,76(4):355–362. 10.1016/j.jenvman.2005.02.011

    Article  Google Scholar 

  21. Shepard RB: Quantifying Environmental Impact Assessments Using Fuzzy Logic. Springer, USA; 2005.

    Google Scholar 

  22. Silvert W: Ecological impact classification with fuzzy sets. Ecol Model 1997,96(1–3):1–10. 10.1016/S0304-3800(96)00051-8

    Article  Google Scholar 

  23. Silvert W: Fuzzy indices of environmental conditions. Ecol Model 2000,130(1–3):111–119. 10.1016/S0304-3800(00)00204-0

    Article  Google Scholar 

  24. Smith DG: A better water quality indexing system for rivers and streams. Water Res 1990,24(10):1237–1244. 10.1016/0043-1354(90)90047-A

    Article  Google Scholar 

  25. Wang Y, Sheng D, Wang D, Ma H, Wu J, Xu F: Variable fuzzy set theory to assess water quality of the meiliang bay in taihu lake basin. Water Resour Manag 2014,28(3):867–880. 10.1007/s11269-014-0521-6

    Article  Google Scholar 

  26. Zadeh LA: Fuzzy sets. Inform Control 1965, 8: 338–353. 10.1016/S0019-9958(65)90241-X

    Article  Google Scholar 

Download references


The authors would like to express their deep gratitude to the environmentalists who provided water data used in this study besides reports about the state of water quality in the area of the Hydraulic Basin of Bouregreg-Chaouia and Ziz-Rhéis.

Author information



Corresponding author

Correspondence to Asmaa Mourhir.

Additional information

Competing interests

The authors declare that they have no competing interests.

Authors’ contributions

AM designed the study, conducted data analysis and wrote the manuscript. TR revised critically and helped editing and polishing the paper. All authors have read and approved the final manuscript.

Authors’ original submitted files for images

Rights and permissions

Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (, which permits use, duplication, adaptation, distribution, and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Mourhir, A., Rachidi, T. & Karim, M. River water quality index for Morocco using a fuzzy inference system. Environ Syst Res 3, 21 (2014).

Download citation


  • Water quality index
  • Surface water
  • Fuzzy logic
  • Bouregreg-chaouia basin
  • Zizi-rhéris basin