Breaking News

USCS Soil Classification by Python


USCS (Unified Soil Classification System) is one the most used soil identification system in the world. The basic concept of the USCS is that coarse-grained soils can be classified according to their grain sizes and grain size distributions. Casagrande developed this soil classification system U.S. Army Corps of Engineers. Later this system is modified for overall use.


In this program, soil can be easily classified using the parameters for the USCS input fields.

"""Made By Arafat"""
"""
This Program is to detect the soil type of a soil according to
USCS (Unified Soil Classification System).
"""
"""
You may get double results; one for coarse grained soil and
another for fine grained soil.
"""

SoilPass = float(input("Enter the % passing through the No. 4 sieve: "))
#Soil is identified as Passing through the sieve no #4(4.75 mm)
FineSoilPass = float(input("Enter the % passing through the No. 200 sieve: "))
#Fine Soil is identified as Passing through the sieve no #4(4.75 mm)
D10 = float(input("Enter the effective size of particles corresponding to 10%, D10: "))
D30 = float(input("Enter the effective size of particles corresponding to 30%, D30: "))
D60 = float(input("Enter the effective size of particles corresponding to 60%, D60: "))
LL = float(input("Enter the Liquid Limit, LL: "))
#Liquid Limit of Soil
PL = float(input("Enter the Plastic Limit, PL: "))
#PLastic Limit of Soil
GravelContent = 100 - SoilPass
SandContent = 100 - FineSoilPass - GravelContent
OrganicCon = input("Is it Organic or Inorganic Soi?Type(O/I): ")

LLOvenDried = float(input("Enther the Liquid limit at Oven-dry condition : "))
LLNotDried = float(input("Enther the Liquid limit at Non-dry condition : "))
GravelFraction = 100 - SoilPass
CoarseSoil = 100 - FineSoilPass
Cu = D60/ D10
#Uniformity Coefficient
Cc = (D30 * D30)/ (D60 * D10)
#Coefficient of Curvature
PI = LL - PL
AL = 0.73*(LL-20)
#AL: A line in the Casagrande Plasticity Chart


if GravelContent > SandContent :
if FineSoilPass < 5 :
if Cu >= 4 and 1 <= Cc <= 3 :
if SandContent < 15 :
print("Soil Symbol: GW \n Group Name: Well Graded Gravel")
elif SandContent >= 15 :
print("Soil Symbol: GW \n Group Name: Well Graded Gravel with Sand")
elif Cu < 4 or 1 > Cc > 3 :
if SandContent < 15:
print("Soil Symbol: GP \n Group Name: Poorly Graded Gravel")
elif SandContent >= 15:
print("Soil Symbol: GP \n Group Name: Poorly Graded Gravel with Sand")

elif 5 < FineSoilPass < 12 :
if Cu >= 4 and 1 <= Cc <= 3:
FineType = input("Enter the type of Fine Soil(ML/MH/CL/CH/CL-ML): ")
if FineType == "ML" or FineType == "MH" :
if SandContent < 15:
print("Soil Symbol: GW-GM \n "
"Group Name: Well Graded Gravel with Silt")
elif SandContent >= 15:
print("Soil Symbol: GW-GM \n "
"Group Name: Well Graded Gravel with Silt and Sand")
elif FineType == "CL" or FineType == "CH" or FineType == "CL-ML":
if SandContent < 15:
print("Soil Symbol: GW-GC \n "
"Group Name: Well Graded Gravel with Clay")
elif SandContent >= 15:
print("Soil Symbol: GW-GC \n "
"Group Name: Well Graded Gravel with Clay and Sand")

elif Cu < 4 or 1 > Cc > 3:
FineType = input("Enter the type of Fine Soil(ML/MH/CL/CH/CL-ML): ")
if FineType == "ML" or FineType == "MH" :
if SandContent < 15:
print("Soil Symbol: GP-GM \n "
"Group Name: Poorly Graded Gravel with Silt")
elif SandContent >= 15:
print("Soil Symbol: GP-GM \n "
"Group Name: Poorly Graded Gravel with Silt and Sand")
elif FineType == "CL" or FineType == "CH" or FineType == "CL-ML" :
if SandContent < 15:
print("Soil Symbol: GP-GC \n "
"Group Name: Poorly Graded Gravel with Clay")
elif SandContent >= 15:
print("Soil Symbol: GP-GC \n "
"roup Name: Poorly Graded Gravel with Clay and Sand")

