MCPcopy Create free account
hub / github.com/Thanas-R/Virdis / classifySoil

Function classifySoil

supabase/functions/soil-data/index.ts:25–35  ·  view source on GitHub ↗
(sand: number | null, clay: number | null, silt: number | null, ph: number | null, soc: number | null, wrb: string)

Source from the content-addressed store, hash-verified

23}
24
25function classifySoil(sand: number | null, clay: number | null, silt: number | null, ph: number | null, soc: number | null, wrb: string): string {
26 if (wrb && wrb !== "Unknown" && wrb !== "None" && wrb !== "") return wrb;
27 if (sand == null && clay == null) return "Unknown";
28 if (sand != null && sand > 700) return "Arenosol";
29 if (clay != null && clay > 450) return "Vertisol";
30 if (soc != null && soc > 800) return "Histosol";
31 if (ph != null && clay != null && ph < 50 && clay > 200) return "Acrisol";
32 if (clay != null && clay > 200 && soc != null && soc > 200) return "Ferralsol";
33 if (soc != null && soc > 300 && ph != null && ph > 60) return "Phaeozem";
34 return "Cambisol";
35}
36
37function usdaTexture(sand: number | null, silt: number | null, clay: number | null): string | null {
38 if (sand == null || silt == null || clay == null) return null;

Callers 1

index.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected