//------------------------------------------------------------------------------------------------

        private void CalcVPDLimitedTr()
        {
            // Calculates hourlyVPDCappedTr as the product of hourlyRUE, capped hourlyVPD and transpEffCoef

            double dmVPDThresh = 0;

            if (hourlyVPD.Max() > VPDThresh)
            {
                hourlyPotTr_VPDLimited = new List <double>();
                XYPairs interpol = new XYPairs
                {
                    X = hourlyVPD.ToArray(),
                    Y = hourlyPotDM.ToArray()
                };
                dmVPDThresh = interpol.ValueIndexed(Math.Max(VPDThresh, minVPD));

                for (int i = 0; i < 24; i++)
                {
                    if (hourlyVPD[i] > VPDThresh)
                    {
                        double trVPDThresh = dmVPDThresh * VPDThresh / transpEffCoef;                      // Hourly transpiration at VPDThresh
                        double reduction   = Math.Max(0, hourlyPotTr[i] - trVPDThresh) * HighVPDReduction; // Reduction in the part of hourly transpiration above trVPDThresh
                        hourlyPotTr_VPDLimited.Add(hourlyPotTr[i] - reduction);
                    }
                    else
                    {
                        hourlyPotTr_VPDLimited.Add(hourlyPotTr[i]);
                    }
                }
            }
            else
            {
                hourlyPotTr_VPDLimited = new List <double>(hourlyPotTr);
            }
        }
Beispiel #2
0
    static public double Linint3hrlyTemp(double tmax, double tmin, XYPairs ttFn)
    {
        // --------------------------------------------------------------------------
        // Eight interpolations of the air temperature are
        // calculated using a three-hour correction factor.
        // For each air three-hour air temperature, a value
        // is calculated.  The eight three-hour estimates
        // are then averaged to obtain the daily value.
        // --------------------------------------------------------------------------

        //Constants
        int num3hr = 24 / 3;           // number of 3 hourly temperatures

        // Local Variables
        double tot = 0.0;            // sum_of of 3 hr interpolations

        for (int period = 1; period <= num3hr; period++)
        {
            // get mean temperature for 3 hr period (oC)
            double tmean_3hour = temp_3hr(tmax, tmin, period);
            tot = tot + ttFn.ValueIndexed(tmean_3hour);
        }
        return(tot / (double)num3hr);
    }
Beispiel #3
0
 public double ValueForX(double XValue)
 {
     return(XYPairs.ValueIndexed(XValue));
 }