Fuzzy Package

Submodules

fuzzy.categories module

The module contains classes specified in the RCG divided into categories.

class rcg.fuzzy.categories.Catchments[source]

Bases: object

The Catchments class represents different types of catchment categories that can be found within a catchment area.

Attributes:
  • urban (str): Urban catchment type.

  • suburban (str): Suburban catchment type.

  • rural (str): Rural catchment type.

  • forests (str): Forest catchment type.

  • meadows (str): Meadow catchment type.

  • arable (str): Arable catchment type.

  • mountains (str): Mountain catchment type.

get_all_categories() List[str][source]

Returns a list of all available catchment types in the Catchments object.

Returns:
  • List[str]: A list of strings representing all catchment types.

class rcg.fuzzy.categories.Categories[source]

Bases: ABC

Categories is an abstract base class that defines the interface for a category.

class rcg.fuzzy.categories.Impervious[source]

Bases: object

Impervious is a class representing various categories of land impervious types.

Attributes:
  • marshes (str): Marsh land impervious type.

  • arable (str): Arable land impervious type.

  • meadows (str): Meadow land impervious type.

  • forests (str): Forest land impervious type.

  • rural (str): Rural land impervious type.

  • suburban (str): Suburban land impervious type.

  • urban (str): Urban land impervious type.

  • mountains (str): Mountain land impervious type.

  • hilly (str): Hilly land impervious type.

get_all_categories() List[str][source]

Returns a dictionary containing all impervious type attributes as key-value pairs.

Returns:
  • List[str]: A list of strings representing all Impervious types.

class rcg.fuzzy.categories.LandCover[source]

Bases: object

LandCover is a class representing various categories of land cover types.

Class attributes are used for returning numeric values for the fuzzy engine, while attributes defined in the __init__ method return string values for each land cover type.

Class Attributes:
  • medium_conditions (int): Numeric value for medium conditions land cover type.

  • permeable_areas (int): Numeric value for permeable areas land cover type.

  • permeable_terrain_on_plains (int): Numeric value for permeable terrain on plains land cover type.

  • hilly (int): Numeric value for hilly land cover type.

  • mountains (int): Numeric value for mountains land cover type.

  • bare_rocky_slopes (int): Numeric value for bare rocky slopes land cover type.

  • urban (int): Numeric value for urban land cover type.

  • suburban (int): Numeric value for suburban land cover type.

  • rural (int): Numeric value for rural land cover type.

  • forests (int): Numeric value for forests land cover type.

  • meadows (int): Numeric value for meadows land cover type.

  • arable (int): Numeric value for arable land cover type.

  • marshes (int): Numeric value for marshes land cover type.

Attributes:
  • medium_conditions (str): Medium conditions land cover type.

  • permeable_areas (str): Permeable areas land cover type.

  • permeable_terrain_on_plains (str): Permeable terrain on plains land cover type.

  • hilly (str): Hilly land cover type.

  • mountains (str): Mountains land cover type.

  • bare_rocky_slopes (str): Bare rocky slopes land cover type.

  • urban (str): Urban land cover type.

  • suburban (str): Suburban land cover type.

  • rural (str): Rural land cover type.

  • forests (str): Forests land cover type.

  • meadows (str): Meadows land cover type.

  • arable (str): Arable land cover type.

  • marshes (str): Marshes land cover type.

arable = 12
bare_rocky_slopes = 6
forests = 10
get_all_categories() List[str][source]

Returns a list of all land cover types.

Returns:
  • List[str]: A list of strings representing all land cover types.

hilly = 4
marshes = 13
meadows = 11
medium_conditions = 1
mountains = 5
permeable_areas = 2
permeable_terrain_on_plains = 3
rural = 9
suburban = 8
urban = 7
class rcg.fuzzy.categories.LandForm[source]

Bases: object

LandForm is a class representing various categories of land use types.

