Ejemplo n.º 1
0
 /// <summary>Return the plant available water CAPACITY for the specified crop. Units: mm/mm</summary>
 /// <param name="soil">The soil to calculate PAWC for.</param>
 /// <param name="crop">The crop.</param>
 /// <returns></returns>
 public static double[] OfCrop(Soil soil, SoilCrop crop)
 {
     return(PAWC.PAWCInternal(soil.Water.Thickness,
                              crop.LL,
                              soil.Water.DUL,
                              crop.XF));
 }
Ejemplo n.º 2
0
        /// <summary>Calculate a layered soil water. Units: mm/mm</summary>
        public double[] SW(Soil soil)
        {
            string[] cropNames = soil.Water.Crops.Select(c => c.Name).ToArray();

            // Get the correct LL and XF
            int cropIndex = -1;

            if (RelativeTo != null)
            {
                cropIndex = StringUtilities.IndexOfCaseInsensitive(cropNames, RelativeTo);
            }
            double[] ll;
            double[] xf = null;
            double[] PAWCmm;
            if (cropIndex == -1)
            {
                ll     = soil.Water.LL15;
                PAWCmm = PAWC.OfSoilmm(soil);
            }
            else
            {
                SoilCrop crop = soil.Water.Crops[cropIndex];
                ll     = crop.LL;
                xf     = crop.XF;
                PAWCmm = PAWC.OfCropmm(soil, crop);
            }

            if (double.IsNaN(DepthWetSoil))
            {
                if (PercentMethod == InitialWater.PercentMethodEnum.FilledFromTop)
                {
                    return(SWFilledFromTop(PAWCmm, ll, soil.Water.DUL, xf));
                }
                else
                {
                    return(SWEvenlyDistributed(ll, soil.Water.DUL));
                }
            }
            else
            {
                return(SWDepthWetSoil(soil.Water.Thickness, ll, soil.Water.DUL));
            }
        }
Ejemplo n.º 3
0
 /// <summary>Return the plant available water CAPACITY for the specified crop. Units: mm</summary>
 /// <param name="soil">The soil to calculate PAWC for.</param>
 /// <param name="crop">The crop.</param>
 /// <returns></returns>
 public static double[] OfCropmm(Soil soil, SoilCrop crop)
 {
     double[] pawc = PAWC.OfCrop(soil, crop);
     return(MathUtilities.Multiply(pawc, soil.Water.Thickness));
 }