hystfit

Fit soil water retention function with hysteresis

View the Project on GitHub or PyPI

Example

Zhou’s paper

As illustrated below, curves similar to those in Figure 6 of Zhou (2013) can be reproduced using this Python code, with the same parameter set applied in each figure. This demonstrates that the hystfit tool effectively implements the algorithm proposed by Zhou (click to enlarge).

Hysteresis figure

As illustrated in these figures, a larger advancing contact angle (γA)—depicted in the upper figures—results in a greater deviation between the main wetting and drying curves. Conversely, a larger value of ‘b’ (shown in the right figures) causes a slower transition from the main drying curve to the main wetting curve, and vice versa.

The sample code utilizes matplotlib for rendering these figures. For further details, refer to the matplotlib documentation. The smooth_theta method in the hystfit class is used to draw smooth curves. For instance, executing the following code:

theta = f.smooth_theta((0.3, 0.7, 0.55, 0.9, 0.8))

results in a numpy array named ‘theta’, which begins at 0.3, gradually increases to 0.7, then decreases to 0.55, and continues similarly. The code:

h = f.h(p, theta)

calculates ‘h’ from this theta value.

UNSODA dataset

This program utilized the UNSODA dataset and produced 15 figures, with full data links available through the UNSODA viewer. The model exhibits an excellent fit for sand in these figures, particularly for disturbed samples; see samples 1410, 2310, 4890, 4940 and 4941.

Method: The Python code used to generate the figures is provided. Laboratory drying curves were fitted using either the VG or FX model, depending on which had the lower corrected AIC. θs is fixed when measured and optimized otherwise. θr is set to 0. Laboratory wetting curves were fitted using the Zhou model. The saturated point may be omitted when fitting the wetting curve. In some cases, θs was altered in the wetting curve, as documented. Data points where h = 0 cm are displayed as h = 1 cm in the figures.

UNSODA 1270 Tuffaceous Rock (undisturbed)