Enum Attributes:
  • marshes_and_lowlands (int): Numeric value for marshes and lowlands land use type.

  • flats_and_plateaus (int): Numeric value for flats and plateaus land use type.

  • flats_and_plateaus_in_combination_with_hills (int): Numeric value for flats and plateaus in combination with hills land use type.

  • hills_with_gentle_slopes (int): Numeric value for hills with gentle slopes land use type.

  • steeper_hills_and_foothills (int): Numeric value for steeper hills and foothills land use type.

  • hills_and_outcrops_of_mountain_ranges (int): Numeric value for hills and outcrops of mountain ranges land use type.

  • higher_hills (int): Numeric value for higher hills land use type.

  • mountains (int): Numeric value for mountains land use type.

  • highest_mountains (int): Numeric value for highest mountains land use type.

flats_and_plateaus = 2
flats_and_plateaus_in_combination_with_hills = 3
get_all_categories() List[str][source]

Returns a list of all land form types.

Returns:
  • List[str]: A list of strings representing all land form types.

higher_hills = 7
highest_mountains = 9
hills_and_outcrops_of_mountain_ranges = 6
hills_with_gentle_slopes = 4
marshes_and_lowlands = 1
mountains = 8
steeper_hills_and_foothills = 5
class rcg.fuzzy.categories.Slope[source]

Bases: object

Slope is a class representing various categories of land slope types.

Attributes:
  • marshes_and_lowlands (str): Marshes and lowlands land slope type.

  • flats_and_plateaus (str): Flats and plateaus land slope type.

  • flats_and_plateaus_in_combination_with_hills (str): Flats and plateaus in combination with hills land slope type.

  • hills_with_gentle_slopes (str): Hills with gentle slopes land slope type.

  • steeper_hills_and_foothills (str): Steeper hills and foothills land slope type.

  • hills_and_outcrops_of_mountain_ranges (str): Hills and outcrops of mountain ranges land slope type.

  • higher_hills (str): Higher hills land slope type.

  • mountains (str): Mountains land slope type.

  • highest_mountains (str): Highest mountains land slope type.

get_all_categories() List[str][source]

Returns a list of all land slope types.

Returns:
  • List[str]: A list of strings representing all land slope types.

fuzzy.memberships module

The module contains a class with specified fuzzy set membership limits.

class rcg.fuzzy.memberships.Memberships[source]

Bases: object

Memberships is a class that defines fuzzy membership functions for land use types, land cover types, slope, imperviousness, and catchment.

populate_catchment() None[source]

Populate catchment with membership functions.

populate_impervious() None[source]

Populate impervious with membership functions.

populate_land_form() None[source]

Populate land form type with membership functions.

populate_land_use()[source]

Populate land use type with membership functions.

populate_slope() None[source]

Populate slope with membership functions.

fuzzy.rules module

The module contains a class with specific rules for class members and the consequences of their combinations.

class rcg.fuzzy.rules.CatchmentsRule[source]

Bases: RulesSet

CatchmentsRule is a class representing a set of consequences for all slope combinations.

class rcg.fuzzy.rules.ImperviousRule[source]

Bases: RulesSet

ImperviousRule is a class representing a set of consequences for all slope combinations.

class rcg.fuzzy.rules.RulesSet[source]

Bases: object

RulesSet is a class representing a set of rules for all antecedent combinations.

class rcg.fuzzy.rules.SlopeRule[source]

Bases: RulesSet

SlopeRule is a class representing a set of consequences for all slope combinations.

fuzzy.engine module

class rcg.fuzzy.engine.FuzzyEngine[source]

Bases: object

FuzzyEngine returns the result of calculating the slope, impervious, and catchment values.

class rcg.fuzzy.engine.Prototype(land_form: LandForm, land_cover: LandCover)[source]

Bases: object

Prototype is a class that calculates the slope, impervious, and catchment values based on given land form and land cover categories using fuzzy logic rules defined in rules.py.

static get_populate(result: float, member: ~rcg.fuzzy.memberships.Memberships = Consequent: catchment)[source]

Returns the linguistic variable of the given member category based on the result.

Parameters

resultfloat

The result of the fuzzy logic calculation.

membermembership, optional

Membership category to be used, by default membership.catchment.

Returns

str

Linguistic variable of the member category.

Module contents