@bradtech/sensor-soil 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/HOWTO.md ADDED
@@ -0,0 +1,84 @@
1
+ # HOWTO: Using `@bradtech/sensor-soil`
2
+
3
+ This guide explains how to convert multi-depth soil moisture readings and derive water potential ($pF$).
4
+
5
+ ---
6
+
7
+ ## 1. Converting Capacitive Soil Moisture with Plot Linear Regression
8
+
9
+ ```typescript
10
+ import { SoilMoistureConverter } from '@bradtech/sensor-soil'
11
+
12
+ const converter = new SoilMoistureConverter()
13
+
14
+ // Raw capacitive reading from Brad soil probe at 10cm depth
15
+ const rawMoisture = 28.5
16
+
17
+ // Plot context with custom laboratory calibration curve
18
+ const outputs = converter.convert(
19
+ {
20
+ rawMoisturePercent: rawMoisture,
21
+ depthCm: 10,
22
+ },
23
+ {
24
+ soilTexture: 'clay_loam',
25
+ linearRegression: {
26
+ slope: 1.08,
27
+ intercept: -1.5,
28
+ modelLabel: 'Lab Core Sample 2026-05',
29
+ },
30
+ }
31
+ )
32
+
33
+ console.log(outputs[0].metric) // 'okf:soil/moisture/10cm'
34
+ console.log(outputs[0].value) // 29.28 %
35
+ console.log(outputs[0].metadata?.calibrationModel) // 'custom_linear_regression'
36
+ ```
37
+
38
+ ---
39
+
40
+ ## 2. Deriving Matric Potential & $pF$ Curve
41
+
42
+ ```typescript
43
+ import { SoilWaterPotentialConverter } from '@bradtech/sensor-soil'
44
+
45
+ const wpConverter = new SoilWaterPotentialConverter()
46
+
47
+ // Convert 22% VWC into matric suction and pF
48
+ const results = wpConverter.convert({
49
+ volumetricWaterContentPercent: 22.0,
50
+ depthCm: 20,
51
+ soilTexture: 'silt_loam',
52
+ })
53
+
54
+ for (const out of results) {
55
+ console.log(`${out.metric}: ${out.value} ${out.unit}`)
56
+ }
57
+ // Outputs:
58
+ // okf:soil/potential/matric/20cm: -85.4 kPa (Tension)
59
+ // okf:soil/potential/pf/20cm: 2.94 pF (Comfort zone before wilting point at 4.2)
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 3. Temperature-Compensated Electrical Conductivity (EC)
65
+
66
+ ```typescript
67
+ import { SoilElectricalConductivityConverter } from '@bradtech/sensor-soil'
68
+
69
+ const ecConverter = new SoilElectricalConductivityConverter()
70
+
71
+ const ecResults = ecConverter.convert({
72
+ rawEcMilliSiemensPerMeter: 45.0,
73
+ soilTemperatureCelsius: 16.5,
74
+ depthCm: 10,
75
+ })
76
+
77
+ console.log('Normalized EC @ 25°C:', ecResults[0].value, ecResults[0].unit)
78
+ ```
79
+
80
+ ---
81
+
82
+ ## 📄 License & Copyright
83
+
84
+ GNU AGPL-v3 — Copyright (C) 2026 Olivier Lépine <olivier@lepine.fr>