| 23 | } |
| 24 | |
| 25 | function 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 | |
| 37 | function usdaTexture(sand: number | null, silt: number | null, clay: number | null): string | null { |
| 38 | if (sand == null || silt == null || clay == null) return null; |