elif FineSoilPass > 12:
FineType = input("Enter the type of Fine Soil(ML/MH/CL/CH/CL-ML): ")
if FineType == "ML" or FineType == "MH":
if SandContent < 15:
print("Soil Symbol: GM \n Group Name: Silty Gravel")
elif SandContent >= 15:
print("Soil Symbol: GM \n Group Name: Silty Gravel with Silt Sand")
elif FineType == "CL" or FineType == "CH" :
if SandContent < 15:
print("Soil Symbol: GC \n Group Name: Clayey Gravel")
elif SandContent >= 15:
print("Soil Symbol: GC \n Group Name: Clayey Gravel with Sand")
elif FineType == "CL-ML" :
if SandContent < 15:
print("Soil Symbol: GC-GM \n Group Name: Silty Clayey Gravel")
elif SandContent >= 15:
print("Soil Symbol: GC-GM \n Group Name: Silty Clayey Gravel with Sand")



elif GravelContent < SandContent :
if FineSoilPass < 5 :
if Cu >= 6 and 1 <= Cc <= 3 :
if SandContent < 15 :
print("Soil Symbol: SW \n Group Name: Well Graded Sand")
elif SandContent >= 15 :
print("Soil Symbol: SW \n Group Name: Well Graded Sand with Gravel")
elif (Cu < 6 or 1 > Cc > 3) or (Cu < 6 and 1 > Cc > 3) :
if SandContent < 15:
print("Soil Symbol: SP \n Group Name: Poorly Graded Sand")
elif SandContent >= 15:
print("Soil Symbol: SP \n Group Name: Poorly Graded Sand with Gravel")

elif 5 < FineSoilPass < 12 :
if Cu >= 6 and 1 <= Cc <= 3:
FineType = input("Enter the type of Fine Soil(ML/MH/CL/CH/CL-ML): ")
if FineType == "ML" or FineType == "MH" :
if SandContent < 15:
print("Soil Symbol: SW-SM \n Group Name: Well Graded Sand with Silt")
elif SandContent >= 15:
print("Soil Symbol: SW-SM \n "
"Group Name: Well Graded Sand with Silt and Gravel")
elif FineType == "CL" or FineType == "CH" or FineType == "CL-ML":
if SandContent < 15:
print("Soil Symbol: SW-SC \n "
"Group Name: Well Graded Sand with Clay")
elif SandContent >= 15:
print("Soil Symbol: SW-SC \n "
"Group Name: Well Graded Sand with Clay and Gravel")

elif (Cu < 6 or 1 > Cc > 3) or (Cu < 6 and 1 > Cc > 3):
FineType = input("Enter the type of Fine Soil(ML/MH/CL/CH/CL-ML): ")
if FineType == "ML" or FineType == "MH" :
if SandContent < 15:
print("Soil Symbol: SP-SM \n Group "
"Name: Poorly Graded Sand with Silt")
elif SandContent >= 15:
print("Soil Symbol: SP-SM \n "
"Group Name: Poorly Graded Sand with Silt and Gravel")
elif FineType == "CL" or FineType == "CH" or FineType == "CL-ML" :
if SandContent < 15:
print("Soil Symbol: SP-SC \n "
"Group Name: Poorly Graded Sand with Clay")
elif SandContent >= 15:
print("Soil Symbol: SP-SC \n "
"Group Name: Poorly Graded Sand with Clay and Gravel")

elif FineSoilPass > 12:
FineType = input("Enter the type of Fine Soil(ML/MH/CL/CH/CL-ML): ")
if FineType == "ML" or FineType == "MH":
if SandContent < 15:
print("Soil Symbol: SM \n Group Name: Silty Sand")
elif SandContent >= 15:
print("Soil Symbol: SM \n Group Name: Silty Sand with Gravel")
elif FineType == "CL" or FineType == "CH" :
if SandContent < 15:
print("Soil Symbol: SC \n Group Name: Clayey Sand")
elif SandContent >= 15:
print("Soil Symbol: SC \n Group Name: Clayey Sand with Gravel")
elif FineType == "CL-ML" :
if SandContent < 15:
print("Soil Symbol: SC-SM \n Group Name: Silty Clayey Sand")
elif SandContent >= 15:
print("Soil Symbol: SC-SM \n Group Name: Silty Clayey Sand with Gravel")

if LL < 50 :
if OrganicCon == "I" or OrganicCon == "i" :
if (PI >7 and PI>=AL):
if FineSoilPass < 30 :
if FineSoilPass < 15 :
print("Soil Symbol: CL \n Group Name: Lean Clay ")
elif 30 >FineSoilPass > 15 :
if SandContent >= GravelContent :
print("Soil Symbol: CL \n Group Name: Lean Clay with Sand")
elif SandContent < GravelContent :
print("Soil Symbol: CL \n Group Name: Lean Clay with Gravel")
elif FineSoilPass >= 30 :
if SandContent >= GravelContent:
if GravelContent < 15 :
print("Soil Symbol: CL \n Group Name: Sandy Lean Clay")
elif GravelContent >= 15 :
print("Soil Symbol: CL \n Group Name: Sandy Lean Clay with Gravel")
elif SandContent < GravelContent:
if SandContent < 15:
print("Soil Symbol: CL \n Group Name: Gravelly Lean Clay")
elif SandContent >= 15:
print("Soil Symbol: CL \n Group Name: Gravelly Lean Clay with Sand")
elif (4<= PI <7 and PI>=AL) :
if FineSoilPass < 30 :
if FineSoilPass < 15 :
print("Soil Symbol: CL-ML \n Group Name: Silty Clay ")
elif 30 >FineSoilPass > 15 :
if SandContent >= GravelContent :
print("Soil Symbol: CL-ML \n Group Name: Silty Clay with Sand")
elif SandContent < GravelContent :
print("Soil Symbol: CL-ML \n Group Name: Silty Clay with Gravel")
elif FineSoilPass >= 30 :
if SandContent >= GravelContent:
if GravelContent < 15 :
print("Soil Symbol: CL-ML \n Group Name: Sandy Silty Clay")
elif GravelContent >= 15 :
print("Soil Symbol: CL-ML \n "
"Group Name: Sandy Silty Clay with Gravel")
elif SandContent < GravelContent:
if SandContent < 15:
print("Soil Symbol: CL-ML \n Group Name: Gravelly Silty Clay")
elif SandContent >= 15:
print("Soil Symbol: CL-ML \n "
"Group Name: Gravelly Silty Clay with Sand")
elif (PI < 4 or AL>PI) :
if FineSoilPass < 30 :
if FineSoilPass < 15 :
print("Soil Symbol: ML \n Group Name: Silt ")
elif 30 >FineSoilPass > 15 :
if SandContent >= GravelContent :
print("Soil Symbol: ML \n Group Name: Silt with Sand")
elif SandContent < GravelContent :
print("Soil Symbol: ML \n Group Name: Silt with Gravel")
elif FineSoilPass >= 30 :
if SandContent >= GravelContent:
if GravelContent < 15 :
print("Soil Symbol: ML \n Group Name: Sandy Silt")
elif GravelContent >= 15 :
print("Soil Symbol: ML \n Group Name: Sandy Silt with Gravel")
elif SandContent < GravelContent:
if SandContent < 15:
print("Soil Symbol: ML \n Group Name: Gravelly Silt")
elif SandContent >= 15:
print("Soil Symbol: ML \n Group Name: Gravelly Silt with Sand")

elif (LLOvenDried/LLNotDried)< 0.75 or OrganicCon == "O" or OrganicCon == "o" :
if (PI>=4 and PI>=AL) :
if FineSoilPass < 30 :
if FineSoilPass < 15 :
print("Soil Symbol: OL \n Group Name: Organic Clay ")
elif 30 >FineSoilPass > 15 :
if SandContent >= GravelContent :
print("Soil Symbol: OL \n Group Name: Organic Clay with Sand")
elif SandContent < GravelContent :
print("Soil Symbol: OL \n Group Name: Organic Clay with Gravel")
elif FineSoilPass >= 30 :
if SandContent >= GravelContent:
if GravelContent < 15 :
print("Soil Symbol: OL \n Group Name: Sandy Organic Clay")
elif GravelContent >= 15 :
print("Soil Symbol: OL \n Group Name: Sandy Organic Clay with Gravel")
elif SandContent < GravelContent:
if SandContent < 15:
print("Soil Symbol: OL \n Group Name: Gravelly Organic Clay")
elif SandContent >= 15:
print("Soil Symbol: OL \n Group Name: Gravelly Organic Clay with Sand")
elif (PI<4 and PI<AL) :
if FineSoilPass < 30 :
if FineSoilPass < 15 :
print("Soil Symbol: OL \n Group Name: Organic Silt ")
elif 30 >FineSoilPass > 15 :
if SandContent >= GravelContent :
print("Soil Symbol: OL \n Group Name: Organic Silt with Sand")
elif SandContent < GravelContent :
print("Soil Symbol: OL \n Group Name: Organic Silt with Gravel")
elif FineSoilPass >= 30 :
if SandContent >= GravelContent:
if GravelContent < 15 :
print("Soil Symbol: OL \n Group Name: Sandy Organic Silt")
elif GravelContent >= 15 :
print("Soil Symbol: OL \n Group Name: Sandy Organic Silt with Gravel")
elif SandContent < GravelContent:
if SandContent < 15:
print("Soil Symbol: OL \n Group Name: Gravelly Organic Silt")
elif SandContent >= 15:
print("Soil Symbol: OL \n Group Name: Gravelly Organic Silt with Sand")

