diff --git a/docs/src/ptf-catalog/sources/gunarathna2019.md b/docs/src/ptf-catalog/sources/gunarathna2019.md new file mode 100644 index 0000000..9e9a7f5 --- /dev/null +++ b/docs/src/ptf-catalog/sources/gunarathna2019.md @@ -0,0 +1,398 @@ +--- +# @generated by ptfkit-codegen; DO NOT EDIT. + +title: PTF source gunarathna2019 +nav-title: gunarathna2019 +--- + +# Point water-retention regressions for tropical Sri Lankan soils. + +## Source + +Gunarathna, M. H. J. P., Sakai, K., Nakandakari, T., Momii, K., Kumari, M. K. N., & Amarasekara, M. G. T. S. (2019). Pedotransfer functions to estimate hydraulic properties of tropical Sri Lankan soils. Soil & Tillage Research, 190, 109-119. https://doi.org/10.1016/j.still.2019.02.009 + +[DOI: 10.1016/j.still.2019.02.009](https://doi.org/10.1016/j.still.2019.02.009) + +## Scope + +**Territory:** Tropical Sri Lanka. + +**Dataset:** 323 soil horizons retained after removing samples with missing water-content data from the SRI-CANSOL survey of 110 profiles. The survey covers almost all soil series and land uses except the northern part of Sri Lanka. Models were evaluated using tenfold cross-validation. + +## Functions + +### `calc_ptf_gunarathna2019_vwc10_set1` + +Estimate volumetric water content at -10 kPa using Set 1. + +**Status:** `implemented` + +**Prediction target:** Volumetric water content at -10 kPa. + +#### Inputs + +| Name | Type | Unit | Domain | Description | +| --- | --- | --- | --- | --- | +| `sand` | `number` | % | Table 1 observed range: 5.2 <= value <= 99.0 | Sand percentage measured by sieve analysis. | + +#### Outputs + +| Name | Unit | Domain | Description | +| --- | --- | --- | --- | +| `theta_10` | mm/mm | — | Volumetric water content at -10 kPa matric potential. | + +!!! note + + Equation evidence: Table 3, VWC10, Set 1. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +!!! warning + + Section 3.1 reports slight overprediction above 64% sand at this pressure. + +### `calc_ptf_gunarathna2019_vwc10_set2` + +Estimate volumetric water content at -10 kPa using Set 2. + +**Status:** `implemented` + +**Prediction target:** Volumetric water content at -10 kPa. + +#### Inputs + +| Name | Type | Unit | Domain | Description | +| --- | --- | --- | --- | --- | +| `sand` | `number` | % | Table 1 observed range: 5.2 <= value <= 99.0 | Sand percentage measured by sieve analysis. | +| `silt` | `number` | % | Table 1 observed range: 0.0 <= value <= 38.6 | Silt percentage measured by the pipette method. | + +#### Outputs + +| Name | Unit | Domain | Description | +| --- | --- | --- | --- | +| `theta_10` | mm/mm | — | Volumetric water content at -10 kPa matric potential. | + +!!! note + + Equation evidence: Table 3, VWC10, Set 2. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc10_set3` + +Estimate volumetric water content at -10 kPa using Set 3. + +**Status:** `implemented` + +**Prediction target:** Volumetric water content at -10 kPa. + +#### Inputs + +| Name | Type | Unit | Domain | Description | +| --- | --- | --- | --- | --- | +| `sand` | `number` | % | Table 1 observed range: 5.2 <= value <= 99.0 | Sand percentage measured by sieve analysis. | +| `silt` | `number` | % | Table 1 observed range: 0.0 <= value <= 38.6 | Silt percentage measured by the pipette method. | +| `bulk_density` | `number` | g/cm3 | Table 1 observed range: 1.0 <= value <= 2.0 | Bulk density measured using undisturbed cores. | + +#### Outputs + +| Name | Unit | Domain | Description | +| --- | --- | --- | --- | +| `theta_10` | mm/mm | — | Volumetric water content at -10 kPa matric potential. | + +!!! note + + Equation evidence: Table 3, VWC10, Set 3. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc10_set4` + +Estimate volumetric water content at -10 kPa using Set 4. + +**Status:** `implemented` + +**Prediction target:** Volumetric water content at -10 kPa. + +#### Inputs + +| Name | Type | Unit | Domain | Description | +| --- | --- | --- | --- | --- | +| `sand` | `number` | % | Table 1 observed range: 5.2 <= value <= 99.0 | Sand percentage measured by sieve analysis. | +| `silt` | `number` | % | Table 1 observed range: 0.0 <= value <= 38.6 | Silt percentage measured by the pipette method. | +| `organic_carbon` | `number` | % | Table 1 observed range: 0.0 <= value <= 4.5 | Organic carbon percentage measured by the Walkley-Black method. | + +#### Outputs + +| Name | Unit | Domain | Description | +| --- | --- | --- | --- | +| `theta_10` | mm/mm | — | Volumetric water content at -10 kPa matric potential. | + +!!! note + + Equation evidence: Table 3, VWC10, Set 4. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc33_set1` + +Estimate volumetric water content at -33 kPa using Set 1. + +**Status:** `implemented` + +**Prediction target:** Volumetric water content at -33 kPa. + +#### Inputs + +| Name | Type | Unit | Domain | Description | +| --- | --- | --- | --- | --- | +| `sand` | `number` | % | Table 1 observed range: 5.2 <= value <= 99.0 | Sand percentage measured by sieve analysis. | + +#### Outputs + +| Name | Unit | Domain | Description | +| --- | --- | --- | --- | +| `theta_33` | mm/mm | — | Volumetric water content at -33 kPa matric potential. | + +!!! note + + Equation evidence: Table 3, VWC33, Set 1. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +!!! warning + + Section 3.1 reports slight overprediction above 66% sand at this pressure. + +### `calc_ptf_gunarathna2019_vwc33_set2` + +Estimate volumetric water content at -33 kPa using Set 2. + +**Status:** `implemented` + +**Prediction target:** Volumetric water content at -33 kPa. + +#### Inputs + +| Name | Type | Unit | Domain | Description | +| --- | --- | --- | --- | --- | +| `sand` | `number` | % | Table 1 observed range: 5.2 <= value <= 99.0 | Sand percentage measured by sieve analysis. | +| `silt` | `number` | % | Table 1 observed range: 0.0 <= value <= 38.6 | Silt percentage measured by the pipette method. | + +#### Outputs + +| Name | Unit | Domain | Description | +| --- | --- | --- | --- | +| `theta_33` | mm/mm | — | Volumetric water content at -33 kPa matric potential. | + +!!! note + + Equation evidence: Table 3, VWC33, Set 2. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc33_set3` + +Estimate volumetric water content at -33 kPa using Set 3. + +**Status:** `implemented` + +**Prediction target:** Volumetric water content at -33 kPa. + +#### Inputs + +| Name | Type | Unit | Domain | Description | +| --- | --- | --- | --- | --- | +| `sand` | `number` | % | Table 1 observed range: 5.2 <= value <= 99.0 | Sand percentage measured by sieve analysis. | +| `silt` | `number` | % | Table 1 observed range: 0.0 <= value <= 38.6 | Silt percentage measured by the pipette method. | +| `bulk_density` | `number` | g/cm3 | Table 1 observed range: 1.0 <= value <= 2.0 | Bulk density measured using undisturbed cores. | + +#### Outputs + +| Name | Unit | Domain | Description | +| --- | --- | --- | --- | +| `theta_33` | mm/mm | — | Volumetric water content at -33 kPa matric potential. | + +!!! note + + Equation evidence: Table 3, VWC33, Set 3. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc33_set4` + +Estimate volumetric water content at -33 kPa using Set 4. + +**Status:** `implemented` + +**Prediction target:** Volumetric water content at -33 kPa. + +#### Inputs + +| Name | Type | Unit | Domain | Description | +| --- | --- | --- | --- | --- | +| `sand` | `number` | % | Table 1 observed range: 5.2 <= value <= 99.0 | Sand percentage measured by sieve analysis. | +| `silt` | `number` | % | Table 1 observed range: 0.0 <= value <= 38.6 | Silt percentage measured by the pipette method. | +| `organic_carbon` | `number` | % | Table 1 observed range: 0.0 <= value <= 4.5 | Organic carbon percentage measured by the Walkley-Black method. | + +#### Outputs + +| Name | Unit | Domain | Description | +| --- | --- | --- | --- | +| `theta_33` | mm/mm | — | Volumetric water content at -33 kPa matric potential. | + +!!! note + + Equation evidence: Table 3, VWC33, Set 4. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc1500_set1` + +Estimate volumetric water content at -1500 kPa using Set 1. + +**Status:** `implemented` + +**Prediction target:** Volumetric water content at -1500 kPa. + +#### Inputs + +| Name | Type | Unit | Domain | Description | +| --- | --- | --- | --- | --- | +| `sand` | `number` | % | Table 1 observed range: 5.2 <= value <= 99.0 | Sand percentage measured by sieve analysis. | + +#### Outputs + +| Name | Unit | Domain | Description | +| --- | --- | --- | --- | +| `theta_1500` | mm/mm | — | Volumetric water content at -1500 kPa matric potential. | + +!!! note + + Equation evidence: Table 3, VWC1500, Set 1. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +!!! warning + + Section 3.1 reports slight overprediction above 66% sand at this pressure. + +### `calc_ptf_gunarathna2019_vwc1500_set3` + +Estimate volumetric water content at -1500 kPa using Set 3. + +**Status:** `implemented` + +**Prediction target:** Volumetric water content at -1500 kPa. + +#### Inputs + +| Name | Type | Unit | Domain | Description | +| --- | --- | --- | --- | --- | +| `sand` | `number` | % | Table 1 observed range: 5.2 <= value <= 99.0 | Sand percentage measured by sieve analysis. | +| `bulk_density` | `number` | g/cm3 | Table 1 observed range: 1.0 <= value <= 2.0 | Bulk density measured using undisturbed cores. | + +#### Outputs + +| Name | Unit | Domain | Description | +| --- | --- | --- | --- | +| `theta_1500` | mm/mm | — | Volumetric water content at -1500 kPa matric potential. | + +!!! note + + Equation evidence: Table 3, VWC1500, Set 3. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc1500_set4` + +Estimate volumetric water content at -1500 kPa using Set 4. + +**Status:** `implemented` + +**Prediction target:** Volumetric water content at -1500 kPa. + +#### Inputs + +| Name | Type | Unit | Domain | Description | +| --- | --- | --- | --- | --- | +| `sand` | `number` | % | Table 1 observed range: 5.2 <= value <= 99.0 | Sand percentage measured by sieve analysis. | +| `organic_carbon` | `number` | % | Table 1 observed range: 0.0 <= value <= 4.5 | Organic carbon percentage measured by the Walkley-Black method. | + +#### Outputs + +| Name | Unit | Domain | Description | +| --- | --- | --- | --- | +| `theta_1500` | mm/mm | — | Volumetric water content at -1500 kPa matric potential. | + +!!! note + + Equation evidence: Table 3, VWC1500, Set 4. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. diff --git a/docs/src/ptf-catalog/sources/index.md b/docs/src/ptf-catalog/sources/index.md index a0400a6..f25285f 100644 --- a/docs/src/ptf-catalog/sources/index.md +++ b/docs/src/ptf-catalog/sources/index.md @@ -18,6 +18,7 @@ Each page describes the source, scope, inputs, outputs, status, and limitations | [Cosby et al. (1984), United States.](./cosby1984.md) | United States | 1 | | [Dharumarajan et al. (2019) hydraulic PTFs for the Karnataka Plateau.](./dharumarajan2019.md) | Karnataka Plateau, India | 5 | | [Ferrer Julià et al. (2004), saturated-conductivity PTFs for Spanish soils.](./ferrerjulia2004.md) | Spanish mainland on the Iberian Peninsula | 41 | +| [Point water-retention regressions for tropical Sri Lankan soils.](./gunarathna2019.md) | Tropical Sri Lanka. | 11 | | [Hodnett & Tomasella (2002), tropical-soil regressions for four van Genuchten parameters.](./hodnett2002.md) | Tropical soils between approximately 25 degrees N and 25 degrees S. | 1 | | [Jabro (1992), United States.](./jabro1992.md) | USA | 1 | | [Li et al. (2007), Fengqiu County, North China Plain, China.](./li2007.md) | Fengqiu County soils in the North China Plain, China | 1 | diff --git a/docs/src/reference/c/functions.md b/docs/src/reference/c/functions.md index a8ff235..3382419 100644 --- a/docs/src/reference/c/functions.md +++ b/docs/src/reference/c/functions.md @@ -75,6 +75,17 @@ title: C function index | [`calc_ptf_ferrerjulia2004_rendzina_sand`](headers/ferrerjulia2004.md#function-calc_ptf_ferrerjulia2004_rendzina_sand) | Estimate saturated conductivity for Rendzina from sand content. | [``](headers/ferrerjulia2004.md) | | [`calc_ptf_ferrerjulia2004_rendzina_texture_organic_matter`](headers/ferrerjulia2004.md#function-calc_ptf_ferrerjulia2004_rendzina_texture_organic_matter) | Estimate saturated conductivity for Rendzina from texture and organic matter. | [``](headers/ferrerjulia2004.md) | | [`calc_ptf_ferrerjulia2004_saxton`](headers/ferrerjulia2004.md#function-calc_ptf_ferrerjulia2004_saxton) | Evaluate the Saxton et al. saturated-conductivity PTF. | [``](headers/ferrerjulia2004.md) | +| [`calc_ptf_gunarathna2019_vwc10_set1`](headers/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc10_set1) | Estimate volumetric water content at -10 kPa using Set 1. | [``](headers/gunarathna2019.md) | +| [`calc_ptf_gunarathna2019_vwc10_set2`](headers/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc10_set2) | Estimate volumetric water content at -10 kPa using Set 2. | [``](headers/gunarathna2019.md) | +| [`calc_ptf_gunarathna2019_vwc10_set3`](headers/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc10_set3) | Estimate volumetric water content at -10 kPa using Set 3. | [``](headers/gunarathna2019.md) | +| [`calc_ptf_gunarathna2019_vwc10_set4`](headers/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc10_set4) | Estimate volumetric water content at -10 kPa using Set 4. | [``](headers/gunarathna2019.md) | +| [`calc_ptf_gunarathna2019_vwc33_set1`](headers/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc33_set1) | Estimate volumetric water content at -33 kPa using Set 1. | [``](headers/gunarathna2019.md) | +| [`calc_ptf_gunarathna2019_vwc33_set2`](headers/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc33_set2) | Estimate volumetric water content at -33 kPa using Set 2. | [``](headers/gunarathna2019.md) | +| [`calc_ptf_gunarathna2019_vwc33_set3`](headers/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc33_set3) | Estimate volumetric water content at -33 kPa using Set 3. | [``](headers/gunarathna2019.md) | +| [`calc_ptf_gunarathna2019_vwc33_set4`](headers/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc33_set4) | Estimate volumetric water content at -33 kPa using Set 4. | [``](headers/gunarathna2019.md) | +| [`calc_ptf_gunarathna2019_vwc1500_set1`](headers/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc1500_set1) | Estimate volumetric water content at -1500 kPa using Set 1. | [``](headers/gunarathna2019.md) | +| [`calc_ptf_gunarathna2019_vwc1500_set3`](headers/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc1500_set3) | Estimate volumetric water content at -1500 kPa using Set 3. | [``](headers/gunarathna2019.md) | +| [`calc_ptf_gunarathna2019_vwc1500_set4`](headers/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc1500_set4) | Estimate volumetric water content at -1500 kPa using Set 4. | [``](headers/gunarathna2019.md) | | [`calc_ptf_hodnett2002`](headers/hodnett2002.md#function-calc_ptf_hodnett2002) | Estimate four van Genuchten water-retention parameters for tropical soils. | [``](headers/hodnett2002.md) | | [`calc_ptf_jabro1992`](headers/jabro1992.md#function-calc_ptf_jabro1992) | Estimate saturated hydraulic conductivity from silt, clay, and bulk density. | [``](headers/jabro1992.md) | | [`calc_ptf_li2007`](headers/li2007.md#function-calc_ptf_li2007) | Estimate van Genuchten parameters and saturated hydraulic conductivity for Fengqiu County soils. | [``](headers/li2007.md) | diff --git a/docs/src/reference/c/headers/gunarathna2019.md b/docs/src/reference/c/headers/gunarathna2019.md new file mode 100644 index 0000000..d82dd39 --- /dev/null +++ b/docs/src/reference/c/headers/gunarathna2019.md @@ -0,0 +1,383 @@ +--- +title: "gunarathna2019.h" +--- + + + +# `` + +```c +#include +``` + +Point water-retention regressions for tropical Sri Lankan soils. + +## Source + +Gunarathna, M. H. J. P., Sakai, K., Nakandakari, T., Momii, K., Kumari, M. K. N., & Amarasekara, M. G. T. S. (2019). Pedotransfer functions to estimate hydraulic properties of tropical Sri Lankan soils. Soil & Tillage Research, 190, 109-119. https://doi.org/10.1016/j.still.2019.02.009 + +[DOI: 10.1016/j.still.2019.02.009](https://doi.org/10.1016/j.still.2019.02.009) + +## Scope + +**Territory:** Tropical Sri Lanka. + +**Dataset:** 323 soil horizons retained after removing samples with missing water-content data from the SRI-CANSOL survey of 110 profiles. The survey covers almost all soil series and land uses except the northern part of Sri Lanka. Models were evaluated using tenfold cross-validation. + +[PTF catalog page](../../../ptf-catalog/sources/gunarathna2019.md) + +## Functions + +### `calc_ptf_gunarathna2019_vwc10_set1` {#function-calc_ptf_gunarathna2019_vwc10_set1} + +Estimate volumetric water content at -10 kPa using Set 1. + +```c +static inline double calc_ptf_gunarathna2019_vwc10_set1(double sand); +``` + +#### Parameters + +| Name | Direction | Description | +| --- | --- | --- | +| `sand` | in | Sand percentage measured by sieve analysis. (%) | + +#### Returns + +Volumetric water content at -10 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC10, Set 1. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +!!! warning + + Section 3.1 reports slight overprediction above 64% sand at this pressure. + +### `calc_ptf_gunarathna2019_vwc10_set2` {#function-calc_ptf_gunarathna2019_vwc10_set2} + +Estimate volumetric water content at -10 kPa using Set 2. + +```c +static inline double calc_ptf_gunarathna2019_vwc10_set2(double sand, double silt); +``` + +#### Parameters + +| Name | Direction | Description | +| --- | --- | --- | +| `sand` | in | Sand percentage measured by sieve analysis. (%) | +| `silt` | in | Silt percentage measured by the pipette method. (%) | + +#### Returns + +Volumetric water content at -10 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC10, Set 2. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc10_set3` {#function-calc_ptf_gunarathna2019_vwc10_set3} + +Estimate volumetric water content at -10 kPa using Set 3. + +```c +static inline double calc_ptf_gunarathna2019_vwc10_set3(double sand, double silt, double bulk_density); +``` + +#### Parameters + +| Name | Direction | Description | +| --- | --- | --- | +| `sand` | in | Sand percentage measured by sieve analysis. (%) | +| `silt` | in | Silt percentage measured by the pipette method. (%) | +| `bulk_density` | in | Bulk density measured using undisturbed cores. (g/cm3) | + +#### Returns + +Volumetric water content at -10 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC10, Set 3. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc10_set4` {#function-calc_ptf_gunarathna2019_vwc10_set4} + +Estimate volumetric water content at -10 kPa using Set 4. + +```c +static inline double calc_ptf_gunarathna2019_vwc10_set4(double sand, double silt, double organic_carbon); +``` + +#### Parameters + +| Name | Direction | Description | +| --- | --- | --- | +| `sand` | in | Sand percentage measured by sieve analysis. (%) | +| `silt` | in | Silt percentage measured by the pipette method. (%) | +| `organic_carbon` | in | Organic carbon percentage measured by the Walkley-Black method. (%) | + +#### Returns + +Volumetric water content at -10 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC10, Set 4. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc33_set1` {#function-calc_ptf_gunarathna2019_vwc33_set1} + +Estimate volumetric water content at -33 kPa using Set 1. + +```c +static inline double calc_ptf_gunarathna2019_vwc33_set1(double sand); +``` + +#### Parameters + +| Name | Direction | Description | +| --- | --- | --- | +| `sand` | in | Sand percentage measured by sieve analysis. (%) | + +#### Returns + +Volumetric water content at -33 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC33, Set 1. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +!!! warning + + Section 3.1 reports slight overprediction above 66% sand at this pressure. + +### `calc_ptf_gunarathna2019_vwc33_set2` {#function-calc_ptf_gunarathna2019_vwc33_set2} + +Estimate volumetric water content at -33 kPa using Set 2. + +```c +static inline double calc_ptf_gunarathna2019_vwc33_set2(double sand, double silt); +``` + +#### Parameters + +| Name | Direction | Description | +| --- | --- | --- | +| `sand` | in | Sand percentage measured by sieve analysis. (%) | +| `silt` | in | Silt percentage measured by the pipette method. (%) | + +#### Returns + +Volumetric water content at -33 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC33, Set 2. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc33_set3` {#function-calc_ptf_gunarathna2019_vwc33_set3} + +Estimate volumetric water content at -33 kPa using Set 3. + +```c +static inline double calc_ptf_gunarathna2019_vwc33_set3(double sand, double silt, double bulk_density); +``` + +#### Parameters + +| Name | Direction | Description | +| --- | --- | --- | +| `sand` | in | Sand percentage measured by sieve analysis. (%) | +| `silt` | in | Silt percentage measured by the pipette method. (%) | +| `bulk_density` | in | Bulk density measured using undisturbed cores. (g/cm3) | + +#### Returns + +Volumetric water content at -33 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC33, Set 3. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc33_set4` {#function-calc_ptf_gunarathna2019_vwc33_set4} + +Estimate volumetric water content at -33 kPa using Set 4. + +```c +static inline double calc_ptf_gunarathna2019_vwc33_set4(double sand, double silt, double organic_carbon); +``` + +#### Parameters + +| Name | Direction | Description | +| --- | --- | --- | +| `sand` | in | Sand percentage measured by sieve analysis. (%) | +| `silt` | in | Silt percentage measured by the pipette method. (%) | +| `organic_carbon` | in | Organic carbon percentage measured by the Walkley-Black method. (%) | + +#### Returns + +Volumetric water content at -33 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC33, Set 4. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc1500_set1` {#function-calc_ptf_gunarathna2019_vwc1500_set1} + +Estimate volumetric water content at -1500 kPa using Set 1. + +```c +static inline double calc_ptf_gunarathna2019_vwc1500_set1(double sand); +``` + +#### Parameters + +| Name | Direction | Description | +| --- | --- | --- | +| `sand` | in | Sand percentage measured by sieve analysis. (%) | + +#### Returns + +Volumetric water content at -1500 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC1500, Set 1. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +!!! warning + + Section 3.1 reports slight overprediction above 66% sand at this pressure. + +### `calc_ptf_gunarathna2019_vwc1500_set3` {#function-calc_ptf_gunarathna2019_vwc1500_set3} + +Estimate volumetric water content at -1500 kPa using Set 3. + +```c +static inline double calc_ptf_gunarathna2019_vwc1500_set3(double sand, double bulk_density); +``` + +#### Parameters + +| Name | Direction | Description | +| --- | --- | --- | +| `sand` | in | Sand percentage measured by sieve analysis. (%) | +| `bulk_density` | in | Bulk density measured using undisturbed cores. (g/cm3) | + +#### Returns + +Volumetric water content at -1500 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC1500, Set 3. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc1500_set4` {#function-calc_ptf_gunarathna2019_vwc1500_set4} + +Estimate volumetric water content at -1500 kPa using Set 4. + +```c +static inline double calc_ptf_gunarathna2019_vwc1500_set4(double sand, double organic_carbon); +``` + +#### Parameters + +| Name | Direction | Description | +| --- | --- | --- | +| `sand` | in | Sand percentage measured by sieve analysis. (%) | +| `organic_carbon` | in | Organic carbon percentage measured by the Walkley-Black method. (%) | + +#### Returns + +Volumetric water content at -1500 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC1500, Set 4. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. diff --git a/docs/src/reference/c/headers/ptfkit.md b/docs/src/reference/c/headers/ptfkit.md index 66a7827..f8d435c 100644 --- a/docs/src/reference/c/headers/ptfkit.md +++ b/docs/src/reference/c/headers/ptfkit.md @@ -22,6 +22,7 @@ This umbrella header aggregates every public ptfkit source header. Include an in - [``](cosby1984.md) — Cosby et al. (1984), United States. - [``](dharumarajan2019.md) — Dharumarajan et al. (2019) hydraulic PTFs for the Karnataka Plateau. - [``](ferrerjulia2004.md) — Ferrer Julià et al. (2004), saturated-conductivity PTFs for Spanish soils. +- [``](gunarathna2019.md) — Point water-retention regressions for tropical Sri Lankan soils. - [``](hodnett2002.md) — Hodnett & Tomasella (2002), tropical-soil regressions for four van Genuchten parameters. - [``](jabro1992.md) — Jabro (1992), United States. - [``](li2007.md) — Li et al. (2007), Fengqiu County, North China Plain, China. diff --git a/docs/src/reference/c/index.md b/docs/src/reference/c/index.md index 376c8f8..ee89e4c 100644 --- a/docs/src/reference/c/index.md +++ b/docs/src/reference/c/index.md @@ -19,6 +19,7 @@ ptfkit's C API is organized around installed headers. - [``](headers/cosby1984.md) — Cosby et al. (1984), United States. - [``](headers/dharumarajan2019.md) — Dharumarajan et al. (2019) hydraulic PTFs for the Karnataka Plateau. - [``](headers/ferrerjulia2004.md) — Ferrer Julià et al. (2004), saturated-conductivity PTFs for Spanish soils. +- [``](headers/gunarathna2019.md) — Point water-retention regressions for tropical Sri Lankan soils. - [``](headers/hodnett2002.md) — Hodnett & Tomasella (2002), tropical-soil regressions for four van Genuchten parameters. - [``](headers/jabro1992.md) — Jabro (1992), United States. - [``](headers/li2007.md) — Li et al. (2007), Fengqiu County, North China Plain, China. diff --git a/docs/src/reference/cpp/functions.md b/docs/src/reference/cpp/functions.md index 371647f..89af0ba 100644 --- a/docs/src/reference/cpp/functions.md +++ b/docs/src/reference/cpp/functions.md @@ -75,6 +75,17 @@ title: C++ function index | [`ptfkit::ferrerjulia2004::calc_ptf_ferrerjulia2004_rendzina_sand`](modules/ferrerjulia2004.md#function-calc_ptf_ferrerjulia2004_rendzina_sand) | Estimate saturated conductivity for Rendzina from sand content. | [`ptfkit.ferrerjulia2004`](modules/ferrerjulia2004.md) | | [`ptfkit::ferrerjulia2004::calc_ptf_ferrerjulia2004_rendzina_texture_organic_matter`](modules/ferrerjulia2004.md#function-calc_ptf_ferrerjulia2004_rendzina_texture_organic_matter) | Estimate saturated conductivity for Rendzina from texture and organic matter. | [`ptfkit.ferrerjulia2004`](modules/ferrerjulia2004.md) | | [`ptfkit::ferrerjulia2004::calc_ptf_ferrerjulia2004_saxton`](modules/ferrerjulia2004.md#function-calc_ptf_ferrerjulia2004_saxton) | Evaluate the Saxton et al. saturated-conductivity PTF. | [`ptfkit.ferrerjulia2004`](modules/ferrerjulia2004.md) | +| [`ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc10_set1`](modules/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc10_set1) | Estimate volumetric water content at -10 kPa using Set 1. | [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) | +| [`ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc10_set2`](modules/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc10_set2) | Estimate volumetric water content at -10 kPa using Set 2. | [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) | +| [`ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc10_set3`](modules/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc10_set3) | Estimate volumetric water content at -10 kPa using Set 3. | [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) | +| [`ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc10_set4`](modules/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc10_set4) | Estimate volumetric water content at -10 kPa using Set 4. | [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) | +| [`ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc33_set1`](modules/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc33_set1) | Estimate volumetric water content at -33 kPa using Set 1. | [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) | +| [`ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc33_set2`](modules/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc33_set2) | Estimate volumetric water content at -33 kPa using Set 2. | [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) | +| [`ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc33_set3`](modules/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc33_set3) | Estimate volumetric water content at -33 kPa using Set 3. | [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) | +| [`ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc33_set4`](modules/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc33_set4) | Estimate volumetric water content at -33 kPa using Set 4. | [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) | +| [`ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc1500_set1`](modules/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc1500_set1) | Estimate volumetric water content at -1500 kPa using Set 1. | [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) | +| [`ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc1500_set3`](modules/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc1500_set3) | Estimate volumetric water content at -1500 kPa using Set 3. | [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) | +| [`ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc1500_set4`](modules/gunarathna2019.md#function-calc_ptf_gunarathna2019_vwc1500_set4) | Estimate volumetric water content at -1500 kPa using Set 4. | [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) | | [`ptfkit::hodnett2002::calc_ptf_hodnett2002`](modules/hodnett2002.md#function-calc_ptf_hodnett2002) | Estimate four van Genuchten water-retention parameters for tropical soils. | [`ptfkit.hodnett2002`](modules/hodnett2002.md) | | [`ptfkit::jabro1992::calc_ptf_jabro1992`](modules/jabro1992.md#function-calc_ptf_jabro1992) | Estimate saturated hydraulic conductivity from silt, clay, and bulk density. | [`ptfkit.jabro1992`](modules/jabro1992.md) | | [`ptfkit::li2007::calc_ptf_li2007`](modules/li2007.md#function-calc_ptf_li2007) | Estimate van Genuchten parameters and saturated hydraulic conductivity for Fengqiu County soils. | [`ptfkit.li2007`](modules/li2007.md) | diff --git a/docs/src/reference/cpp/index.md b/docs/src/reference/cpp/index.md index 0d24c39..fe0d78e 100644 --- a/docs/src/reference/cpp/index.md +++ b/docs/src/reference/cpp/index.md @@ -19,6 +19,7 @@ ptfkit's C++ API is organized around C++23 modules. - [`ptfkit.cosby1984`](modules/cosby1984.md) — Cosby et al. (1984), United States. - [`ptfkit.dharumarajan2019`](modules/dharumarajan2019.md) — Dharumarajan et al. (2019) hydraulic PTFs for the Karnataka Plateau. - [`ptfkit.ferrerjulia2004`](modules/ferrerjulia2004.md) — Ferrer Julià et al. (2004), saturated-conductivity PTFs for Spanish soils. +- [`ptfkit.gunarathna2019`](modules/gunarathna2019.md) — Point water-retention regressions for tropical Sri Lankan soils. - [`ptfkit.hodnett2002`](modules/hodnett2002.md) — Hodnett & Tomasella (2002), tropical-soil regressions for four van Genuchten parameters. - [`ptfkit.jabro1992`](modules/jabro1992.md) — Jabro (1992), United States. - [`ptfkit.li2007`](modules/li2007.md) — Li et al. (2007), Fengqiu County, North China Plain, China. diff --git a/docs/src/reference/cpp/modules/gunarathna2019.md b/docs/src/reference/cpp/modules/gunarathna2019.md new file mode 100644 index 0000000..86765e2 --- /dev/null +++ b/docs/src/reference/cpp/modules/gunarathna2019.md @@ -0,0 +1,397 @@ +--- +# @generated by ptfkit-codegen; DO NOT EDIT. + +title: C++ module ptfkit.gunarathna2019 +nav-title: ptfkit.gunarathna2019 +--- + +# `ptfkit.gunarathna2019` + +```cpp +import ptfkit.gunarathna2019; +``` + +**Exported namespace:** `ptfkit::gunarathna2019` + +Point water-retention regressions for tropical Sri Lankan soils. + +## Source + +Gunarathna, M. H. J. P., Sakai, K., Nakandakari, T., Momii, K., Kumari, M. K. N., & Amarasekara, M. G. T. S. (2019). Pedotransfer functions to estimate hydraulic properties of tropical Sri Lankan soils. Soil & Tillage Research, 190, 109-119. https://doi.org/10.1016/j.still.2019.02.009 + +[DOI: 10.1016/j.still.2019.02.009](https://doi.org/10.1016/j.still.2019.02.009) + +## Scope + +**Territory:** Tropical Sri Lanka. + +**Dataset:** 323 soil horizons retained after removing samples with missing water-content data from the SRI-CANSOL survey of 110 profiles. The survey covers almost all soil series and land uses except the northern part of Sri Lanka. Models were evaluated using tenfold cross-validation. + +[PTF catalog page](../../../ptf-catalog/sources/gunarathna2019.md) + +## Functions + +### `calc_ptf_gunarathna2019_vwc10_set1` {#function-calc_ptf_gunarathna2019_vwc10_set1} + +Estimate volumetric water content at -10 kPa using Set 1. + +```cpp +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc10_set1(double sand) +``` + +#### Parameters + +| Name | Description | +| --- | --- | +| `sand` | Sand percentage measured by sieve analysis. (%) | + +#### Returns + +Volumetric water content at -10 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC10, Set 1. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +!!! warning + + Section 3.1 reports slight overprediction above 64% sand at this pressure. + +### `calc_ptf_gunarathna2019_vwc10_set2` {#function-calc_ptf_gunarathna2019_vwc10_set2} + +Estimate volumetric water content at -10 kPa using Set 2. + +```cpp +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc10_set2(double sand, double silt) +``` + +#### Parameters + +| Name | Description | +| --- | --- | +| `sand` | Sand percentage measured by sieve analysis. (%) | +| `silt` | Silt percentage measured by the pipette method. (%) | + +#### Returns + +Volumetric water content at -10 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC10, Set 2. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc10_set3` {#function-calc_ptf_gunarathna2019_vwc10_set3} + +Estimate volumetric water content at -10 kPa using Set 3. + +```cpp +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc10_set3(double sand, double silt, double bulk_density) +``` + +#### Parameters + +| Name | Description | +| --- | --- | +| `sand` | Sand percentage measured by sieve analysis. (%) | +| `silt` | Silt percentage measured by the pipette method. (%) | +| `bulk_density` | Bulk density measured using undisturbed cores. (g/cm3) | + +#### Returns + +Volumetric water content at -10 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC10, Set 3. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc10_set4` {#function-calc_ptf_gunarathna2019_vwc10_set4} + +Estimate volumetric water content at -10 kPa using Set 4. + +```cpp +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc10_set4(double sand, double silt, double organic_carbon) +``` + +#### Parameters + +| Name | Description | +| --- | --- | +| `sand` | Sand percentage measured by sieve analysis. (%) | +| `silt` | Silt percentage measured by the pipette method. (%) | +| `organic_carbon` | Organic carbon percentage measured by the Walkley-Black method. (%) | + +#### Returns + +Volumetric water content at -10 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC10, Set 4. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc33_set1` {#function-calc_ptf_gunarathna2019_vwc33_set1} + +Estimate volumetric water content at -33 kPa using Set 1. + +```cpp +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc33_set1(double sand) +``` + +#### Parameters + +| Name | Description | +| --- | --- | +| `sand` | Sand percentage measured by sieve analysis. (%) | + +#### Returns + +Volumetric water content at -33 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC33, Set 1. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +!!! warning + + Section 3.1 reports slight overprediction above 66% sand at this pressure. + +### `calc_ptf_gunarathna2019_vwc33_set2` {#function-calc_ptf_gunarathna2019_vwc33_set2} + +Estimate volumetric water content at -33 kPa using Set 2. + +```cpp +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc33_set2(double sand, double silt) +``` + +#### Parameters + +| Name | Description | +| --- | --- | +| `sand` | Sand percentage measured by sieve analysis. (%) | +| `silt` | Silt percentage measured by the pipette method. (%) | + +#### Returns + +Volumetric water content at -33 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC33, Set 2. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc33_set3` {#function-calc_ptf_gunarathna2019_vwc33_set3} + +Estimate volumetric water content at -33 kPa using Set 3. + +```cpp +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc33_set3(double sand, double silt, double bulk_density) +``` + +#### Parameters + +| Name | Description | +| --- | --- | +| `sand` | Sand percentage measured by sieve analysis. (%) | +| `silt` | Silt percentage measured by the pipette method. (%) | +| `bulk_density` | Bulk density measured using undisturbed cores. (g/cm3) | + +#### Returns + +Volumetric water content at -33 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC33, Set 3. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc33_set4` {#function-calc_ptf_gunarathna2019_vwc33_set4} + +Estimate volumetric water content at -33 kPa using Set 4. + +```cpp +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc33_set4(double sand, double silt, double organic_carbon) +``` + +#### Parameters + +| Name | Description | +| --- | --- | +| `sand` | Sand percentage measured by sieve analysis. (%) | +| `silt` | Silt percentage measured by the pipette method. (%) | +| `organic_carbon` | Organic carbon percentage measured by the Walkley-Black method. (%) | + +#### Returns + +Volumetric water content at -33 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC33, Set 4. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc1500_set1` {#function-calc_ptf_gunarathna2019_vwc1500_set1} + +Estimate volumetric water content at -1500 kPa using Set 1. + +```cpp +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc1500_set1(double sand) +``` + +#### Parameters + +| Name | Description | +| --- | --- | +| `sand` | Sand percentage measured by sieve analysis. (%) | + +#### Returns + +Volumetric water content at -1500 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC1500, Set 1. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +!!! warning + + Section 3.1 reports slight overprediction above 66% sand at this pressure. + +### `calc_ptf_gunarathna2019_vwc1500_set3` {#function-calc_ptf_gunarathna2019_vwc1500_set3} + +Estimate volumetric water content at -1500 kPa using Set 3. + +```cpp +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc1500_set3(double sand, double bulk_density) +``` + +#### Parameters + +| Name | Description | +| --- | --- | +| `sand` | Sand percentage measured by sieve analysis. (%) | +| `bulk_density` | Bulk density measured using undisturbed cores. (g/cm3) | + +#### Returns + +Volumetric water content at -1500 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC1500, Set 3. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. + +### `calc_ptf_gunarathna2019_vwc1500_set4` {#function-calc_ptf_gunarathna2019_vwc1500_set4} + +Estimate volumetric water content at -1500 kPa using Set 4. + +```cpp +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc1500_set4(double sand, double organic_carbon) +``` + +#### Parameters + +| Name | Description | +| --- | --- | +| `sand` | Sand percentage measured by sieve analysis. (%) | +| `organic_carbon` | Organic carbon percentage measured by the Walkley-Black method. (%) | + +#### Returns + +Volumetric water content at -1500 kPa matric potential. (mm/mm) + +!!! note + + Equation evidence: Table 3, VWC1500, Set 4. + +!!! note + + Input ranges describe the study observations, not enforced validity limits. + +!!! warning + + Predictions are empirical and are not clipped to physical bounds. diff --git a/docs/src/reference/cpp/modules/ptfkit.md b/docs/src/reference/cpp/modules/ptfkit.md index 19f9d28..44a5276 100644 --- a/docs/src/reference/cpp/modules/ptfkit.md +++ b/docs/src/reference/cpp/modules/ptfkit.md @@ -23,6 +23,7 @@ This umbrella module re-exports every public ptfkit source module. Import an ind - [`ptfkit.cosby1984`](cosby1984.md) — Cosby et al. (1984), United States. - [`ptfkit.dharumarajan2019`](dharumarajan2019.md) — Dharumarajan et al. (2019) hydraulic PTFs for the Karnataka Plateau. - [`ptfkit.ferrerjulia2004`](ferrerjulia2004.md) — Ferrer Julià et al. (2004), saturated-conductivity PTFs for Spanish soils. +- [`ptfkit.gunarathna2019`](gunarathna2019.md) — Point water-retention regressions for tropical Sri Lankan soils. - [`ptfkit.hodnett2002`](hodnett2002.md) — Hodnett & Tomasella (2002), tropical-soil regressions for four van Genuchten parameters. - [`ptfkit.jabro1992`](jabro1992.md) — Jabro (1992), United States. - [`ptfkit.li2007`](li2007.md) — Li et al. (2007), Fengqiu County, North China Plain, China. diff --git a/docs/src/reference/python/gunarathna2019.md b/docs/src/reference/python/gunarathna2019.md new file mode 100644 index 0000000..5f9b3d4 --- /dev/null +++ b/docs/src/reference/python/gunarathna2019.md @@ -0,0 +1,8 @@ +--- +# @generated by ptfkit-codegen; DO NOT EDIT. + +title: Python module ptfkit.gunarathna2019 +nav-title: ptfkit.gunarathna2019 +--- + +::: ptfkit.gunarathna2019 diff --git a/docs/src/reference/python/index.md b/docs/src/reference/python/index.md index a9ec82f..18d4e5b 100644 --- a/docs/src/reference/python/index.md +++ b/docs/src/reference/python/index.md @@ -18,6 +18,7 @@ ptfkit's Python API is organized around public source modules. - [`ptfkit.cosby1984`](cosby1984.md) — Cosby et al. (1984), United States. - [`ptfkit.dharumarajan2019`](dharumarajan2019.md) — Dharumarajan et al. (2019) hydraulic PTFs for the Karnataka Plateau. - [`ptfkit.ferrerjulia2004`](ferrerjulia2004.md) — Ferrer Julià et al. (2004), saturated-conductivity PTFs for Spanish soils. +- [`ptfkit.gunarathna2019`](gunarathna2019.md) — Point water-retention regressions for tropical Sri Lankan soils. - [`ptfkit.hodnett2002`](hodnett2002.md) — Hodnett & Tomasella (2002), tropical-soil regressions for four van Genuchten parameters. - [`ptfkit.jabro1992`](jabro1992.md) — Jabro (1992), United States. - [`ptfkit.li2007`](li2007.md) — Li et al. (2007), Fengqiu County, North China Plain, China. diff --git a/specs/functions/gunarathna2019.yaml b/specs/functions/gunarathna2019.yaml new file mode 100644 index 0000000..338fe55 --- /dev/null +++ b/specs/functions/gunarathna2019.yaml @@ -0,0 +1,668 @@ +source: + summary: Point water-retention regressions for tropical Sri Lankan soils. + citation_apa: >- + Gunarathna, M. H. J. P., Sakai, K., Nakandakari, T., Momii, K., + Kumari, M. K. N., & Amarasekara, M. G. T. S. (2019). + Pedotransfer functions to estimate hydraulic properties of tropical + Sri Lankan soils. Soil & Tillage Research, 190, 109-119. + https://doi.org/10.1016/j.still.2019.02.009 + doi: + identifier: 10.1016/j.still.2019.02.009 + url: https://doi.org/10.1016/j.still.2019.02.009 +scope: + territory: Tropical Sri Lanka. + dataset: >- + 323 soil horizons retained after removing samples with missing water-content + data from the SRI-CANSOL survey of 110 profiles. The survey covers almost + all soil series and land uses except the northern part of Sri Lanka. + Models were evaluated using tenfold cross-validation. +$defs: + sand: + name: sand + symbol: SA + unit: "%" + domain: "Table 1 observed range: 5.2 <= value <= 99.0" + description: Sand percentage measured by sieve analysis. + silt: + name: silt + symbol: SI + unit: "%" + domain: "Table 1 observed range: 0.0 <= value <= 38.6" + description: Silt percentage measured by the pipette method. + bulk_density: + name: bulk_density + symbol: BD + unit: "g/cm3" + domain: "Table 1 observed range: 1.0 <= value <= 2.0" + description: Bulk density measured using undisturbed cores. + organic_carbon: + name: organic_carbon + symbol: OC + unit: "%" + domain: "Table 1 observed range: 0.0 <= value <= 4.5" + description: Organic carbon percentage measured by the Walkley-Black method. +functions: + - name: calc_ptf_gunarathna2019_vwc10_set1 + status: implemented + public_api: + name: calc_ptf_gunarathna2019_vwc10_set1 + result_class: null + summary: Estimate volumetric water content at -10 kPa using Set 1. + scope: + prediction_target: Volumetric water content at -10 kPa. + models: + h_theta: null + k_h: null + inputs: + - $ref: "#/$defs/sand" + outputs: + type: scalar + name: theta_10 + quantity: volumetric_water_content + symbol: VWC10 + unit: volume_fraction + reported_unit: mm/mm + domain: null + description: Volumetric water content at -10 kPa matric potential. + verification_cases: + - id: published_predictor_means + kind: calculated + inputs: + sand: 65.1 + expected: + theta_10: 0.23933 + rationale: >- + Calculated from Table 3, VWC10, Set 1, using the required + predictor means in Table 1. These are interior marginal means, + not an observed individual soil or a published prediction pair. + Sand 65.1% and silt 13.1% leave 21.8% clay for texture closure; + the separately rounded published clay mean is 21.9%. + Reference arithmetic directly substitutes the means into the + printed regression, multiplying factors for squared terms. + Across the extracted sets these inputs give positive water contents + ordered theta_1500 < theta_33 < theta_10. + edge_cases: [] + documentation: + notes: + - "Equation evidence: Table 3, VWC10, Set 1." + - Input ranges describe the study observations, not enforced validity limits. + warnings: + - Predictions are empirical and are not clipped to physical bounds. + - "Section 3.1 reports slight overprediction above 64% sand at this pressure." + implementation: + variables: + - name: theta_10 + expr: 0.4802 - 0.0037 * sand + - name: calc_ptf_gunarathna2019_vwc10_set2 + status: implemented + public_api: + name: calc_ptf_gunarathna2019_vwc10_set2 + result_class: null + summary: Estimate volumetric water content at -10 kPa using Set 2. + scope: + prediction_target: Volumetric water content at -10 kPa. + models: + h_theta: null + k_h: null + inputs: + - $ref: "#/$defs/sand" + - $ref: "#/$defs/silt" + outputs: + type: scalar + name: theta_10 + quantity: volumetric_water_content + symbol: VWC10 + unit: volume_fraction + reported_unit: mm/mm + domain: null + description: Volumetric water content at -10 kPa matric potential. + verification_cases: + - id: published_predictor_means + kind: calculated + inputs: + sand: 65.1 + silt: 13.1 + expected: + theta_10: 0.24066 + rationale: >- + Calculated from Table 3, VWC10, Set 2, using the required + predictor means in Table 1. These are interior marginal means, + not an observed individual soil or a published prediction pair. + Sand 65.1% and silt 13.1% leave 21.8% clay for texture closure; + the separately rounded published clay mean is 21.9%. + Reference arithmetic directly substitutes the means into the + printed regression, multiplying factors for squared terms. + Across the extracted sets these inputs give positive water contents + ordered theta_1500 < theta_33 < theta_10. + edge_cases: [] + documentation: + notes: + - "Equation evidence: Table 3, VWC10, Set 2." + - Input ranges describe the study observations, not enforced validity limits. + warnings: + - Predictions are empirical and are not clipped to physical bounds. + implementation: + variables: + - name: theta_10 + expr: 0.3967 - 0.0029 * sand + 0.0025 * silt + - name: calc_ptf_gunarathna2019_vwc10_set3 + status: implemented + public_api: + name: calc_ptf_gunarathna2019_vwc10_set3 + result_class: null + summary: Estimate volumetric water content at -10 kPa using Set 3. + scope: + prediction_target: Volumetric water content at -10 kPa. + models: + h_theta: null + k_h: null + inputs: + - $ref: "#/$defs/sand" + - $ref: "#/$defs/silt" + - $ref: "#/$defs/bulk_density" + outputs: + type: scalar + name: theta_10 + quantity: volumetric_water_content + symbol: VWC10 + unit: volume_fraction + reported_unit: mm/mm + domain: null + description: Volumetric water content at -10 kPa matric potential. + verification_cases: + - id: published_predictor_means + kind: calculated + inputs: + sand: 65.1 + silt: 13.1 + bulk_density: 1.49 + expected: + theta_10: 0.2421 + rationale: >- + Calculated from Table 3, VWC10, Set 3, using the required + predictor means in Table 1. These are interior marginal means, + not an observed individual soil or a published prediction pair. + Sand 65.1% and silt 13.1% leave 21.8% clay for texture closure; + the separately rounded published clay mean is 21.9%. + Reference arithmetic directly substitutes the means into the + printed regression, multiplying factors for squared terms. + Across the extracted sets these inputs give positive water contents + ordered theta_1500 < theta_33 < theta_10. + edge_cases: [] + documentation: + notes: + - "Equation evidence: Table 3, VWC10, Set 3." + - Input ranges describe the study observations, not enforced validity limits. + warnings: + - Predictions are empirical and are not clipped to physical bounds. + implementation: + variables: + - name: theta_10 + expr: 0.4436 - 0.0028 * sand + 0.0024 * silt - 0.034 * bulk_density + - name: calc_ptf_gunarathna2019_vwc10_set4 + status: implemented + public_api: + name: calc_ptf_gunarathna2019_vwc10_set4 + result_class: null + summary: Estimate volumetric water content at -10 kPa using Set 4. + scope: + prediction_target: Volumetric water content at -10 kPa. + models: + h_theta: null + k_h: null + inputs: + - $ref: "#/$defs/sand" + - $ref: "#/$defs/silt" + - $ref: "#/$defs/organic_carbon" + outputs: + type: scalar + name: theta_10 + quantity: volumetric_water_content + symbol: VWC10 + unit: volume_fraction + reported_unit: mm/mm + domain: null + description: Volumetric water content at -10 kPa matric potential. + verification_cases: + - id: published_predictor_means + kind: calculated + inputs: + sand: 65.1 + silt: 13.1 + organic_carbon: 0.6 + expected: + theta_10: 0.238312 + rationale: >- + Calculated from Table 3, VWC10, Set 4, using the required + predictor means in Table 1. These are interior marginal means, + not an observed individual soil or a published prediction pair. + Sand 65.1% and silt 13.1% leave 21.8% clay for texture closure; + the separately rounded published clay mean is 21.9%. + Reference arithmetic directly substitutes the means into the + printed regression, multiplying factors for squared terms. + Across the extracted sets these inputs give positive water contents + ordered theta_1500 < theta_33 < theta_10. + edge_cases: [] + documentation: + notes: + - "Equation evidence: Table 3, VWC10, Set 4." + - Input ranges describe the study observations, not enforced validity limits. + warnings: + - Predictions are empirical and are not clipped to physical bounds. + implementation: + variables: + - name: theta_10 + expr: 0.3951 - 0.0029 * sand + 0.0023 * silt + 0.0052 * organic_carbon ^ 2 + - name: calc_ptf_gunarathna2019_vwc33_set1 + status: implemented + public_api: + name: calc_ptf_gunarathna2019_vwc33_set1 + result_class: null + summary: Estimate volumetric water content at -33 kPa using Set 1. + scope: + prediction_target: Volumetric water content at -33 kPa. + models: + h_theta: null + k_h: null + inputs: + - $ref: "#/$defs/sand" + outputs: + type: scalar + name: theta_33 + quantity: volumetric_water_content + symbol: VWC33 + unit: volume_fraction + reported_unit: mm/mm + domain: null + description: Volumetric water content at -33 kPa matric potential. + verification_cases: + - id: published_predictor_means + kind: calculated + inputs: + sand: 65.1 + expected: + theta_33: 0.20785 + rationale: >- + Calculated from Table 3, VWC33, Set 1, using the required + predictor means in Table 1. These are interior marginal means, + not an observed individual soil or a published prediction pair. + Sand 65.1% and silt 13.1% leave 21.8% clay for texture closure; + the separately rounded published clay mean is 21.9%. + Reference arithmetic directly substitutes the means into the + printed regression, multiplying factors for squared terms. + Across the extracted sets these inputs give positive water contents + ordered theta_1500 < theta_33 < theta_10. + edge_cases: [] + documentation: + notes: + - "Equation evidence: Table 3, VWC33, Set 1." + - Input ranges describe the study observations, not enforced validity limits. + warnings: + - Predictions are empirical and are not clipped to physical bounds. + - "Section 3.1 reports slight overprediction above 66% sand at this pressure." + implementation: + variables: + - name: theta_33 + expr: 0.4357 - 0.0035 * sand + - name: calc_ptf_gunarathna2019_vwc33_set2 + status: implemented + public_api: + name: calc_ptf_gunarathna2019_vwc33_set2 + result_class: null + summary: Estimate volumetric water content at -33 kPa using Set 2. + scope: + prediction_target: Volumetric water content at -33 kPa. + models: + h_theta: null + k_h: null + inputs: + - $ref: "#/$defs/sand" + - $ref: "#/$defs/silt" + outputs: + type: scalar + name: theta_33 + quantity: volumetric_water_content + symbol: VWC33 + unit: volume_fraction + reported_unit: mm/mm + domain: null + description: Volumetric water content at -33 kPa matric potential. + verification_cases: + - id: published_predictor_means + kind: calculated + inputs: + sand: 65.1 + silt: 13.1 + expected: + theta_33: 0.20751 + rationale: >- + Calculated from Table 3, VWC33, Set 2, using the required + predictor means in Table 1. These are interior marginal means, + not an observed individual soil or a published prediction pair. + Sand 65.1% and silt 13.1% leave 21.8% clay for texture closure; + the separately rounded published clay mean is 21.9%. + Reference arithmetic directly substitutes the means into the + printed regression, multiplying factors for squared terms. + Across the extracted sets these inputs give positive water contents + ordered theta_1500 < theta_33 < theta_10. + edge_cases: [] + documentation: + notes: + - "Equation evidence: Table 3, VWC33, Set 2." + - Input ranges describe the study observations, not enforced validity limits. + warnings: + - Predictions are empirical and are not clipped to physical bounds. + implementation: + variables: + - name: theta_33 + expr: 0.3701 - 0.0029 * sand + 0.0020 * silt + - name: calc_ptf_gunarathna2019_vwc33_set3 + status: implemented + public_api: + name: calc_ptf_gunarathna2019_vwc33_set3 + result_class: null + summary: Estimate volumetric water content at -33 kPa using Set 3. + scope: + prediction_target: Volumetric water content at -33 kPa. + models: + h_theta: null + k_h: null + inputs: + - $ref: "#/$defs/sand" + - $ref: "#/$defs/silt" + - $ref: "#/$defs/bulk_density" + outputs: + type: scalar + name: theta_33 + quantity: volumetric_water_content + symbol: VWC33 + unit: volume_fraction + reported_unit: mm/mm + domain: null + description: Volumetric water content at -33 kPa matric potential. + verification_cases: + - id: published_predictor_means + kind: calculated + inputs: + sand: 65.1 + silt: 13.1 + bulk_density: 1.49 + expected: + theta_33: 0.207088 + rationale: >- + Calculated from Table 3, VWC33, Set 3, using the required + predictor means in Table 1. These are interior marginal means, + not an observed individual soil or a published prediction pair. + Sand 65.1% and silt 13.1% leave 21.8% clay for texture closure; + the separately rounded published clay mean is 21.9%. + Reference arithmetic directly substitutes the means into the + printed regression, multiplying factors for squared terms. + Across the extracted sets these inputs give positive water contents + ordered theta_1500 < theta_33 < theta_10. + edge_cases: [] + documentation: + notes: + - "Equation evidence: Table 3, VWC33, Set 3." + - Input ranges describe the study observations, not enforced validity limits. + warnings: + - Predictions are empirical and are not clipped to physical bounds. + implementation: + variables: + - name: theta_33 + expr: 0.4236 - 0.0028 * sand + 0.0018 * silt - 0.0388 * bulk_density + - name: calc_ptf_gunarathna2019_vwc33_set4 + status: implemented + public_api: + name: calc_ptf_gunarathna2019_vwc33_set4 + result_class: null + summary: Estimate volumetric water content at -33 kPa using Set 4. + scope: + prediction_target: Volumetric water content at -33 kPa. + models: + h_theta: null + k_h: null + inputs: + - $ref: "#/$defs/sand" + - $ref: "#/$defs/silt" + - $ref: "#/$defs/organic_carbon" + outputs: + type: scalar + name: theta_33 + quantity: volumetric_water_content + symbol: VWC33 + unit: volume_fraction + reported_unit: mm/mm + domain: null + description: Volumetric water content at -33 kPa matric potential. + verification_cases: + - id: published_predictor_means + kind: calculated + inputs: + sand: 65.1 + silt: 13.1 + organic_carbon: 0.6 + expected: + theta_33: 0.205046 + rationale: >- + Calculated from Table 3, VWC33, Set 4, using the required + predictor means in Table 1. These are interior marginal means, + not an observed individual soil or a published prediction pair. + Sand 65.1% and silt 13.1% leave 21.8% clay for texture closure; + the separately rounded published clay mean is 21.9%. + Reference arithmetic directly substitutes the means into the + printed regression, multiplying factors for squared terms. + Across the extracted sets these inputs give positive water contents + ordered theta_1500 < theta_33 < theta_10. + edge_cases: [] + documentation: + notes: + - "Equation evidence: Table 3, VWC33, Set 4." + - Input ranges describe the study observations, not enforced validity limits. + warnings: + - Predictions are empirical and are not clipped to physical bounds. + implementation: + variables: + - name: theta_33 + expr: 0.3686 - 0.0029 * sand + 0.0018 * silt + 0.0046 * organic_carbon ^ 2 + - name: calc_ptf_gunarathna2019_vwc1500_set1 + status: implemented + public_api: + name: calc_ptf_gunarathna2019_vwc1500_set1 + result_class: null + summary: Estimate volumetric water content at -1500 kPa using Set 1. + scope: + prediction_target: Volumetric water content at -1500 kPa. + models: + h_theta: null + k_h: null + inputs: + - $ref: "#/$defs/sand" + outputs: + type: scalar + name: theta_1500 + quantity: volumetric_water_content + symbol: VWC1500 + unit: volume_fraction + reported_unit: mm/mm + domain: null + description: Volumetric water content at -1500 kPa matric potential. + verification_cases: + - id: published_predictor_means + kind: calculated + inputs: + sand: 65.1 + expected: + theta_1500: 0.1473 + rationale: >- + Calculated from Table 3, VWC1500, Set 1, using the required + predictor means in Table 1. These are interior marginal means, + not an observed individual soil or a published prediction pair. + Sand 65.1% and silt 13.1% leave 21.8% clay for texture closure; + the separately rounded published clay mean is 21.9%. + Reference arithmetic directly substitutes the means into the + printed regression, multiplying factors for squared terms. + Across the extracted sets these inputs give positive water contents + ordered theta_1500 < theta_33 < theta_10. + edge_cases: [] + documentation: + notes: + - "Equation evidence: Table 3, VWC1500, Set 1." + - Input ranges describe the study observations, not enforced validity limits. + warnings: + - Predictions are empirical and are not clipped to physical bounds. + - "Section 3.1 reports slight overprediction above 66% sand at this pressure." + implementation: + variables: + - name: theta_1500 + expr: 0.3426 - 0.003 * sand + - name: calc_ptf_gunarathna2019_vwc1500_set3 + status: implemented + public_api: + name: calc_ptf_gunarathna2019_vwc1500_set3 + result_class: null + summary: Estimate volumetric water content at -1500 kPa using Set 3. + scope: + prediction_target: Volumetric water content at -1500 kPa. + models: + h_theta: null + k_h: null + inputs: + - $ref: "#/$defs/sand" + - $ref: "#/$defs/bulk_density" + outputs: + type: scalar + name: theta_1500 + quantity: volumetric_water_content + symbol: VWC1500 + unit: volume_fraction + reported_unit: mm/mm + domain: null + description: Volumetric water content at -1500 kPa matric potential. + verification_cases: + - id: published_predictor_means + kind: calculated + inputs: + sand: 65.1 + bulk_density: 1.49 + expected: + theta_1500: 0.14329969 + rationale: >- + Calculated from Table 3, VWC1500, Set 3, using the required + predictor means in Table 1. These are interior marginal means, + not an observed individual soil or a published prediction pair. + Sand 65.1% and silt 13.1% leave 21.8% clay for texture closure; + the separately rounded published clay mean is 21.9%. + Reference arithmetic directly substitutes the means into the + printed regression, multiplying factors for squared terms. + Across the extracted sets these inputs give positive water contents + ordered theta_1500 < theta_33 < theta_10. + edge_cases: [] + documentation: + notes: + - "Equation evidence: Table 3, VWC1500, Set 3." + - Input ranges describe the study observations, not enforced validity limits. + warnings: + - Predictions are empirical and are not clipped to physical bounds. + implementation: + variables: + - name: theta_1500 + expr: 0.6397 - 0.0028 * sand - 0.385 * bulk_density + 0.1169 * bulk_density ^ 2 + - name: calc_ptf_gunarathna2019_vwc1500_set4 + status: implemented + public_api: + name: calc_ptf_gunarathna2019_vwc1500_set4 + result_class: null + summary: Estimate volumetric water content at -1500 kPa using Set 4. + scope: + prediction_target: Volumetric water content at -1500 kPa. + models: + h_theta: null + k_h: null + inputs: + - $ref: "#/$defs/sand" + - $ref: "#/$defs/organic_carbon" + outputs: + type: scalar + name: theta_1500 + quantity: volumetric_water_content + symbol: VWC1500 + unit: volume_fraction + reported_unit: mm/mm + domain: null + description: Volumetric water content at -1500 kPa matric potential. + verification_cases: + - id: published_predictor_means + kind: calculated + inputs: + sand: 65.1 + organic_carbon: 0.6 + expected: + theta_1500: 0.148472 + rationale: >- + Calculated from Table 3, VWC1500, Set 4, using the required + predictor means in Table 1. These are interior marginal means, + not an observed individual soil or a published prediction pair. + Sand 65.1% and silt 13.1% leave 21.8% clay for texture closure; + the separately rounded published clay mean is 21.9%. + Reference arithmetic directly substitutes the means into the + printed regression, multiplying factors for squared terms. + Across the extracted sets these inputs give positive water contents + ordered theta_1500 < theta_33 < theta_10. + edge_cases: [] + documentation: + notes: + - "Equation evidence: Table 3, VWC1500, Set 4." + - Input ranges describe the study observations, not enforced validity limits. + warnings: + - Predictions are empirical and are not clipped to physical bounds. + implementation: + variables: + - name: theta_1500 + expr: 0.3278 - 0.0028 * sand + 0.0082 * organic_carbon ^ 2 +scientific_notes: | + ## Supported models + + Table 3 publishes eleven distinct regression equations, ordered here by + pressure and then input set. Section 2 defines pressure-plate measurements + at -10, -33, and -1500 kPa. Figure 6 labels volumetric water contents mm/mm. + The approved mm/mm alias preserves their numerical volume-fraction scale. + + ## Review decisions + + Only predictors retained in each final Table 3 equation are exposed. + Table 2 lists candidate and selected attributes before final regression; + it does not require unused clay, bulk-density, or organic-carbon arguments. + Table 2 explicitly identifies squared BD and OC attributes, supporting the + interpretation of the flattened Table 3 tokens BD2 and OC2 as squares. + + The Set 2 VWC1500 row in Table 3 is empty, and Table 2 retains only sand for + that combination. No additional equation is invented for that row. + Section 2 excludes Set 5 from subsequent analysis because soil structure + was not important. There is no categorical predictor in the retained models. + + Table 3 is the coefficient authority. Automated figure descriptions in the + supplied Markdown contain discrepancies (including a VWC33 intercept of + 0.4358 and a positive VWC1500 sand slope); these are not used to replace + the explicit regression table. The prefatory research note also reports + a different VWC33 slope in a 2020 follow-up; that is a separate publication. + + The supplied bundle's older strict-golden audit is historical context. + The current extraction policy permits calculated cases when no complete + published input-prediction pair is supplied. Table 1 output means and + approximate points in automated plot descriptions are not verification + outputs. Calculated cases check arithmetic, not predictive accuracy. + No performance statistic is used as an implementation tolerance. + + ## Documented limitations + + Section 3.1 describes applicability across Sri Lankan climatic zones and + broad soil types, while the survey excludes the northern part of the country. + The authors recommend using multiple inputs when available to reduce + reliance on sand alone. Functional evaluation covers available water and + maize irrigation scheduling; it is not an additional fitted PTF. + + ## Metadata + + The supplied text identifies the authors, year, title, journal and DOI. + Volume 190 and pages 109-119 were confirmed against the publisher record: + https://www.sciencedirect.com/science/article/abs/pii/S0167198718307360 diff --git a/specs/units.yaml b/specs/units.yaml index 346ba0a..e71cfc8 100644 --- a/specs/units.yaml +++ b/specs/units.yaml @@ -1,6 +1,6 @@ volume_fraction: preferred_notation: "m^3/m^3" - aliases: ["cm^3/cm^3", "cm³/cm³", "m³/m³", "1", "dimensionless"] + aliases: ["cm^3/cm^3", "cm³/cm³", "m³/m³", "mm/mm", "1", "dimensionless"] volume_percent: preferred_notation: "% v/v" diff --git a/targets/ptfkit-native/cpp/gunarathna2019.cppm b/targets/ptfkit-native/cpp/gunarathna2019.cppm new file mode 100644 index 0000000..2ace2d8 --- /dev/null +++ b/targets/ptfkit-native/cpp/gunarathna2019.cppm @@ -0,0 +1,217 @@ +/* @generated by ptfkit-codegen; DO NOT EDIT. */ + +export module ptfkit.gunarathna2019; + +/** + * @brief Point water-retention regressions for tropical Sri Lankan soils. + * + * @details Source publication: + * Gunarathna, M. H. J. P., Sakai, K., Nakandakari, T., Momii, K., Kumari, M. K. N., & + * Amarasekara, M. G. T. S. (2019). Pedotransfer functions to estimate hydraulic properties of + * tropical Sri Lankan soils. Soil & Tillage Research, 190, 109-119. + * https://doi.org/10.1016/j.still.2019.02.009 + * @see https://doi.org/10.1016/j.still.2019.02.009 DOI: 10.1016/j.still.2019.02.009 + * + * @remark Geographic scope: + * Tropical Sri Lanka. + * + * @remark Calibration dataset: + * 323 soil horizons retained after removing samples with missing water-content data from the + * SRI-CANSOL survey of 110 profiles. The survey covers almost all soil series and land uses + * except the northern part of Sri Lanka. Models were evaluated using tenfold cross-validation. + */ + +export namespace ptfkit::gunarathna2019 { + +/** + * @brief Estimate volumetric water content at -10 kPa using Set 1. + * @param sand Sand percentage measured by sieve analysis. (%) + * @return Volumetric water content at -10 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -10 kPa. + * @note Equation evidence: Table 3, VWC10, Set 1. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + * @warning Section 3.1 reports slight overprediction above 64% sand at this pressure. + */ +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc10_set1(double sand) { + return 0.4802 - 0.0037 * sand; +} + +/** + * @brief Estimate volumetric water content at -10 kPa using Set 2. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @return Volumetric water content at -10 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -10 kPa. + * @note Equation evidence: Table 3, VWC10, Set 2. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc10_set2(double sand, double silt) { + return 0.3967 - 0.0029 * sand + 0.0025 * silt; +} + +/** + * @brief Estimate volumetric water content at -10 kPa using Set 3. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @param bulk_density Bulk density measured using undisturbed cores. (g/cm3) + * @return Volumetric water content at -10 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -10 kPa. + * @note Equation evidence: Table 3, VWC10, Set 3. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc10_set3(double sand, double silt, double bulk_density) { + return 0.4436 - 0.0028 * sand + 0.0024 * silt - 0.034 * bulk_density; +} + +/** + * @brief Estimate volumetric water content at -10 kPa using Set 4. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @param organic_carbon Organic carbon percentage measured by the Walkley-Black method. (%) + * @return Volumetric water content at -10 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -10 kPa. + * @note Equation evidence: Table 3, VWC10, Set 4. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc10_set4(double sand, double silt, double organic_carbon) { + return 0.3951 - 0.0029 * sand + 0.0023 * silt + 0.0052 * (organic_carbon * organic_carbon); +} + +/** + * @brief Estimate volumetric water content at -33 kPa using Set 1. + * @param sand Sand percentage measured by sieve analysis. (%) + * @return Volumetric water content at -33 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -33 kPa. + * @note Equation evidence: Table 3, VWC33, Set 1. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + * @warning Section 3.1 reports slight overprediction above 66% sand at this pressure. + */ +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc33_set1(double sand) { + return 0.4357 - 0.0035 * sand; +} + +/** + * @brief Estimate volumetric water content at -33 kPa using Set 2. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @return Volumetric water content at -33 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -33 kPa. + * @note Equation evidence: Table 3, VWC33, Set 2. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc33_set2(double sand, double silt) { + return 0.3701 - 0.0029 * sand + 0.0020 * silt; +} + +/** + * @brief Estimate volumetric water content at -33 kPa using Set 3. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @param bulk_density Bulk density measured using undisturbed cores. (g/cm3) + * @return Volumetric water content at -33 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -33 kPa. + * @note Equation evidence: Table 3, VWC33, Set 3. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc33_set3(double sand, double silt, double bulk_density) { + return 0.4236 - 0.0028 * sand + 0.0018 * silt - 0.0388 * bulk_density; +} + +/** + * @brief Estimate volumetric water content at -33 kPa using Set 4. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @param organic_carbon Organic carbon percentage measured by the Walkley-Black method. (%) + * @return Volumetric water content at -33 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -33 kPa. + * @note Equation evidence: Table 3, VWC33, Set 4. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc33_set4(double sand, double silt, double organic_carbon) { + return 0.3686 - 0.0029 * sand + 0.0018 * silt + 0.0046 * (organic_carbon * organic_carbon); +} + +/** + * @brief Estimate volumetric water content at -1500 kPa using Set 1. + * @param sand Sand percentage measured by sieve analysis. (%) + * @return Volumetric water content at -1500 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -1500 kPa. + * @note Equation evidence: Table 3, VWC1500, Set 1. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + * @warning Section 3.1 reports slight overprediction above 66% sand at this pressure. + */ +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc1500_set1(double sand) { + return 0.3426 - 0.003 * sand; +} + +/** + * @brief Estimate volumetric water content at -1500 kPa using Set 3. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param bulk_density Bulk density measured using undisturbed cores. (g/cm3) + * @return Volumetric water content at -1500 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -1500 kPa. + * @note Equation evidence: Table 3, VWC1500, Set 3. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc1500_set3(double sand, double bulk_density) { + return 0.6397 - 0.0028 * sand - 0.385 * bulk_density + 0.1169 * (bulk_density * bulk_density); +} + +/** + * @brief Estimate volumetric water content at -1500 kPa using Set 4. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param organic_carbon Organic carbon percentage measured by the Walkley-Black method. (%) + * @return Volumetric water content at -1500 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -1500 kPa. + * @note Equation evidence: Table 3, VWC1500, Set 4. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +[[nodiscard]] +inline double calc_ptf_gunarathna2019_vwc1500_set4(double sand, double organic_carbon) { + return 0.3278 - 0.0028 * sand + 0.0082 * (organic_carbon * organic_carbon); +} + +} // namespace ptfkit::gunarathna2019 diff --git a/targets/ptfkit-native/cpp/ptfkit.cppm b/targets/ptfkit-native/cpp/ptfkit.cppm index b2f524c..c54753f 100644 --- a/targets/ptfkit-native/cpp/ptfkit.cppm +++ b/targets/ptfkit-native/cpp/ptfkit.cppm @@ -10,6 +10,7 @@ export import ptfkit.clapp1978; export import ptfkit.cosby1984; export import ptfkit.dharumarajan2019; export import ptfkit.ferrerjulia2004; +export import ptfkit.gunarathna2019; export import ptfkit.hodnett2002; export import ptfkit.jabro1992; export import ptfkit.li2007; diff --git a/targets/ptfkit-native/include/ptfkit/gunarathna2019.h b/targets/ptfkit-native/include/ptfkit/gunarathna2019.h new file mode 100644 index 0000000..f6fe129 --- /dev/null +++ b/targets/ptfkit-native/include/ptfkit/gunarathna2019.h @@ -0,0 +1,209 @@ +/* @generated by ptfkit-codegen; DO NOT EDIT. */ + +#ifndef PTFKIT_GUNARATHNA2019_H +#define PTFKIT_GUNARATHNA2019_H + +/** + * @brief Point water-retention regressions for tropical Sri Lankan soils. + * + * @details Source publication: + * Gunarathna, M. H. J. P., Sakai, K., Nakandakari, T., Momii, K., Kumari, M. K. N., & + * Amarasekara, M. G. T. S. (2019). Pedotransfer functions to estimate hydraulic properties of + * tropical Sri Lankan soils. Soil & Tillage Research, 190, 109-119. + * https://doi.org/10.1016/j.still.2019.02.009 + * @see https://doi.org/10.1016/j.still.2019.02.009 DOI: 10.1016/j.still.2019.02.009 + * + * @remark Geographic scope: + * Tropical Sri Lanka. + * + * @remark Calibration dataset: + * 323 soil horizons retained after removing samples with missing water-content data from the + * SRI-CANSOL survey of 110 profiles. The survey covers almost all soil series and land uses + * except the northern part of Sri Lanka. Models were evaluated using tenfold cross-validation. + */ + +/** + * @brief Estimate volumetric water content at -10 kPa using Set 1. + * @param sand Sand percentage measured by sieve analysis. (%) + * @return Volumetric water content at -10 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -10 kPa. + * @note Equation evidence: Table 3, VWC10, Set 1. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + * @warning Section 3.1 reports slight overprediction above 64% sand at this pressure. + */ +static inline double calc_ptf_gunarathna2019_vwc10_set1(double sand) { + return 0.4802 - 0.0037 * sand; +} + +/** + * @brief Estimate volumetric water content at -10 kPa using Set 2. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @return Volumetric water content at -10 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -10 kPa. + * @note Equation evidence: Table 3, VWC10, Set 2. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +static inline double calc_ptf_gunarathna2019_vwc10_set2(double sand, double silt) { + return 0.3967 - 0.0029 * sand + 0.0025 * silt; +} + +/** + * @brief Estimate volumetric water content at -10 kPa using Set 3. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @param bulk_density Bulk density measured using undisturbed cores. (g/cm3) + * @return Volumetric water content at -10 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -10 kPa. + * @note Equation evidence: Table 3, VWC10, Set 3. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +static inline double calc_ptf_gunarathna2019_vwc10_set3(double sand, double silt, + double bulk_density) { + return 0.4436 - 0.0028 * sand + 0.0024 * silt - 0.034 * bulk_density; +} + +/** + * @brief Estimate volumetric water content at -10 kPa using Set 4. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @param organic_carbon Organic carbon percentage measured by the Walkley-Black method. (%) + * @return Volumetric water content at -10 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -10 kPa. + * @note Equation evidence: Table 3, VWC10, Set 4. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +static inline double calc_ptf_gunarathna2019_vwc10_set4(double sand, double silt, + double organic_carbon) { + return 0.3951 - 0.0029 * sand + 0.0023 * silt + 0.0052 * (organic_carbon * organic_carbon); +} + +/** + * @brief Estimate volumetric water content at -33 kPa using Set 1. + * @param sand Sand percentage measured by sieve analysis. (%) + * @return Volumetric water content at -33 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -33 kPa. + * @note Equation evidence: Table 3, VWC33, Set 1. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + * @warning Section 3.1 reports slight overprediction above 66% sand at this pressure. + */ +static inline double calc_ptf_gunarathna2019_vwc33_set1(double sand) { + return 0.4357 - 0.0035 * sand; +} + +/** + * @brief Estimate volumetric water content at -33 kPa using Set 2. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @return Volumetric water content at -33 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -33 kPa. + * @note Equation evidence: Table 3, VWC33, Set 2. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +static inline double calc_ptf_gunarathna2019_vwc33_set2(double sand, double silt) { + return 0.3701 - 0.0029 * sand + 0.0020 * silt; +} + +/** + * @brief Estimate volumetric water content at -33 kPa using Set 3. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @param bulk_density Bulk density measured using undisturbed cores. (g/cm3) + * @return Volumetric water content at -33 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -33 kPa. + * @note Equation evidence: Table 3, VWC33, Set 3. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +static inline double calc_ptf_gunarathna2019_vwc33_set3(double sand, double silt, + double bulk_density) { + return 0.4236 - 0.0028 * sand + 0.0018 * silt - 0.0388 * bulk_density; +} + +/** + * @brief Estimate volumetric water content at -33 kPa using Set 4. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param silt Silt percentage measured by the pipette method. (%) + * @param organic_carbon Organic carbon percentage measured by the Walkley-Black method. (%) + * @return Volumetric water content at -33 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -33 kPa. + * @note Equation evidence: Table 3, VWC33, Set 4. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +static inline double calc_ptf_gunarathna2019_vwc33_set4(double sand, double silt, + double organic_carbon) { + return 0.3686 - 0.0029 * sand + 0.0018 * silt + 0.0046 * (organic_carbon * organic_carbon); +} + +/** + * @brief Estimate volumetric water content at -1500 kPa using Set 1. + * @param sand Sand percentage measured by sieve analysis. (%) + * @return Volumetric water content at -1500 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -1500 kPa. + * @note Equation evidence: Table 3, VWC1500, Set 1. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + * @warning Section 3.1 reports slight overprediction above 66% sand at this pressure. + */ +static inline double calc_ptf_gunarathna2019_vwc1500_set1(double sand) { + return 0.3426 - 0.003 * sand; +} + +/** + * @brief Estimate volumetric water content at -1500 kPa using Set 3. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param bulk_density Bulk density measured using undisturbed cores. (g/cm3) + * @return Volumetric water content at -1500 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -1500 kPa. + * @note Equation evidence: Table 3, VWC1500, Set 3. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +static inline double calc_ptf_gunarathna2019_vwc1500_set3(double sand, double bulk_density) { + return 0.6397 - 0.0028 * sand - 0.385 * bulk_density + 0.1169 * (bulk_density * bulk_density); +} + +/** + * @brief Estimate volumetric water content at -1500 kPa using Set 4. + * @param sand Sand percentage measured by sieve analysis. (%) + * @param organic_carbon Organic carbon percentage measured by the Walkley-Black method. (%) + * @return Volumetric water content at -1500 kPa matric potential. (mm/mm) + * + * @details Prediction target: + * Volumetric water content at -1500 kPa. + * @note Equation evidence: Table 3, VWC1500, Set 4. + * @note Input ranges describe the study observations, not enforced validity limits. + * @warning Predictions are empirical and are not clipped to physical bounds. + */ +static inline double calc_ptf_gunarathna2019_vwc1500_set4(double sand, double organic_carbon) { + return 0.3278 - 0.0028 * sand + 0.0082 * (organic_carbon * organic_carbon); +} + +#endif diff --git a/targets/ptfkit-native/include/ptfkit/ptfkit.h b/targets/ptfkit-native/include/ptfkit/ptfkit.h index 2ed27a4..1b931ab 100644 --- a/targets/ptfkit-native/include/ptfkit/ptfkit.h +++ b/targets/ptfkit-native/include/ptfkit/ptfkit.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/targets/ptfkit-native/tests/c/gunarathna2019.c b/targets/ptfkit-native/tests/c/gunarathna2019.c new file mode 100644 index 0000000..60643be --- /dev/null +++ b/targets/ptfkit-native/tests/c/gunarathna2019.c @@ -0,0 +1,63 @@ +/* @generated by ptfkit-codegen; DO NOT EDIT. */ + +#include +#include "support/close_enough.h" + +int main() { + { + const double result = calc_ptf_gunarathna2019_vwc10_set1(65.1); + assert_close(result, 0.23933, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const double result = calc_ptf_gunarathna2019_vwc10_set2(65.1, 13.1); + assert_close(result, 0.24066, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const double result = calc_ptf_gunarathna2019_vwc10_set3(65.1, 13.1, 1.49); + assert_close(result, 0.2421, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const double result = calc_ptf_gunarathna2019_vwc10_set4(65.1, 13.1, 0.6); + assert_close(result, 0.238312, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const double result = calc_ptf_gunarathna2019_vwc33_set1(65.1); + assert_close(result, 0.20785, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const double result = calc_ptf_gunarathna2019_vwc33_set2(65.1, 13.1); + assert_close(result, 0.20751, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const double result = calc_ptf_gunarathna2019_vwc33_set3(65.1, 13.1, 1.49); + assert_close(result, 0.207088, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const double result = calc_ptf_gunarathna2019_vwc33_set4(65.1, 13.1, 0.6); + assert_close(result, 0.205046, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const double result = calc_ptf_gunarathna2019_vwc1500_set1(65.1); + assert_close(result, 0.1473, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const double result = calc_ptf_gunarathna2019_vwc1500_set3(65.1, 1.49); + assert_close(result, 0.14329969, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const double result = calc_ptf_gunarathna2019_vwc1500_set4(65.1, 0.6); + assert_close(result, 0.148472, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + return 0; +} diff --git a/targets/ptfkit-native/tests/cpp/gunarathna2019.cpp b/targets/ptfkit-native/tests/cpp/gunarathna2019.cpp new file mode 100644 index 0000000..092daa2 --- /dev/null +++ b/targets/ptfkit-native/tests/cpp/gunarathna2019.cpp @@ -0,0 +1,73 @@ +/* @generated by ptfkit-codegen; DO NOT EDIT. */ + +#ifdef IMPORT_UMBRELLA +import ptfkit; +#else +import ptfkit.gunarathna2019; +#endif + +#include "support/close_enough.h" + +int main() { + { + const auto result = ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc10_set1(65.1); + assert_close(result, 0.23933, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const auto result = ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc10_set2(65.1, 13.1); + assert_close(result, 0.24066, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const auto result = + ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc10_set3(65.1, 13.1, 1.49); + assert_close(result, 0.2421, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const auto result = + ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc10_set4(65.1, 13.1, 0.6); + assert_close(result, 0.238312, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const auto result = ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc33_set1(65.1); + assert_close(result, 0.20785, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const auto result = ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc33_set2(65.1, 13.1); + assert_close(result, 0.20751, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const auto result = + ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc33_set3(65.1, 13.1, 1.49); + assert_close(result, 0.207088, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const auto result = + ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc33_set4(65.1, 13.1, 0.6); + assert_close(result, 0.205046, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const auto result = ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc1500_set1(65.1); + assert_close(result, 0.1473, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const auto result = + ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc1500_set3(65.1, 1.49); + assert_close(result, 0.14329969, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + { + const auto result = ptfkit::gunarathna2019::calc_ptf_gunarathna2019_vwc1500_set4(65.1, 0.6); + assert_close(result, 0.148472, 0.001, 0.0, "volumetric_water_content", "volume_fraction", + "registry", "published_predictor_means"); + } + return 0; +} diff --git a/targets/ptfkit-py/src/ptfkit/_ptfkit.pyi b/targets/ptfkit-py/src/ptfkit/_ptfkit.pyi index 589523c..fa0c8d2 100644 --- a/targets/ptfkit-py/src/ptfkit/_ptfkit.pyi +++ b/targets/ptfkit-py/src/ptfkit/_ptfkit.pyi @@ -69,6 +69,17 @@ calc_ptf_ferrerjulia2004_ranker_texture_organic_matter: ufunc calc_ptf_ferrerjulia2004_rendzina_sand: ufunc calc_ptf_ferrerjulia2004_rendzina_texture_organic_matter: ufunc calc_ptf_ferrerjulia2004_saxton: ufunc +calc_ptf_gunarathna2019_vwc10_set1: ufunc +calc_ptf_gunarathna2019_vwc10_set2: ufunc +calc_ptf_gunarathna2019_vwc10_set3: ufunc +calc_ptf_gunarathna2019_vwc10_set4: ufunc +calc_ptf_gunarathna2019_vwc1500_set1: ufunc +calc_ptf_gunarathna2019_vwc1500_set3: ufunc +calc_ptf_gunarathna2019_vwc1500_set4: ufunc +calc_ptf_gunarathna2019_vwc33_set1: ufunc +calc_ptf_gunarathna2019_vwc33_set2: ufunc +calc_ptf_gunarathna2019_vwc33_set3: ufunc +calc_ptf_gunarathna2019_vwc33_set4: ufunc calc_ptf_hodnett2002: ufunc calc_ptf_jabro1992: ufunc calc_ptf_li2007: ufunc diff --git a/targets/ptfkit-py/src/ptfkit/gunarathna2019.c b/targets/ptfkit-py/src/ptfkit/gunarathna2019.c new file mode 100644 index 0000000..591799e --- /dev/null +++ b/targets/ptfkit-py/src/ptfkit/gunarathna2019.c @@ -0,0 +1,599 @@ +/* @generated by ptfkit-codegen; DO NOT EDIT. */ +#include +#include "ufunc.h" + +static const int calc_ptf_gunarathna2019_vwc10_set1_types[] = {NPY_DOUBLE, NPY_DOUBLE}; +static int calc_ptf_gunarathna2019_vwc10_set1_contiguous_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)strides; + (void)transferdata; + const double *in_sand = (const double *)data[0]; + double *out_theta_10 = (double *)data[1]; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = in_sand[index]; + const double ptfkit_result = calc_ptf_gunarathna2019_vwc10_set1(sand); + out_theta_10[index] = ptfkit_result; + } + return 0; +} + +static int calc_ptf_gunarathna2019_vwc10_set1_strided_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)transferdata; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = *(const double *)(data[0] + index * strides[0]); + const double ptfkit_result = calc_ptf_gunarathna2019_vwc10_set1(sand); + *(double *)(data[1] + index * strides[1]) = ptfkit_result; + } + return 0; +} +static PyType_Slot calc_ptf_gunarathna2019_vwc10_set1_slots[] = { + {NPY_METH_strided_loop, calc_ptf_gunarathna2019_vwc10_set1_strided_loop}, + {NPY_METH_contiguous_loop, calc_ptf_gunarathna2019_vwc10_set1_contiguous_loop}, + {0, NULL}, +}; +static PyArrayMethod_Spec calc_ptf_gunarathna2019_vwc10_set1_spec = { + .name = "calc_ptf_gunarathna2019_vwc10_set1", + .nin = 1, + .nout = 1, + .casting = NPY_SAME_KIND_CASTING, + .slots = calc_ptf_gunarathna2019_vwc10_set1_slots, +}; + +static const int calc_ptf_gunarathna2019_vwc10_set2_types[] = {NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE}; +static int calc_ptf_gunarathna2019_vwc10_set2_contiguous_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)strides; + (void)transferdata; + const double *in_sand = (const double *)data[0]; + const double *in_silt = (const double *)data[1]; + double *out_theta_10 = (double *)data[2]; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = in_sand[index]; + const double silt = in_silt[index]; + const double ptfkit_result = calc_ptf_gunarathna2019_vwc10_set2(sand, silt); + out_theta_10[index] = ptfkit_result; + } + return 0; +} + +static int calc_ptf_gunarathna2019_vwc10_set2_strided_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)transferdata; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = *(const double *)(data[0] + index * strides[0]); + const double silt = *(const double *)(data[1] + index * strides[1]); + const double ptfkit_result = calc_ptf_gunarathna2019_vwc10_set2(sand, silt); + *(double *)(data[2] + index * strides[2]) = ptfkit_result; + } + return 0; +} +static PyType_Slot calc_ptf_gunarathna2019_vwc10_set2_slots[] = { + {NPY_METH_strided_loop, calc_ptf_gunarathna2019_vwc10_set2_strided_loop}, + {NPY_METH_contiguous_loop, calc_ptf_gunarathna2019_vwc10_set2_contiguous_loop}, + {0, NULL}, +}; +static PyArrayMethod_Spec calc_ptf_gunarathna2019_vwc10_set2_spec = { + .name = "calc_ptf_gunarathna2019_vwc10_set2", + .nin = 2, + .nout = 1, + .casting = NPY_SAME_KIND_CASTING, + .slots = calc_ptf_gunarathna2019_vwc10_set2_slots, +}; + +static const int calc_ptf_gunarathna2019_vwc10_set3_types[] = {NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, + NPY_DOUBLE}; +static int calc_ptf_gunarathna2019_vwc10_set3_contiguous_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)strides; + (void)transferdata; + const double *in_sand = (const double *)data[0]; + const double *in_silt = (const double *)data[1]; + const double *in_bulk_density = (const double *)data[2]; + double *out_theta_10 = (double *)data[3]; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = in_sand[index]; + const double silt = in_silt[index]; + const double bulk_density = in_bulk_density[index]; + const double ptfkit_result = calc_ptf_gunarathna2019_vwc10_set3(sand, silt, bulk_density); + out_theta_10[index] = ptfkit_result; + } + return 0; +} + +static int calc_ptf_gunarathna2019_vwc10_set3_strided_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)transferdata; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = *(const double *)(data[0] + index * strides[0]); + const double silt = *(const double *)(data[1] + index * strides[1]); + const double bulk_density = *(const double *)(data[2] + index * strides[2]); + const double ptfkit_result = calc_ptf_gunarathna2019_vwc10_set3(sand, silt, bulk_density); + *(double *)(data[3] + index * strides[3]) = ptfkit_result; + } + return 0; +} +static PyType_Slot calc_ptf_gunarathna2019_vwc10_set3_slots[] = { + {NPY_METH_strided_loop, calc_ptf_gunarathna2019_vwc10_set3_strided_loop}, + {NPY_METH_contiguous_loop, calc_ptf_gunarathna2019_vwc10_set3_contiguous_loop}, + {0, NULL}, +}; +static PyArrayMethod_Spec calc_ptf_gunarathna2019_vwc10_set3_spec = { + .name = "calc_ptf_gunarathna2019_vwc10_set3", + .nin = 3, + .nout = 1, + .casting = NPY_SAME_KIND_CASTING, + .slots = calc_ptf_gunarathna2019_vwc10_set3_slots, +}; + +static const int calc_ptf_gunarathna2019_vwc10_set4_types[] = {NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, + NPY_DOUBLE}; +static int calc_ptf_gunarathna2019_vwc10_set4_contiguous_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)strides; + (void)transferdata; + const double *in_sand = (const double *)data[0]; + const double *in_silt = (const double *)data[1]; + const double *in_organic_carbon = (const double *)data[2]; + double *out_theta_10 = (double *)data[3]; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = in_sand[index]; + const double silt = in_silt[index]; + const double organic_carbon = in_organic_carbon[index]; + const double ptfkit_result = calc_ptf_gunarathna2019_vwc10_set4(sand, silt, organic_carbon); + out_theta_10[index] = ptfkit_result; + } + return 0; +} + +static int calc_ptf_gunarathna2019_vwc10_set4_strided_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)transferdata; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = *(const double *)(data[0] + index * strides[0]); + const double silt = *(const double *)(data[1] + index * strides[1]); + const double organic_carbon = *(const double *)(data[2] + index * strides[2]); + const double ptfkit_result = calc_ptf_gunarathna2019_vwc10_set4(sand, silt, organic_carbon); + *(double *)(data[3] + index * strides[3]) = ptfkit_result; + } + return 0; +} +static PyType_Slot calc_ptf_gunarathna2019_vwc10_set4_slots[] = { + {NPY_METH_strided_loop, calc_ptf_gunarathna2019_vwc10_set4_strided_loop}, + {NPY_METH_contiguous_loop, calc_ptf_gunarathna2019_vwc10_set4_contiguous_loop}, + {0, NULL}, +}; +static PyArrayMethod_Spec calc_ptf_gunarathna2019_vwc10_set4_spec = { + .name = "calc_ptf_gunarathna2019_vwc10_set4", + .nin = 3, + .nout = 1, + .casting = NPY_SAME_KIND_CASTING, + .slots = calc_ptf_gunarathna2019_vwc10_set4_slots, +}; + +static const int calc_ptf_gunarathna2019_vwc33_set1_types[] = {NPY_DOUBLE, NPY_DOUBLE}; +static int calc_ptf_gunarathna2019_vwc33_set1_contiguous_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)strides; + (void)transferdata; + const double *in_sand = (const double *)data[0]; + double *out_theta_33 = (double *)data[1]; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = in_sand[index]; + const double ptfkit_result = calc_ptf_gunarathna2019_vwc33_set1(sand); + out_theta_33[index] = ptfkit_result; + } + return 0; +} + +static int calc_ptf_gunarathna2019_vwc33_set1_strided_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)transferdata; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = *(const double *)(data[0] + index * strides[0]); + const double ptfkit_result = calc_ptf_gunarathna2019_vwc33_set1(sand); + *(double *)(data[1] + index * strides[1]) = ptfkit_result; + } + return 0; +} +static PyType_Slot calc_ptf_gunarathna2019_vwc33_set1_slots[] = { + {NPY_METH_strided_loop, calc_ptf_gunarathna2019_vwc33_set1_strided_loop}, + {NPY_METH_contiguous_loop, calc_ptf_gunarathna2019_vwc33_set1_contiguous_loop}, + {0, NULL}, +}; +static PyArrayMethod_Spec calc_ptf_gunarathna2019_vwc33_set1_spec = { + .name = "calc_ptf_gunarathna2019_vwc33_set1", + .nin = 1, + .nout = 1, + .casting = NPY_SAME_KIND_CASTING, + .slots = calc_ptf_gunarathna2019_vwc33_set1_slots, +}; + +static const int calc_ptf_gunarathna2019_vwc33_set2_types[] = {NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE}; +static int calc_ptf_gunarathna2019_vwc33_set2_contiguous_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)strides; + (void)transferdata; + const double *in_sand = (const double *)data[0]; + const double *in_silt = (const double *)data[1]; + double *out_theta_33 = (double *)data[2]; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = in_sand[index]; + const double silt = in_silt[index]; + const double ptfkit_result = calc_ptf_gunarathna2019_vwc33_set2(sand, silt); + out_theta_33[index] = ptfkit_result; + } + return 0; +} + +static int calc_ptf_gunarathna2019_vwc33_set2_strided_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)transferdata; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = *(const double *)(data[0] + index * strides[0]); + const double silt = *(const double *)(data[1] + index * strides[1]); + const double ptfkit_result = calc_ptf_gunarathna2019_vwc33_set2(sand, silt); + *(double *)(data[2] + index * strides[2]) = ptfkit_result; + } + return 0; +} +static PyType_Slot calc_ptf_gunarathna2019_vwc33_set2_slots[] = { + {NPY_METH_strided_loop, calc_ptf_gunarathna2019_vwc33_set2_strided_loop}, + {NPY_METH_contiguous_loop, calc_ptf_gunarathna2019_vwc33_set2_contiguous_loop}, + {0, NULL}, +}; +static PyArrayMethod_Spec calc_ptf_gunarathna2019_vwc33_set2_spec = { + .name = "calc_ptf_gunarathna2019_vwc33_set2", + .nin = 2, + .nout = 1, + .casting = NPY_SAME_KIND_CASTING, + .slots = calc_ptf_gunarathna2019_vwc33_set2_slots, +}; + +static const int calc_ptf_gunarathna2019_vwc33_set3_types[] = {NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, + NPY_DOUBLE}; +static int calc_ptf_gunarathna2019_vwc33_set3_contiguous_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)strides; + (void)transferdata; + const double *in_sand = (const double *)data[0]; + const double *in_silt = (const double *)data[1]; + const double *in_bulk_density = (const double *)data[2]; + double *out_theta_33 = (double *)data[3]; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = in_sand[index]; + const double silt = in_silt[index]; + const double bulk_density = in_bulk_density[index]; + const double ptfkit_result = calc_ptf_gunarathna2019_vwc33_set3(sand, silt, bulk_density); + out_theta_33[index] = ptfkit_result; + } + return 0; +} + +static int calc_ptf_gunarathna2019_vwc33_set3_strided_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)transferdata; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = *(const double *)(data[0] + index * strides[0]); + const double silt = *(const double *)(data[1] + index * strides[1]); + const double bulk_density = *(const double *)(data[2] + index * strides[2]); + const double ptfkit_result = calc_ptf_gunarathna2019_vwc33_set3(sand, silt, bulk_density); + *(double *)(data[3] + index * strides[3]) = ptfkit_result; + } + return 0; +} +static PyType_Slot calc_ptf_gunarathna2019_vwc33_set3_slots[] = { + {NPY_METH_strided_loop, calc_ptf_gunarathna2019_vwc33_set3_strided_loop}, + {NPY_METH_contiguous_loop, calc_ptf_gunarathna2019_vwc33_set3_contiguous_loop}, + {0, NULL}, +}; +static PyArrayMethod_Spec calc_ptf_gunarathna2019_vwc33_set3_spec = { + .name = "calc_ptf_gunarathna2019_vwc33_set3", + .nin = 3, + .nout = 1, + .casting = NPY_SAME_KIND_CASTING, + .slots = calc_ptf_gunarathna2019_vwc33_set3_slots, +}; + +static const int calc_ptf_gunarathna2019_vwc33_set4_types[] = {NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, + NPY_DOUBLE}; +static int calc_ptf_gunarathna2019_vwc33_set4_contiguous_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)strides; + (void)transferdata; + const double *in_sand = (const double *)data[0]; + const double *in_silt = (const double *)data[1]; + const double *in_organic_carbon = (const double *)data[2]; + double *out_theta_33 = (double *)data[3]; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = in_sand[index]; + const double silt = in_silt[index]; + const double organic_carbon = in_organic_carbon[index]; + const double ptfkit_result = calc_ptf_gunarathna2019_vwc33_set4(sand, silt, organic_carbon); + out_theta_33[index] = ptfkit_result; + } + return 0; +} + +static int calc_ptf_gunarathna2019_vwc33_set4_strided_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)transferdata; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = *(const double *)(data[0] + index * strides[0]); + const double silt = *(const double *)(data[1] + index * strides[1]); + const double organic_carbon = *(const double *)(data[2] + index * strides[2]); + const double ptfkit_result = calc_ptf_gunarathna2019_vwc33_set4(sand, silt, organic_carbon); + *(double *)(data[3] + index * strides[3]) = ptfkit_result; + } + return 0; +} +static PyType_Slot calc_ptf_gunarathna2019_vwc33_set4_slots[] = { + {NPY_METH_strided_loop, calc_ptf_gunarathna2019_vwc33_set4_strided_loop}, + {NPY_METH_contiguous_loop, calc_ptf_gunarathna2019_vwc33_set4_contiguous_loop}, + {0, NULL}, +}; +static PyArrayMethod_Spec calc_ptf_gunarathna2019_vwc33_set4_spec = { + .name = "calc_ptf_gunarathna2019_vwc33_set4", + .nin = 3, + .nout = 1, + .casting = NPY_SAME_KIND_CASTING, + .slots = calc_ptf_gunarathna2019_vwc33_set4_slots, +}; + +static const int calc_ptf_gunarathna2019_vwc1500_set1_types[] = {NPY_DOUBLE, NPY_DOUBLE}; +static int calc_ptf_gunarathna2019_vwc1500_set1_contiguous_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)strides; + (void)transferdata; + const double *in_sand = (const double *)data[0]; + double *out_theta_1500 = (double *)data[1]; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = in_sand[index]; + const double ptfkit_result = calc_ptf_gunarathna2019_vwc1500_set1(sand); + out_theta_1500[index] = ptfkit_result; + } + return 0; +} + +static int calc_ptf_gunarathna2019_vwc1500_set1_strided_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)transferdata; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = *(const double *)(data[0] + index * strides[0]); + const double ptfkit_result = calc_ptf_gunarathna2019_vwc1500_set1(sand); + *(double *)(data[1] + index * strides[1]) = ptfkit_result; + } + return 0; +} +static PyType_Slot calc_ptf_gunarathna2019_vwc1500_set1_slots[] = { + {NPY_METH_strided_loop, calc_ptf_gunarathna2019_vwc1500_set1_strided_loop}, + {NPY_METH_contiguous_loop, calc_ptf_gunarathna2019_vwc1500_set1_contiguous_loop}, + {0, NULL}, +}; +static PyArrayMethod_Spec calc_ptf_gunarathna2019_vwc1500_set1_spec = { + .name = "calc_ptf_gunarathna2019_vwc1500_set1", + .nin = 1, + .nout = 1, + .casting = NPY_SAME_KIND_CASTING, + .slots = calc_ptf_gunarathna2019_vwc1500_set1_slots, +}; + +static const int calc_ptf_gunarathna2019_vwc1500_set3_types[] = {NPY_DOUBLE, NPY_DOUBLE, + NPY_DOUBLE}; +static int calc_ptf_gunarathna2019_vwc1500_set3_contiguous_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)strides; + (void)transferdata; + const double *in_sand = (const double *)data[0]; + const double *in_bulk_density = (const double *)data[1]; + double *out_theta_1500 = (double *)data[2]; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = in_sand[index]; + const double bulk_density = in_bulk_density[index]; + const double ptfkit_result = calc_ptf_gunarathna2019_vwc1500_set3(sand, bulk_density); + out_theta_1500[index] = ptfkit_result; + } + return 0; +} + +static int calc_ptf_gunarathna2019_vwc1500_set3_strided_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)transferdata; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = *(const double *)(data[0] + index * strides[0]); + const double bulk_density = *(const double *)(data[1] + index * strides[1]); + const double ptfkit_result = calc_ptf_gunarathna2019_vwc1500_set3(sand, bulk_density); + *(double *)(data[2] + index * strides[2]) = ptfkit_result; + } + return 0; +} +static PyType_Slot calc_ptf_gunarathna2019_vwc1500_set3_slots[] = { + {NPY_METH_strided_loop, calc_ptf_gunarathna2019_vwc1500_set3_strided_loop}, + {NPY_METH_contiguous_loop, calc_ptf_gunarathna2019_vwc1500_set3_contiguous_loop}, + {0, NULL}, +}; +static PyArrayMethod_Spec calc_ptf_gunarathna2019_vwc1500_set3_spec = { + .name = "calc_ptf_gunarathna2019_vwc1500_set3", + .nin = 2, + .nout = 1, + .casting = NPY_SAME_KIND_CASTING, + .slots = calc_ptf_gunarathna2019_vwc1500_set3_slots, +}; + +static const int calc_ptf_gunarathna2019_vwc1500_set4_types[] = {NPY_DOUBLE, NPY_DOUBLE, + NPY_DOUBLE}; +static int calc_ptf_gunarathna2019_vwc1500_set4_contiguous_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)strides; + (void)transferdata; + const double *in_sand = (const double *)data[0]; + const double *in_organic_carbon = (const double *)data[1]; + double *out_theta_1500 = (double *)data[2]; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = in_sand[index]; + const double organic_carbon = in_organic_carbon[index]; + const double ptfkit_result = calc_ptf_gunarathna2019_vwc1500_set4(sand, organic_carbon); + out_theta_1500[index] = ptfkit_result; + } + return 0; +} + +static int calc_ptf_gunarathna2019_vwc1500_set4_strided_loop(PyArrayMethod_Context *context, + char *const *data, + const npy_intp *dimensions, + const npy_intp *strides, + NpyAuxData *transferdata) { + (void)context; + (void)transferdata; + for (npy_intp index = 0; index < dimensions[0]; index++) { + const double sand = *(const double *)(data[0] + index * strides[0]); + const double organic_carbon = *(const double *)(data[1] + index * strides[1]); + const double ptfkit_result = calc_ptf_gunarathna2019_vwc1500_set4(sand, organic_carbon); + *(double *)(data[2] + index * strides[2]) = ptfkit_result; + } + return 0; +} +static PyType_Slot calc_ptf_gunarathna2019_vwc1500_set4_slots[] = { + {NPY_METH_strided_loop, calc_ptf_gunarathna2019_vwc1500_set4_strided_loop}, + {NPY_METH_contiguous_loop, calc_ptf_gunarathna2019_vwc1500_set4_contiguous_loop}, + {0, NULL}, +}; +static PyArrayMethod_Spec calc_ptf_gunarathna2019_vwc1500_set4_spec = { + .name = "calc_ptf_gunarathna2019_vwc1500_set4", + .nin = 2, + .nout = 1, + .casting = NPY_SAME_KIND_CASTING, + .slots = calc_ptf_gunarathna2019_vwc1500_set4_slots, +}; + +int ptfkit_register_gunarathna2019(PyObject *module) { + if (ptfkit_add_ufunc(module, "calc_ptf_gunarathna2019_vwc10_set1", + calc_ptf_gunarathna2019_vwc10_set1_types, 1, 1, + &calc_ptf_gunarathna2019_vwc10_set1_spec) < 0) + return -1; + if (ptfkit_add_ufunc(module, "calc_ptf_gunarathna2019_vwc10_set2", + calc_ptf_gunarathna2019_vwc10_set2_types, 2, 1, + &calc_ptf_gunarathna2019_vwc10_set2_spec) < 0) + return -1; + if (ptfkit_add_ufunc(module, "calc_ptf_gunarathna2019_vwc10_set3", + calc_ptf_gunarathna2019_vwc10_set3_types, 3, 1, + &calc_ptf_gunarathna2019_vwc10_set3_spec) < 0) + return -1; + if (ptfkit_add_ufunc(module, "calc_ptf_gunarathna2019_vwc10_set4", + calc_ptf_gunarathna2019_vwc10_set4_types, 3, 1, + &calc_ptf_gunarathna2019_vwc10_set4_spec) < 0) + return -1; + if (ptfkit_add_ufunc(module, "calc_ptf_gunarathna2019_vwc33_set1", + calc_ptf_gunarathna2019_vwc33_set1_types, 1, 1, + &calc_ptf_gunarathna2019_vwc33_set1_spec) < 0) + return -1; + if (ptfkit_add_ufunc(module, "calc_ptf_gunarathna2019_vwc33_set2", + calc_ptf_gunarathna2019_vwc33_set2_types, 2, 1, + &calc_ptf_gunarathna2019_vwc33_set2_spec) < 0) + return -1; + if (ptfkit_add_ufunc(module, "calc_ptf_gunarathna2019_vwc33_set3", + calc_ptf_gunarathna2019_vwc33_set3_types, 3, 1, + &calc_ptf_gunarathna2019_vwc33_set3_spec) < 0) + return -1; + if (ptfkit_add_ufunc(module, "calc_ptf_gunarathna2019_vwc33_set4", + calc_ptf_gunarathna2019_vwc33_set4_types, 3, 1, + &calc_ptf_gunarathna2019_vwc33_set4_spec) < 0) + return -1; + if (ptfkit_add_ufunc(module, "calc_ptf_gunarathna2019_vwc1500_set1", + calc_ptf_gunarathna2019_vwc1500_set1_types, 1, 1, + &calc_ptf_gunarathna2019_vwc1500_set1_spec) < 0) + return -1; + if (ptfkit_add_ufunc(module, "calc_ptf_gunarathna2019_vwc1500_set3", + calc_ptf_gunarathna2019_vwc1500_set3_types, 2, 1, + &calc_ptf_gunarathna2019_vwc1500_set3_spec) < 0) + return -1; + if (ptfkit_add_ufunc(module, "calc_ptf_gunarathna2019_vwc1500_set4", + calc_ptf_gunarathna2019_vwc1500_set4_types, 2, 1, + &calc_ptf_gunarathna2019_vwc1500_set4_spec) < 0) + return -1; + return 0; +} diff --git a/targets/ptfkit-py/src/ptfkit/gunarathna2019.py b/targets/ptfkit-py/src/ptfkit/gunarathna2019.py new file mode 100644 index 0000000..327ec48 --- /dev/null +++ b/targets/ptfkit-py/src/ptfkit/gunarathna2019.py @@ -0,0 +1,582 @@ +# @generated by ptfkit-codegen; DO NOT EDIT. + +# ruff: noqa: I001 + +r"""Point water-retention regressions for tropical Sri Lankan soils. + +Reference: + Gunarathna, M. H. J. P., Sakai, K., Nakandakari, T., Momii, K., Kumari, M. K. N., & Amarasekara, + M. G. T. S. (2019). Pedotransfer functions to estimate hydraulic properties of tropical Sri + Lankan soils. Soil & Tillage Research, 190, 109-119. https://doi.org/10.1016/j.still.2019.02.009 + [DOI: 10.1016/j.still.2019.02.009](https://doi.org/10.1016/j.still.2019.02.009) + +Territory + +: Tropical Sri Lanka. + +Dataset + +: 323 soil horizons retained after removing samples with missing water-content data from the + SRI-CANSOL survey of 110 profiles. The survey covers almost all soil series and land uses except + the northern part of Sri Lanka. Models were evaluated using tenfold cross-validation. + +""" + +from __future__ import annotations + +from typing import TYPE_CHECKING, overload + +from ptfkit._dispatch import call as _call +from ptfkit._ptfkit import ( + calc_ptf_gunarathna2019_vwc10_set1 as _calc_ptf_gunarathna2019_vwc10_set1, + calc_ptf_gunarathna2019_vwc10_set2 as _calc_ptf_gunarathna2019_vwc10_set2, + calc_ptf_gunarathna2019_vwc10_set3 as _calc_ptf_gunarathna2019_vwc10_set3, + calc_ptf_gunarathna2019_vwc10_set4 as _calc_ptf_gunarathna2019_vwc10_set4, + calc_ptf_gunarathna2019_vwc33_set1 as _calc_ptf_gunarathna2019_vwc33_set1, + calc_ptf_gunarathna2019_vwc33_set2 as _calc_ptf_gunarathna2019_vwc33_set2, + calc_ptf_gunarathna2019_vwc33_set3 as _calc_ptf_gunarathna2019_vwc33_set3, + calc_ptf_gunarathna2019_vwc33_set4 as _calc_ptf_gunarathna2019_vwc33_set4, + calc_ptf_gunarathna2019_vwc1500_set1 as _calc_ptf_gunarathna2019_vwc1500_set1, + calc_ptf_gunarathna2019_vwc1500_set3 as _calc_ptf_gunarathna2019_vwc1500_set3, + calc_ptf_gunarathna2019_vwc1500_set4 as _calc_ptf_gunarathna2019_vwc1500_set4, +) + + +if TYPE_CHECKING: + from numpy import floating + from numpy.typing import ArrayLike, NDArray + +__all__ = [ + 'calc_ptf_gunarathna2019_vwc10_set1', + 'calc_ptf_gunarathna2019_vwc10_set2', + 'calc_ptf_gunarathna2019_vwc10_set3', + 'calc_ptf_gunarathna2019_vwc10_set4', + 'calc_ptf_gunarathna2019_vwc33_set1', + 'calc_ptf_gunarathna2019_vwc33_set2', + 'calc_ptf_gunarathna2019_vwc33_set3', + 'calc_ptf_gunarathna2019_vwc33_set4', + 'calc_ptf_gunarathna2019_vwc1500_set1', + 'calc_ptf_gunarathna2019_vwc1500_set3', + 'calc_ptf_gunarathna2019_vwc1500_set4', +] + + +@overload +def calc_ptf_gunarathna2019_vwc10_set1(*, sand: float) -> floating: ... + + +@overload +def calc_ptf_gunarathna2019_vwc10_set1( + *, + sand: ArrayLike, + out: NDArray[floating] | None = None, +) -> NDArray[floating]: ... + + +def calc_ptf_gunarathna2019_vwc10_set1( + *, + sand: float | ArrayLike, + out: NDArray[floating] | None = None, +) -> floating | NDArray[floating]: + """Estimate volumetric water content at -10 kPa using Set 1. + + Arguments: + sand: Sand percentage measured by sieve analysis. (%) + out: Optional output arrays for in-place calculation. + + Returns: + theta_10: Volumetric water content at -10 kPa matric potential. (mm/mm) + + Notes: + Prediction target: Volumetric water content at -10 kPa. + Equation evidence: Table 3, VWC10, Set 1. + Input ranges describe the study observations, not enforced validity limits. + + Warning: + Predictions are empirical and are not clipped to physical bounds. + Section 3.1 reports slight overprediction above 64% sand at this pressure. + + """ + return _call( + _calc_ptf_gunarathna2019_vwc10_set1, + sand, + out=out, + ) + + +@overload +def calc_ptf_gunarathna2019_vwc10_set2(*, sand: float, silt: float) -> floating: ... + + +@overload +def calc_ptf_gunarathna2019_vwc10_set2( + *, + sand: ArrayLike, + silt: ArrayLike, + out: NDArray[floating] | None = None, +) -> NDArray[floating]: ... + + +def calc_ptf_gunarathna2019_vwc10_set2( + *, + sand: float | ArrayLike, + silt: float | ArrayLike, + out: NDArray[floating] | None = None, +) -> floating | NDArray[floating]: + """Estimate volumetric water content at -10 kPa using Set 2. + + Arguments: + sand: Sand percentage measured by sieve analysis. (%) + silt: Silt percentage measured by the pipette method. (%) + out: Optional output arrays for in-place calculation. + + Returns: + theta_10: Volumetric water content at -10 kPa matric potential. (mm/mm) + + Notes: + Prediction target: Volumetric water content at -10 kPa. + Equation evidence: Table 3, VWC10, Set 2. + Input ranges describe the study observations, not enforced validity limits. + + Warning: + Predictions are empirical and are not clipped to physical bounds. + + """ + return _call( + _calc_ptf_gunarathna2019_vwc10_set2, + sand, + silt, + out=out, + ) + + +@overload +def calc_ptf_gunarathna2019_vwc10_set3( + *, sand: float, silt: float, bulk_density: float +) -> floating: ... + + +@overload +def calc_ptf_gunarathna2019_vwc10_set3( + *, + sand: ArrayLike, + silt: ArrayLike, + bulk_density: ArrayLike, + out: NDArray[floating] | None = None, +) -> NDArray[floating]: ... + + +def calc_ptf_gunarathna2019_vwc10_set3( + *, + sand: float | ArrayLike, + silt: float | ArrayLike, + bulk_density: float | ArrayLike, + out: NDArray[floating] | None = None, +) -> floating | NDArray[floating]: + """Estimate volumetric water content at -10 kPa using Set 3. + + Arguments: + sand: Sand percentage measured by sieve analysis. (%) + silt: Silt percentage measured by the pipette method. (%) + bulk_density: Bulk density measured using undisturbed cores. (g/cm3) + out: Optional output arrays for in-place calculation. + + Returns: + theta_10: Volumetric water content at -10 kPa matric potential. (mm/mm) + + Notes: + Prediction target: Volumetric water content at -10 kPa. + Equation evidence: Table 3, VWC10, Set 3. + Input ranges describe the study observations, not enforced validity limits. + + Warning: + Predictions are empirical and are not clipped to physical bounds. + + """ + return _call( + _calc_ptf_gunarathna2019_vwc10_set3, + sand, + silt, + bulk_density, + out=out, + ) + + +@overload +def calc_ptf_gunarathna2019_vwc10_set4( + *, sand: float, silt: float, organic_carbon: float +) -> floating: ... + + +@overload +def calc_ptf_gunarathna2019_vwc10_set4( + *, + sand: ArrayLike, + silt: ArrayLike, + organic_carbon: ArrayLike, + out: NDArray[floating] | None = None, +) -> NDArray[floating]: ... + + +def calc_ptf_gunarathna2019_vwc10_set4( + *, + sand: float | ArrayLike, + silt: float | ArrayLike, + organic_carbon: float | ArrayLike, + out: NDArray[floating] | None = None, +) -> floating | NDArray[floating]: + """Estimate volumetric water content at -10 kPa using Set 4. + + Arguments: + sand: Sand percentage measured by sieve analysis. (%) + silt: Silt percentage measured by the pipette method. (%) + organic_carbon: Organic carbon percentage measured by the Walkley-Black method. (%) + out: Optional output arrays for in-place calculation. + + Returns: + theta_10: Volumetric water content at -10 kPa matric potential. (mm/mm) + + Notes: + Prediction target: Volumetric water content at -10 kPa. + Equation evidence: Table 3, VWC10, Set 4. + Input ranges describe the study observations, not enforced validity limits. + + Warning: + Predictions are empirical and are not clipped to physical bounds. + + """ + return _call( + _calc_ptf_gunarathna2019_vwc10_set4, + sand, + silt, + organic_carbon, + out=out, + ) + + +@overload +def calc_ptf_gunarathna2019_vwc33_set1(*, sand: float) -> floating: ... + + +@overload +def calc_ptf_gunarathna2019_vwc33_set1( + *, + sand: ArrayLike, + out: NDArray[floating] | None = None, +) -> NDArray[floating]: ... + + +def calc_ptf_gunarathna2019_vwc33_set1( + *, + sand: float | ArrayLike, + out: NDArray[floating] | None = None, +) -> floating | NDArray[floating]: + """Estimate volumetric water content at -33 kPa using Set 1. + + Arguments: + sand: Sand percentage measured by sieve analysis. (%) + out: Optional output arrays for in-place calculation. + + Returns: + theta_33: Volumetric water content at -33 kPa matric potential. (mm/mm) + + Notes: + Prediction target: Volumetric water content at -33 kPa. + Equation evidence: Table 3, VWC33, Set 1. + Input ranges describe the study observations, not enforced validity limits. + + Warning: + Predictions are empirical and are not clipped to physical bounds. + Section 3.1 reports slight overprediction above 66% sand at this pressure. + + """ + return _call( + _calc_ptf_gunarathna2019_vwc33_set1, + sand, + out=out, + ) + + +@overload +def calc_ptf_gunarathna2019_vwc33_set2(*, sand: float, silt: float) -> floating: ... + + +@overload +def calc_ptf_gunarathna2019_vwc33_set2( + *, + sand: ArrayLike, + silt: ArrayLike, + out: NDArray[floating] | None = None, +) -> NDArray[floating]: ... + + +def calc_ptf_gunarathna2019_vwc33_set2( + *, + sand: float | ArrayLike, + silt: float | ArrayLike, + out: NDArray[floating] | None = None, +) -> floating | NDArray[floating]: + """Estimate volumetric water content at -33 kPa using Set 2. + + Arguments: + sand: Sand percentage measured by sieve analysis. (%) + silt: Silt percentage measured by the pipette method. (%) + out: Optional output arrays for in-place calculation. + + Returns: + theta_33: Volumetric water content at -33 kPa matric potential. (mm/mm) + + Notes: + Prediction target: Volumetric water content at -33 kPa. + Equation evidence: Table 3, VWC33, Set 2. + Input ranges describe the study observations, not enforced validity limits. + + Warning: + Predictions are empirical and are not clipped to physical bounds. + + """ + return _call( + _calc_ptf_gunarathna2019_vwc33_set2, + sand, + silt, + out=out, + ) + + +@overload +def calc_ptf_gunarathna2019_vwc33_set3( + *, sand: float, silt: float, bulk_density: float +) -> floating: ... + + +@overload +def calc_ptf_gunarathna2019_vwc33_set3( + *, + sand: ArrayLike, + silt: ArrayLike, + bulk_density: ArrayLike, + out: NDArray[floating] | None = None, +) -> NDArray[floating]: ... + + +def calc_ptf_gunarathna2019_vwc33_set3( + *, + sand: float | ArrayLike, + silt: float | ArrayLike, + bulk_density: float | ArrayLike, + out: NDArray[floating] | None = None, +) -> floating | NDArray[floating]: + """Estimate volumetric water content at -33 kPa using Set 3. + + Arguments: + sand: Sand percentage measured by sieve analysis. (%) + silt: Silt percentage measured by the pipette method. (%) + bulk_density: Bulk density measured using undisturbed cores. (g/cm3) + out: Optional output arrays for in-place calculation. + + Returns: + theta_33: Volumetric water content at -33 kPa matric potential. (mm/mm) + + Notes: + Prediction target: Volumetric water content at -33 kPa. + Equation evidence: Table 3, VWC33, Set 3. + Input ranges describe the study observations, not enforced validity limits. + + Warning: + Predictions are empirical and are not clipped to physical bounds. + + """ + return _call( + _calc_ptf_gunarathna2019_vwc33_set3, + sand, + silt, + bulk_density, + out=out, + ) + + +@overload +def calc_ptf_gunarathna2019_vwc33_set4( + *, sand: float, silt: float, organic_carbon: float +) -> floating: ... + + +@overload +def calc_ptf_gunarathna2019_vwc33_set4( + *, + sand: ArrayLike, + silt: ArrayLike, + organic_carbon: ArrayLike, + out: NDArray[floating] | None = None, +) -> NDArray[floating]: ... + + +def calc_ptf_gunarathna2019_vwc33_set4( + *, + sand: float | ArrayLike, + silt: float | ArrayLike, + organic_carbon: float | ArrayLike, + out: NDArray[floating] | None = None, +) -> floating | NDArray[floating]: + """Estimate volumetric water content at -33 kPa using Set 4. + + Arguments: + sand: Sand percentage measured by sieve analysis. (%) + silt: Silt percentage measured by the pipette method. (%) + organic_carbon: Organic carbon percentage measured by the Walkley-Black method. (%) + out: Optional output arrays for in-place calculation. + + Returns: + theta_33: Volumetric water content at -33 kPa matric potential. (mm/mm) + + Notes: + Prediction target: Volumetric water content at -33 kPa. + Equation evidence: Table 3, VWC33, Set 4. + Input ranges describe the study observations, not enforced validity limits. + + Warning: + Predictions are empirical and are not clipped to physical bounds. + + """ + return _call( + _calc_ptf_gunarathna2019_vwc33_set4, + sand, + silt, + organic_carbon, + out=out, + ) + + +@overload +def calc_ptf_gunarathna2019_vwc1500_set1(*, sand: float) -> floating: ... + + +@overload +def calc_ptf_gunarathna2019_vwc1500_set1( + *, + sand: ArrayLike, + out: NDArray[floating] | None = None, +) -> NDArray[floating]: ... + + +def calc_ptf_gunarathna2019_vwc1500_set1( + *, + sand: float | ArrayLike, + out: NDArray[floating] | None = None, +) -> floating | NDArray[floating]: + """Estimate volumetric water content at -1500 kPa using Set 1. + + Arguments: + sand: Sand percentage measured by sieve analysis. (%) + out: Optional output arrays for in-place calculation. + + Returns: + theta_1500: Volumetric water content at -1500 kPa matric potential. (mm/mm) + + Notes: + Prediction target: Volumetric water content at -1500 kPa. + Equation evidence: Table 3, VWC1500, Set 1. + Input ranges describe the study observations, not enforced validity limits. + + Warning: + Predictions are empirical and are not clipped to physical bounds. + Section 3.1 reports slight overprediction above 66% sand at this pressure. + + """ + return _call( + _calc_ptf_gunarathna2019_vwc1500_set1, + sand, + out=out, + ) + + +@overload +def calc_ptf_gunarathna2019_vwc1500_set3(*, sand: float, bulk_density: float) -> floating: ... + + +@overload +def calc_ptf_gunarathna2019_vwc1500_set3( + *, + sand: ArrayLike, + bulk_density: ArrayLike, + out: NDArray[floating] | None = None, +) -> NDArray[floating]: ... + + +def calc_ptf_gunarathna2019_vwc1500_set3( + *, + sand: float | ArrayLike, + bulk_density: float | ArrayLike, + out: NDArray[floating] | None = None, +) -> floating | NDArray[floating]: + """Estimate volumetric water content at -1500 kPa using Set 3. + + Arguments: + sand: Sand percentage measured by sieve analysis. (%) + bulk_density: Bulk density measured using undisturbed cores. (g/cm3) + out: Optional output arrays for in-place calculation. + + Returns: + theta_1500: Volumetric water content at -1500 kPa matric potential. (mm/mm) + + Notes: + Prediction target: Volumetric water content at -1500 kPa. + Equation evidence: Table 3, VWC1500, Set 3. + Input ranges describe the study observations, not enforced validity limits. + + Warning: + Predictions are empirical and are not clipped to physical bounds. + + """ + return _call( + _calc_ptf_gunarathna2019_vwc1500_set3, + sand, + bulk_density, + out=out, + ) + + +@overload +def calc_ptf_gunarathna2019_vwc1500_set4(*, sand: float, organic_carbon: float) -> floating: ... + + +@overload +def calc_ptf_gunarathna2019_vwc1500_set4( + *, + sand: ArrayLike, + organic_carbon: ArrayLike, + out: NDArray[floating] | None = None, +) -> NDArray[floating]: ... + + +def calc_ptf_gunarathna2019_vwc1500_set4( + *, + sand: float | ArrayLike, + organic_carbon: float | ArrayLike, + out: NDArray[floating] | None = None, +) -> floating | NDArray[floating]: + """Estimate volumetric water content at -1500 kPa using Set 4. + + Arguments: + sand: Sand percentage measured by sieve analysis. (%) + organic_carbon: Organic carbon percentage measured by the Walkley-Black method. (%) + out: Optional output arrays for in-place calculation. + + Returns: + theta_1500: Volumetric water content at -1500 kPa matric potential. (mm/mm) + + Notes: + Prediction target: Volumetric water content at -1500 kPa. + Equation evidence: Table 3, VWC1500, Set 4. + Input ranges describe the study observations, not enforced validity limits. + + Warning: + Predictions are empirical and are not clipped to physical bounds. + + """ + return _call( + _calc_ptf_gunarathna2019_vwc1500_set4, + sand, + organic_carbon, + out=out, + ) diff --git a/targets/ptfkit-py/src/ptfkit/ptfkit.c b/targets/ptfkit-py/src/ptfkit/ptfkit.c index 5ba70bb..7d621be 100644 --- a/targets/ptfkit-py/src/ptfkit/ptfkit.c +++ b/targets/ptfkit-py/src/ptfkit/ptfkit.c @@ -14,6 +14,7 @@ #include "cosby1984.c" #include "dharumarajan2019.c" #include "ferrerjulia2004.c" +#include "gunarathna2019.c" #include "hodnett2002.c" #include "jabro1992.c" #include "li2007.c" @@ -69,6 +70,10 @@ PyMODINIT_FUNC PyInit__ptfkit(void) { Py_DECREF(module); return NULL; } + if (ptfkit_register_gunarathna2019(module) < 0) { + Py_DECREF(module); + return NULL; + } if (ptfkit_register_hodnett2002(module) < 0) { Py_DECREF(module); return NULL; diff --git a/targets/ptfkit-py/tests/test_gunarathna2019.py b/targets/ptfkit-py/tests/test_gunarathna2019.py new file mode 100644 index 0000000..ac44212 --- /dev/null +++ b/targets/ptfkit-py/tests/test_gunarathna2019.py @@ -0,0 +1,657 @@ +# @generated by ptfkit-codegen; DO NOT EDIT. +from __future__ import annotations + +import pytest + +from _helpers import assert_close, prepare_vector_case +from ptfkit.gunarathna2019 import ( + calc_ptf_gunarathna2019_vwc10_set1, + calc_ptf_gunarathna2019_vwc10_set2, + calc_ptf_gunarathna2019_vwc10_set3, + calc_ptf_gunarathna2019_vwc10_set4, + calc_ptf_gunarathna2019_vwc33_set1, + calc_ptf_gunarathna2019_vwc33_set2, + calc_ptf_gunarathna2019_vwc33_set3, + calc_ptf_gunarathna2019_vwc33_set4, + calc_ptf_gunarathna2019_vwc1500_set1, + calc_ptf_gunarathna2019_vwc1500_set3, + calc_ptf_gunarathna2019_vwc1500_set4, +) + + +CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET1 = [ + ({'sand': 65.1}, {'theta_10': 0.23933}), +] +CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET1_IDS = [ + 'published_predictor_means', +] + + +@pytest.mark.parametrize( + ('inputs', 'expected'), + CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET1, + ids=CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET1_IDS, +) +def test_calc_ptf_gunarathna2019_vwc10_set1_verification( + inputs: dict[str, float], expected: dict[str, float] +): + result = calc_ptf_gunarathna2019_vwc10_set1(**inputs) + + assert_close( + result, + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc10_set1_array(): + inputs, expected, _out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET1) + result = calc_ptf_gunarathna2019_vwc10_set1(**inputs, out=None) + assert_close( + result[0], + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc10_set1_out(): + inputs, expected, out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET1) + result = calc_ptf_gunarathna2019_vwc10_set1(**inputs, out=out) + assert result is out + assert_close( + result[0], + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET2 = [ + ({'sand': 65.1, 'silt': 13.1}, {'theta_10': 0.24066}), +] +CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET2_IDS = [ + 'published_predictor_means', +] + + +@pytest.mark.parametrize( + ('inputs', 'expected'), + CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET2, + ids=CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET2_IDS, +) +def test_calc_ptf_gunarathna2019_vwc10_set2_verification( + inputs: dict[str, float], expected: dict[str, float] +): + result = calc_ptf_gunarathna2019_vwc10_set2(**inputs) + + assert_close( + result, + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc10_set2_array(): + inputs, expected, _out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET2) + result = calc_ptf_gunarathna2019_vwc10_set2(**inputs, out=None) + assert_close( + result[0], + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc10_set2_out(): + inputs, expected, out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET2) + result = calc_ptf_gunarathna2019_vwc10_set2(**inputs, out=out) + assert result is out + assert_close( + result[0], + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET3 = [ + ({'bulk_density': 1.49, 'sand': 65.1, 'silt': 13.1}, {'theta_10': 0.2421}), +] +CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET3_IDS = [ + 'published_predictor_means', +] + + +@pytest.mark.parametrize( + ('inputs', 'expected'), + CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET3, + ids=CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET3_IDS, +) +def test_calc_ptf_gunarathna2019_vwc10_set3_verification( + inputs: dict[str, float], expected: dict[str, float] +): + result = calc_ptf_gunarathna2019_vwc10_set3(**inputs) + + assert_close( + result, + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc10_set3_array(): + inputs, expected, _out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET3) + result = calc_ptf_gunarathna2019_vwc10_set3(**inputs, out=None) + assert_close( + result[0], + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc10_set3_out(): + inputs, expected, out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET3) + result = calc_ptf_gunarathna2019_vwc10_set3(**inputs, out=out) + assert result is out + assert_close( + result[0], + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET4 = [ + ({'organic_carbon': 0.6, 'sand': 65.1, 'silt': 13.1}, {'theta_10': 0.238312}), +] +CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET4_IDS = [ + 'published_predictor_means', +] + + +@pytest.mark.parametrize( + ('inputs', 'expected'), + CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET4, + ids=CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET4_IDS, +) +def test_calc_ptf_gunarathna2019_vwc10_set4_verification( + inputs: dict[str, float], expected: dict[str, float] +): + result = calc_ptf_gunarathna2019_vwc10_set4(**inputs) + + assert_close( + result, + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc10_set4_array(): + inputs, expected, _out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET4) + result = calc_ptf_gunarathna2019_vwc10_set4(**inputs, out=None) + assert_close( + result[0], + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc10_set4_out(): + inputs, expected, out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC10_SET4) + result = calc_ptf_gunarathna2019_vwc10_set4(**inputs, out=out) + assert result is out + assert_close( + result[0], + expected['theta_10'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET1 = [ + ({'sand': 65.1}, {'theta_33': 0.20785}), +] +CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET1_IDS = [ + 'published_predictor_means', +] + + +@pytest.mark.parametrize( + ('inputs', 'expected'), + CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET1, + ids=CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET1_IDS, +) +def test_calc_ptf_gunarathna2019_vwc33_set1_verification( + inputs: dict[str, float], expected: dict[str, float] +): + result = calc_ptf_gunarathna2019_vwc33_set1(**inputs) + + assert_close( + result, + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc33_set1_array(): + inputs, expected, _out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET1) + result = calc_ptf_gunarathna2019_vwc33_set1(**inputs, out=None) + assert_close( + result[0], + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc33_set1_out(): + inputs, expected, out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET1) + result = calc_ptf_gunarathna2019_vwc33_set1(**inputs, out=out) + assert result is out + assert_close( + result[0], + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET2 = [ + ({'sand': 65.1, 'silt': 13.1}, {'theta_33': 0.20751}), +] +CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET2_IDS = [ + 'published_predictor_means', +] + + +@pytest.mark.parametrize( + ('inputs', 'expected'), + CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET2, + ids=CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET2_IDS, +) +def test_calc_ptf_gunarathna2019_vwc33_set2_verification( + inputs: dict[str, float], expected: dict[str, float] +): + result = calc_ptf_gunarathna2019_vwc33_set2(**inputs) + + assert_close( + result, + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc33_set2_array(): + inputs, expected, _out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET2) + result = calc_ptf_gunarathna2019_vwc33_set2(**inputs, out=None) + assert_close( + result[0], + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc33_set2_out(): + inputs, expected, out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET2) + result = calc_ptf_gunarathna2019_vwc33_set2(**inputs, out=out) + assert result is out + assert_close( + result[0], + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET3 = [ + ({'bulk_density': 1.49, 'sand': 65.1, 'silt': 13.1}, {'theta_33': 0.207088}), +] +CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET3_IDS = [ + 'published_predictor_means', +] + + +@pytest.mark.parametrize( + ('inputs', 'expected'), + CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET3, + ids=CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET3_IDS, +) +def test_calc_ptf_gunarathna2019_vwc33_set3_verification( + inputs: dict[str, float], expected: dict[str, float] +): + result = calc_ptf_gunarathna2019_vwc33_set3(**inputs) + + assert_close( + result, + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc33_set3_array(): + inputs, expected, _out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET3) + result = calc_ptf_gunarathna2019_vwc33_set3(**inputs, out=None) + assert_close( + result[0], + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc33_set3_out(): + inputs, expected, out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET3) + result = calc_ptf_gunarathna2019_vwc33_set3(**inputs, out=out) + assert result is out + assert_close( + result[0], + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET4 = [ + ({'organic_carbon': 0.6, 'sand': 65.1, 'silt': 13.1}, {'theta_33': 0.205046}), +] +CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET4_IDS = [ + 'published_predictor_means', +] + + +@pytest.mark.parametrize( + ('inputs', 'expected'), + CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET4, + ids=CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET4_IDS, +) +def test_calc_ptf_gunarathna2019_vwc33_set4_verification( + inputs: dict[str, float], expected: dict[str, float] +): + result = calc_ptf_gunarathna2019_vwc33_set4(**inputs) + + assert_close( + result, + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc33_set4_array(): + inputs, expected, _out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET4) + result = calc_ptf_gunarathna2019_vwc33_set4(**inputs, out=None) + assert_close( + result[0], + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc33_set4_out(): + inputs, expected, out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC33_SET4) + result = calc_ptf_gunarathna2019_vwc33_set4(**inputs, out=out) + assert result is out + assert_close( + result[0], + expected['theta_33'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET1 = [ + ({'sand': 65.1}, {'theta_1500': 0.1473}), +] +CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET1_IDS = [ + 'published_predictor_means', +] + + +@pytest.mark.parametrize( + ('inputs', 'expected'), + CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET1, + ids=CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET1_IDS, +) +def test_calc_ptf_gunarathna2019_vwc1500_set1_verification( + inputs: dict[str, float], expected: dict[str, float] +): + result = calc_ptf_gunarathna2019_vwc1500_set1(**inputs) + + assert_close( + result, + expected['theta_1500'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc1500_set1_array(): + inputs, expected, _out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET1) + result = calc_ptf_gunarathna2019_vwc1500_set1(**inputs, out=None) + assert_close( + result[0], + expected['theta_1500'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc1500_set1_out(): + inputs, expected, out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET1) + result = calc_ptf_gunarathna2019_vwc1500_set1(**inputs, out=out) + assert result is out + assert_close( + result[0], + expected['theta_1500'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET3 = [ + ({'bulk_density': 1.49, 'sand': 65.1}, {'theta_1500': 0.14329969}), +] +CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET3_IDS = [ + 'published_predictor_means', +] + + +@pytest.mark.parametrize( + ('inputs', 'expected'), + CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET3, + ids=CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET3_IDS, +) +def test_calc_ptf_gunarathna2019_vwc1500_set3_verification( + inputs: dict[str, float], expected: dict[str, float] +): + result = calc_ptf_gunarathna2019_vwc1500_set3(**inputs) + + assert_close( + result, + expected['theta_1500'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc1500_set3_array(): + inputs, expected, _out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET3) + result = calc_ptf_gunarathna2019_vwc1500_set3(**inputs, out=None) + assert_close( + result[0], + expected['theta_1500'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc1500_set3_out(): + inputs, expected, out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET3) + result = calc_ptf_gunarathna2019_vwc1500_set3(**inputs, out=out) + assert result is out + assert_close( + result[0], + expected['theta_1500'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET4 = [ + ({'organic_carbon': 0.6, 'sand': 65.1}, {'theta_1500': 0.148472}), +] +CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET4_IDS = [ + 'published_predictor_means', +] + + +@pytest.mark.parametrize( + ('inputs', 'expected'), + CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET4, + ids=CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET4_IDS, +) +def test_calc_ptf_gunarathna2019_vwc1500_set4_verification( + inputs: dict[str, float], expected: dict[str, float] +): + result = calc_ptf_gunarathna2019_vwc1500_set4(**inputs) + + assert_close( + result, + expected['theta_1500'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc1500_set4_array(): + inputs, expected, _out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET4) + result = calc_ptf_gunarathna2019_vwc1500_set4(**inputs, out=None) + assert_close( + result[0], + expected['theta_1500'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) + + +def test_calc_ptf_gunarathna2019_vwc1500_set4_out(): + inputs, expected, out = prepare_vector_case(CASES_CALC_PTF_GUNARATHNA2019_VWC1500_SET4) + result = calc_ptf_gunarathna2019_vwc1500_set4(**inputs, out=out) + assert result is out + assert_close( + result[0], + expected['theta_1500'], + absolute=0.001, + relative=0.0, + quantity='volumetric_water_content', + unit='volume_fraction', + source='registry', + ) diff --git a/targets/ptfkit-rs/src/gunarathna2019.rs b/targets/ptfkit-rs/src/gunarathna2019.rs new file mode 100644 index 0000000..fe98524 --- /dev/null +++ b/targets/ptfkit-rs/src/gunarathna2019.rs @@ -0,0 +1,498 @@ +// @generated by ptfkit-codegen; DO NOT EDIT. + +#![doc = r"Point water-retention regressions for tropical Sri Lankan soils. + +# Reference + +Gunarathna, M. H. J. P., Sakai, K., Nakandakari, T., Momii, K., Kumari, M. K. N., & Amarasekara, +M. G. T. S. (2019). Pedotransfer functions to estimate hydraulic properties of tropical Sri +Lankan soils. Soil & Tillage Research, 190, 109-119. https://doi.org/10.1016/j.still.2019.02.009 +DOI: 10.1016/j.still.2019.02.009 (https://doi.org/10.1016/j.still.2019.02.009) + +# Territory + +Tropical Sri Lanka. + +# Dataset + +323 soil horizons retained after removing samples with missing water-content data from the +SRI-CANSOL survey of 110 profiles. The survey covers almost all soil series and land uses except +the northern part of Sri Lanka. Models were evaluated using tenfold cross-validation."] + +#[doc = r"Estimate volumetric water content at -10 kPa using Set 1. + +# Arguments + + * sand: Sand percentage measured by sieve analysis. (%) + +# Returns + + * theta_10: Volumetric water content at -10 kPa matric potential. (mm/mm) + +# Notes + +Prediction target: Volumetric water content at -10 kPa. +Equation evidence: Table 3, VWC10, Set 1. +Input ranges describe the study observations, not enforced validity limits. + +# Warnings + +Predictions are empirical and are not clipped to physical bounds. +Section 3.1 reports slight overprediction above 64% sand at this pressure."] +#[cfg_attr(feature = "inline", inline)] +#[must_use] +pub fn calc_ptf_gunarathna2019_vwc10_set1(sand: f64) -> f64 { + 0.4802f64 - 0.0037f64 * sand +} +#[cfg(test)] +mod calc_ptf_gunarathna2019_vwc10_set1_tests { + use super::*; + use crate::test_support::assert_close; + #[test] + fn published_predictor_means() { + let result = calc_ptf_gunarathna2019_vwc10_set1(65.1f64); + assert_close( + result, + 0.23933f64, + 0.001f64, + 0f64, + "volumetric_water_content", + "volume_fraction", + "registry", + ); + } +} +#[doc = r"Estimate volumetric water content at -10 kPa using Set 2. + +# Arguments + + * sand: Sand percentage measured by sieve analysis. (%) + * silt: Silt percentage measured by the pipette method. (%) + +# Returns + + * theta_10: Volumetric water content at -10 kPa matric potential. (mm/mm) + +# Notes + +Prediction target: Volumetric water content at -10 kPa. +Equation evidence: Table 3, VWC10, Set 2. +Input ranges describe the study observations, not enforced validity limits. + +# Warnings + +Predictions are empirical and are not clipped to physical bounds."] +#[cfg_attr(feature = "inline", inline)] +#[must_use] +pub fn calc_ptf_gunarathna2019_vwc10_set2(sand: f64, silt: f64) -> f64 { + 0.3967f64 - 0.0029f64 * sand + 0.0025f64 * silt +} +#[cfg(test)] +mod calc_ptf_gunarathna2019_vwc10_set2_tests { + use super::*; + use crate::test_support::assert_close; + #[test] + fn published_predictor_means() { + let result = calc_ptf_gunarathna2019_vwc10_set2(65.1f64, 13.1f64); + assert_close( + result, + 0.24066f64, + 0.001f64, + 0f64, + "volumetric_water_content", + "volume_fraction", + "registry", + ); + } +} +#[doc = r"Estimate volumetric water content at -10 kPa using Set 3. + +# Arguments + + * sand: Sand percentage measured by sieve analysis. (%) + * silt: Silt percentage measured by the pipette method. (%) + * bulk_density: Bulk density measured using undisturbed cores. (g/cm3) + +# Returns + + * theta_10: Volumetric water content at -10 kPa matric potential. (mm/mm) + +# Notes + +Prediction target: Volumetric water content at -10 kPa. +Equation evidence: Table 3, VWC10, Set 3. +Input ranges describe the study observations, not enforced validity limits. + +# Warnings + +Predictions are empirical and are not clipped to physical bounds."] +#[cfg_attr(feature = "inline", inline)] +#[must_use] +pub fn calc_ptf_gunarathna2019_vwc10_set3(sand: f64, silt: f64, bulk_density: f64) -> f64 { + 0.4436f64 - 0.0028f64 * sand + 0.0024f64 * silt - 0.034f64 * bulk_density +} +#[cfg(test)] +mod calc_ptf_gunarathna2019_vwc10_set3_tests { + use super::*; + use crate::test_support::assert_close; + #[test] + fn published_predictor_means() { + let result = calc_ptf_gunarathna2019_vwc10_set3(65.1f64, 13.1f64, 1.49f64); + assert_close( + result, + 0.2421f64, + 0.001f64, + 0f64, + "volumetric_water_content", + "volume_fraction", + "registry", + ); + } +} +#[doc = r"Estimate volumetric water content at -10 kPa using Set 4. + +# Arguments + + * sand: Sand percentage measured by sieve analysis. (%) + * silt: Silt percentage measured by the pipette method. (%) + * organic_carbon: Organic carbon percentage measured by the Walkley-Black method. (%) + +# Returns + + * theta_10: Volumetric water content at -10 kPa matric potential. (mm/mm) + +# Notes + +Prediction target: Volumetric water content at -10 kPa. +Equation evidence: Table 3, VWC10, Set 4. +Input ranges describe the study observations, not enforced validity limits. + +# Warnings + +Predictions are empirical and are not clipped to physical bounds."] +#[cfg_attr(feature = "inline", inline)] +#[must_use] +pub fn calc_ptf_gunarathna2019_vwc10_set4(sand: f64, silt: f64, organic_carbon: f64) -> f64 { + 0.3951f64 - 0.0029f64 * sand + 0.0023f64 * silt + 0.0052f64 * organic_carbon.powi(2) +} +#[cfg(test)] +mod calc_ptf_gunarathna2019_vwc10_set4_tests { + use super::*; + use crate::test_support::assert_close; + #[test] + fn published_predictor_means() { + let result = calc_ptf_gunarathna2019_vwc10_set4(65.1f64, 13.1f64, 0.6f64); + assert_close( + result, + 0.238312f64, + 0.001f64, + 0f64, + "volumetric_water_content", + "volume_fraction", + "registry", + ); + } +} +#[doc = r"Estimate volumetric water content at -33 kPa using Set 1. + +# Arguments + + * sand: Sand percentage measured by sieve analysis. (%) + +# Returns + + * theta_33: Volumetric water content at -33 kPa matric potential. (mm/mm) + +# Notes + +Prediction target: Volumetric water content at -33 kPa. +Equation evidence: Table 3, VWC33, Set 1. +Input ranges describe the study observations, not enforced validity limits. + +# Warnings + +Predictions are empirical and are not clipped to physical bounds. +Section 3.1 reports slight overprediction above 66% sand at this pressure."] +#[cfg_attr(feature = "inline", inline)] +#[must_use] +pub fn calc_ptf_gunarathna2019_vwc33_set1(sand: f64) -> f64 { + 0.4357f64 - 0.0035f64 * sand +} +#[cfg(test)] +mod calc_ptf_gunarathna2019_vwc33_set1_tests { + use super::*; + use crate::test_support::assert_close; + #[test] + fn published_predictor_means() { + let result = calc_ptf_gunarathna2019_vwc33_set1(65.1f64); + assert_close( + result, + 0.20785f64, + 0.001f64, + 0f64, + "volumetric_water_content", + "volume_fraction", + "registry", + ); + } +} +#[doc = r"Estimate volumetric water content at -33 kPa using Set 2. + +# Arguments + + * sand: Sand percentage measured by sieve analysis. (%) + * silt: Silt percentage measured by the pipette method. (%) + +# Returns + + * theta_33: Volumetric water content at -33 kPa matric potential. (mm/mm) + +# Notes + +Prediction target: Volumetric water content at -33 kPa. +Equation evidence: Table 3, VWC33, Set 2. +Input ranges describe the study observations, not enforced validity limits. + +# Warnings + +Predictions are empirical and are not clipped to physical bounds."] +#[cfg_attr(feature = "inline", inline)] +#[must_use] +pub fn calc_ptf_gunarathna2019_vwc33_set2(sand: f64, silt: f64) -> f64 { + 0.3701f64 - 0.0029f64 * sand + 0.0020f64 * silt +} +#[cfg(test)] +mod calc_ptf_gunarathna2019_vwc33_set2_tests { + use super::*; + use crate::test_support::assert_close; + #[test] + fn published_predictor_means() { + let result = calc_ptf_gunarathna2019_vwc33_set2(65.1f64, 13.1f64); + assert_close( + result, + 0.20751f64, + 0.001f64, + 0f64, + "volumetric_water_content", + "volume_fraction", + "registry", + ); + } +} +#[doc = r"Estimate volumetric water content at -33 kPa using Set 3. + +# Arguments + + * sand: Sand percentage measured by sieve analysis. (%) + * silt: Silt percentage measured by the pipette method. (%) + * bulk_density: Bulk density measured using undisturbed cores. (g/cm3) + +# Returns + + * theta_33: Volumetric water content at -33 kPa matric potential. (mm/mm) + +# Notes + +Prediction target: Volumetric water content at -33 kPa. +Equation evidence: Table 3, VWC33, Set 3. +Input ranges describe the study observations, not enforced validity limits. + +# Warnings + +Predictions are empirical and are not clipped to physical bounds."] +#[cfg_attr(feature = "inline", inline)] +#[must_use] +pub fn calc_ptf_gunarathna2019_vwc33_set3(sand: f64, silt: f64, bulk_density: f64) -> f64 { + 0.4236f64 - 0.0028f64 * sand + 0.0018f64 * silt - 0.0388f64 * bulk_density +} +#[cfg(test)] +mod calc_ptf_gunarathna2019_vwc33_set3_tests { + use super::*; + use crate::test_support::assert_close; + #[test] + fn published_predictor_means() { + let result = calc_ptf_gunarathna2019_vwc33_set3(65.1f64, 13.1f64, 1.49f64); + assert_close( + result, + 0.207088f64, + 0.001f64, + 0f64, + "volumetric_water_content", + "volume_fraction", + "registry", + ); + } +} +#[doc = r"Estimate volumetric water content at -33 kPa using Set 4. + +# Arguments + + * sand: Sand percentage measured by sieve analysis. (%) + * silt: Silt percentage measured by the pipette method. (%) + * organic_carbon: Organic carbon percentage measured by the Walkley-Black method. (%) + +# Returns + + * theta_33: Volumetric water content at -33 kPa matric potential. (mm/mm) + +# Notes + +Prediction target: Volumetric water content at -33 kPa. +Equation evidence: Table 3, VWC33, Set 4. +Input ranges describe the study observations, not enforced validity limits. + +# Warnings + +Predictions are empirical and are not clipped to physical bounds."] +#[cfg_attr(feature = "inline", inline)] +#[must_use] +pub fn calc_ptf_gunarathna2019_vwc33_set4(sand: f64, silt: f64, organic_carbon: f64) -> f64 { + 0.3686f64 - 0.0029f64 * sand + 0.0018f64 * silt + 0.0046f64 * organic_carbon.powi(2) +} +#[cfg(test)] +mod calc_ptf_gunarathna2019_vwc33_set4_tests { + use super::*; + use crate::test_support::assert_close; + #[test] + fn published_predictor_means() { + let result = calc_ptf_gunarathna2019_vwc33_set4(65.1f64, 13.1f64, 0.6f64); + assert_close( + result, + 0.205046f64, + 0.001f64, + 0f64, + "volumetric_water_content", + "volume_fraction", + "registry", + ); + } +} +#[doc = r"Estimate volumetric water content at -1500 kPa using Set 1. + +# Arguments + + * sand: Sand percentage measured by sieve analysis. (%) + +# Returns + + * theta_1500: Volumetric water content at -1500 kPa matric potential. (mm/mm) + +# Notes + +Prediction target: Volumetric water content at -1500 kPa. +Equation evidence: Table 3, VWC1500, Set 1. +Input ranges describe the study observations, not enforced validity limits. + +# Warnings + +Predictions are empirical and are not clipped to physical bounds. +Section 3.1 reports slight overprediction above 66% sand at this pressure."] +#[cfg_attr(feature = "inline", inline)] +#[must_use] +pub fn calc_ptf_gunarathna2019_vwc1500_set1(sand: f64) -> f64 { + 0.3426f64 - 0.003f64 * sand +} +#[cfg(test)] +mod calc_ptf_gunarathna2019_vwc1500_set1_tests { + use super::*; + use crate::test_support::assert_close; + #[test] + fn published_predictor_means() { + let result = calc_ptf_gunarathna2019_vwc1500_set1(65.1f64); + assert_close( + result, + 0.1473f64, + 0.001f64, + 0f64, + "volumetric_water_content", + "volume_fraction", + "registry", + ); + } +} +#[doc = r"Estimate volumetric water content at -1500 kPa using Set 3. + +# Arguments + + * sand: Sand percentage measured by sieve analysis. (%) + * bulk_density: Bulk density measured using undisturbed cores. (g/cm3) + +# Returns + + * theta_1500: Volumetric water content at -1500 kPa matric potential. (mm/mm) + +# Notes + +Prediction target: Volumetric water content at -1500 kPa. +Equation evidence: Table 3, VWC1500, Set 3. +Input ranges describe the study observations, not enforced validity limits. + +# Warnings + +Predictions are empirical and are not clipped to physical bounds."] +#[cfg_attr(feature = "inline", inline)] +#[must_use] +pub fn calc_ptf_gunarathna2019_vwc1500_set3(sand: f64, bulk_density: f64) -> f64 { + 0.6397f64 - 0.0028f64 * sand - 0.385f64 * bulk_density + 0.1169f64 * bulk_density.powi(2) +} +#[cfg(test)] +mod calc_ptf_gunarathna2019_vwc1500_set3_tests { + use super::*; + use crate::test_support::assert_close; + #[test] + fn published_predictor_means() { + let result = calc_ptf_gunarathna2019_vwc1500_set3(65.1f64, 1.49f64); + assert_close( + result, + 0.14329969f64, + 0.001f64, + 0f64, + "volumetric_water_content", + "volume_fraction", + "registry", + ); + } +} +#[doc = r"Estimate volumetric water content at -1500 kPa using Set 4. + +# Arguments + + * sand: Sand percentage measured by sieve analysis. (%) + * organic_carbon: Organic carbon percentage measured by the Walkley-Black method. (%) + +# Returns + + * theta_1500: Volumetric water content at -1500 kPa matric potential. (mm/mm) + +# Notes + +Prediction target: Volumetric water content at -1500 kPa. +Equation evidence: Table 3, VWC1500, Set 4. +Input ranges describe the study observations, not enforced validity limits. + +# Warnings + +Predictions are empirical and are not clipped to physical bounds."] +#[cfg_attr(feature = "inline", inline)] +#[must_use] +pub fn calc_ptf_gunarathna2019_vwc1500_set4(sand: f64, organic_carbon: f64) -> f64 { + 0.3278f64 - 0.0028f64 * sand + 0.0082f64 * organic_carbon.powi(2) +} +#[cfg(test)] +mod calc_ptf_gunarathna2019_vwc1500_set4_tests { + use super::*; + use crate::test_support::assert_close; + #[test] + fn published_predictor_means() { + let result = calc_ptf_gunarathna2019_vwc1500_set4(65.1f64, 0.6f64); + assert_close( + result, + 0.148472f64, + 0.001f64, + 0f64, + "volumetric_water_content", + "volume_fraction", + "registry", + ); + } +}