elif LL >= 50 :
if OrganicCon == "I" or OrganicCon == "i" :
if PI>=AL:
if FineSoilPass < 30 :
if FineSoilPass < 15 :
print("Soil Symbol: CH \n Group Name: Fat Clay ")
elif 30 >FineSoilPass > 15 :
if SandContent >= GravelContent :
print("Soil Symbol: CH \n Group Name: Fat Clay with Sand")
elif SandContent < GravelContent :
print("Soil Symbol: CH \n Group Name: Fat Clay with Gravel")
elif FineSoilPass >= 30 :
if SandContent >= GravelContent:
if GravelContent < 15 :
print("Soil Symbol: CH \n Group Name: Sandy Fat Clay")
elif GravelContent >= 15 :
print("Soil Symbol: CH \n Group Name: Sandy Fat Clay with Gravel")
elif SandContent < GravelContent:
if SandContent < 15:
print("Soil Symbol: CH \n Group Name: Gravelly Fat Clay")
elif SandContent >= 15:
print("Soil Symbol: CH \n Group Name: Gravelly Fat Clay with Sand")

elif AL>PI :
if FineSoilPass < 30 :
if FineSoilPass < 15 :
print("Soil Symbol: MH \n Group Name: Elastic Silt ")
elif 30 >FineSoilPass > 15 :
if SandContent >= GravelContent :
print("Soil Symbol: MH \n Group Name: Elastic Silt with Sand")
elif SandContent < GravelContent :
print("Soil Symbol: MH \n Group Name: Elastic Silt with Gravel")
elif FineSoilPass >= 30 :
if SandContent >= GravelContent:
if GravelContent < 15 :
print("Soil Symbol: MH \n Group Name: Sandy Elastic Silt")
elif GravelContent >= 15 :
print("Soil Symbol: MH \n Group Name: Sandy Silt with Gravel")
elif SandContent < GravelContent:
if SandContent < 15:
print("Soil Symbol: MH \n Group Name: Gravelly Elastic Silt")
elif SandContent >= 15:
print("Soil Symbol: MH \n Group Name: Gravelly Elastic Silt with Sand")

elif (LLOvenDried/LLNotDried)< 0.75 or OrganicCon == "O" or OrganicCon == "o" :
if PI>=AL :
if FineSoilPass < 30 :
if FineSoilPass < 15 :
print("Soil Symbol: OH \n Group Name: Organic Clay ")
elif 30 >FineSoilPass > 15 :
if SandContent >= GravelContent :
print("Soil Symbol: OH \n Group Name: Organic Clay with Sand")
elif SandContent < GravelContent :
print("Soil Symbol: OH \n Group Name: Organic Clay with Gravel")
elif FineSoilPass >= 30 :
if SandContent >= GravelContent:
if GravelContent < 15 :
print("Soil Symbol: OH \n Group Name: Sandy Organic Clay")
elif GravelContent >= 15 :
print("Soil Symbol: OH \n Group Name: Sandy Organic Clay with Gravel")
elif SandContent < GravelContent:
if SandContent < 15:
print("Soil Symbol: OH \n Group Name: Gravelly Organic Clay")
elif SandContent >= 15:
print("Soil Symbol: OH \n Group Name: Gravelly Organic Clay with Sand")
elif PI<AL :
if FineSoilPass < 30 :
if FineSoilPass < 15 :
print("Soil Symbol: OH \n Group Name: Organic Silt ")
elif 30 >FineSoilPass > 15 :
if SandContent >= GravelContent :
print("Soil Symbol: OH \n Group Name: Organic Silt with Sand")
elif SandContent < GravelContent :
print("Soil Symbol: OH \n Group Name: Organic Silt with Gravel")
elif FineSoilPass >= 30 :
if SandContent >= GravelContent:
if GravelContent < 15 :
print("Soil Symbol: OH \n Group Name: Sandy Organic Silt")
elif GravelContent >= 15 :
print("Soil Symbol: OH \n Group Name: Sandy Organic Silt with Gravel")
elif SandContent < GravelContent:
if SandContent < 15:
print("Soil Symbol: OH \n Group Name: Gravelly Organic Silt")
elif SandContent >= 15:
print("Soil Symbol: OH \n Group Name: Gravelly Organic Silt with Sand")

No comments