Example #1
0
        /// <summary>
        /// Enforces rule on file
        /// </summary>
        /// <param name="las">LAS file to check</param>
        public override void Enforce(LAS_File las)
        {
            LAS_Channel lc = (LAS_Channel)las.GetChannel(Channel);

            if (lc == null)
            {
                this.Status  = "NA";
                this.Comment = "Channel " + Channel + " is not defined.";
                return;
            }
            if (lc.Unit == Value)
            {
                this.Status  = "Pass";
                this.Comment = "Channel " + Channel + " has unit [" + Value + "]";
                return;
            }
            if (lc.Unit.ToUpper() == Value.ToUpper())
            {
                this.Status  = "Warning";
                this.Comment = "Channel " + Channel + " has unit [" + lc.Unit + "], but [" + Value + "] is required.";
                return;
            }
            this.Status  = Severity;
            this.Comment = "Channel " + Channel + " has unit [" + lc.Unit + "], but [" + Value + "] is required.";
            return;
        }
Example #2
0
        /// <summary>
        /// Enforces rule on file
        /// </summary>
        /// <param name="las">LAS file to check</param>
        public override void Enforce(LAS_File las)
        {
            LAS_Channel lc = (LAS_Channel)las.GetChannel(Channel);

            if (lc == null)
            {
                this.Status  = Severity;
                this.Comment = "Channel " + Channel + " is not defined";
                return;
            }
            this.Status  = "Pass";
            this.Comment = "Channel " + Channel + " is present";
            return;
        }
Example #3
0
        /// <summary>
        /// Enforces rule on file
        /// </summary>
        /// <param name="las">LAS file to check</param>
        public override void Enforce(LAS_File las)
        {
            LAS_Channel lc = (LAS_Channel)las.GetChannel(Channel);

            if (lc == null)
            {
                this.Status  = "NA";
                this.Comment = "Channel " + Channel + " is not defined";
                return;
            }
            if (!lc.IsLoaded)
            {
                this.Status  = Severity;
                this.Comment = "Channel " + Channel + " contains no data";
                return;
            }
            LAS_Channel index = (LAS_Channel)las.GetIndex();

            if (Hole != "OPEN" && Hole != "CASED")
            {
                EnforceInRange(lc, index, Double.MinValue, Double.MaxValue);
                return;
            }
            string csgString = las.GetParameter("CSGL");

            if (csgString.Length <= 0)
            {
                csgString = las.GetParameter("CSGD");
            }
            double csg = Double.NaN;

            try { csg = Convert.ToDouble(csgString); }
            catch (Exception) { }
            if (Double.IsNaN(csg))
            {
                EnforceInRange(lc, index, Double.MinValue, Double.MaxValue);
                return;
            }
            if (Hole == "OPEN")
            {
                EnforceInRange(lc, index, csg, Double.MaxValue);
            }
            else
            {
                EnforceInRange(lc, index, Double.MinValue, csg);
            }
        }
        /// <summary>
        /// Enforces rule on file
        /// </summary>
        /// <param name="las">LAS file to check</param>
        public override void Enforce(LAS_File las)
        {
            LAS_Channel lc = (LAS_Channel)las.GetChannel(Channel);

            if (lc == null)
            {
                this.Status  = "NA";
                this.Comment = "Channel " + Channel + " is not defined.";
                return;
            }
            string ret = FindValue(lc.Unit);

            if (ret.Length > 0)
            {
                this.Status  = "Pass";
                this.Comment = "Channel " + Channel + " unit is set to [" + lc.Unit + "]";
                return;
            }
            ret = FindValueUpper(lc.Unit.ToUpper());
            if (ret.Length > 0)
            {
                this.Status  = "Warning";
                this.Comment = "Channel " + Channel + " unit is set to [" + lc.Unit + "] but [" + ret + "] is required.";
                return;
            }
            this.Status = Severity;
            StringBuilder sb = new StringBuilder();

            sb.Append("Channel " + Channel + " unit is set to [" + lc.Unit + "] but one of [");
            for (int i = 0; i < Values.Count; i++)
            {
                sb.Append(Values[i]);
                if (i < Values.Count - 1)
                {
                    sb.Append(", ");
                }
            }
            sb.Append("] is required.");
            Comment = sb.ToString();
            return;
        }
Example #5
0
        /// <summary>
        /// Enforces rule on file
        /// </summary>
        /// <param name="las">LAS file to check</param>
        public override void Enforce(LAS_File las)
        {
            string lc2 = las.GetConstant(Constant);

            if (lc2.Length <= 0)
            {
                lc2 = las.GetParameter(Constant);
            }
            if (lc2.Length <= 0)
            {
                this.Status  = Severity;
                this.Comment = "Constant " + Constant + " is not defined";
                return;
            }
            double val2 = Double.NaN;

            try
            {
                val2 = Convert.ToDouble(lc2);
            }
            catch (Exception)
            {
                this.Status  = Severity;
                this.Comment = "Constant " + Constant + " is not numeric";
                return;
            }
            if (val2 == -999.25)
            {
                this.Status  = Severity;
                this.Comment = "Constant " + Constant + " is set to missing value";
                return;
            }
            Shift = val2;

            LAS_Channel lc = (LAS_Channel)las.GetChannel(Channel);

            if (lc == null)
            {
                this.Status  = "NA";
                this.Comment = "Channel " + Channel + " is not defined";
                return;
            }
            if (!lc.IsLoaded)
            {
                this.Status  = Severity;
                this.Comment = "Channel " + Channel + " contains no data";
                return;
            }
            LAS_Channel index = (LAS_Channel)las.GetIndex();

            if (Hole != "OPEN" && Hole != "CASED")
            {
                EnforceInRange(lc, index, Double.MinValue, Double.MaxValue);
                return;
            }
            string csgString = las.GetParameter("CSGL");

            if (csgString.Length <= 0)
            {
                csgString = las.GetParameter("CSGD");
            }
            double csg = Double.NaN;

            try { csg = Convert.ToDouble(csgString); }
            catch (Exception) { }
            if (Double.IsNaN(csg))
            {
                EnforceInRange(lc, index, Double.MinValue, Double.MaxValue);
                return;
            }
            if (Hole == "OPEN")
            {
                EnforceInRange(lc, index, csg + SkipBelowCasing, Double.MaxValue);
            }
            else
            {
                EnforceInRange(lc, index, Double.MinValue, csg);
            }
        }
Example #6
0
        private void EnforceInRange(LAS_Channel lc, LAS_Channel index, double indexRangeTop, double indexRangeBottom)
        {
            double min         = Double.MaxValue;
            double minIndex    = Double.NaN;
            double max         = Double.MinValue;
            double maxIndex    = Double.NaN;
            double topIndex    = Double.MaxValue;
            double bottomIndex = Double.MinValue;

            for (int i = 0; i < lc.Data.Count; i++)
            {
                double d = index.Data[i];
                if (d < indexRangeTop || indexRangeBottom < d)
                {
                    continue;
                }
                if (d < topIndex)
                {
                    topIndex = d;
                }
                if (d > bottomIndex)
                {
                    bottomIndex = d;
                }
                d = lc.Data[i];
                if (Double.IsNaN(d))
                {
                    continue;
                }
                if (d < min)
                {
                    min      = d;
                    minIndex = index.Data[i];
                }
                if (d > max)
                {
                    max      = d;
                    maxIndex = index.Data[i];
                }
            }
            if (Double.IsNaN(minIndex) || Double.IsNaN(maxIndex))
            {
                this.Status  = Severity;
                this.Comment = "Channel " + Channel + " does not contain data between "
                               + topIndex.ToString("0.000") + " and " + bottomIndex.ToString("0.000") + " " + index.Unit;
                return;
            }
            if (min < MinValueError + Shift)
            {
                this.Status  = Severity;
                this.Comment = "Channel " + Channel + " reached minimum of ["
                               + min.ToString() + "] at " + minIndex.ToString("0.000") + " " + index.Unit +
                               ", while it should be in range ["
                               + (MinValueError + Shift).ToString() + ", " + (MaxValueError + Shift).ToString() + "]";
                return;
            }
            if (max > MaxValueError + Shift)
            {
                this.Status  = Severity;
                this.Comment = "Channel " + Channel + " reached maximum of ["
                               + max.ToString() + "] at " + maxIndex.ToString("0.000") + " " + index.Unit +
                               ", while it should be in range ["
                               + (MinValueError + Shift).ToString() + ", " + (MaxValueError + Shift).ToString() + "]";
                return;
            }
            if (min < MinValueWarning + Shift)
            {
                this.Status  = "Warning";
                this.Comment = "Channel " + Channel + " reached minimum of ["
                               + min.ToString() + "] at " + minIndex.ToString("0.000") + " " + index.Unit +
                               ", while it should be in range ["
                               + (MinValueWarning + Shift).ToString() + ", " + (MaxValueWarning + Shift).ToString() + "]";
                return;
            }
            if (max > MaxValueWarning)
            {
                this.Status  = "Warning";
                this.Comment = "Channel " + Channel + " reached maximum of ["
                               + max.ToString() + "] at " + maxIndex.ToString("0.000") + " " + index.Unit +
                               ", while it should be in range ["
                               + (MinValueWarning + Shift).ToString() + ", " + (MaxValueWarning + Shift).ToString() + "]";
                return;
            }
            this.Status  = "Pass";
            this.Comment = "Channel " + Channel + " is within range ["
                           + min.ToString() + ", " + max.ToString() + "] between "
                           + topIndex.ToString("0.000") + " and " + bottomIndex.ToString("0.000") + " " + index.Unit;
            return;
        }
Example #7
0
        private void EnforceInRange(LAS_Channel lc, LAS_Channel index, double indexRangeTop, double indexRangeBottom)
        {
            int    totalCount  = 0;
            int    validCount  = 0;
            double topIndex    = Double.MaxValue;
            double bottomIndex = Double.MinValue;

            for (int i = 0; i < lc.Data.Count; i++)
            {
                double d = index.Data[i];
                if (d < indexRangeTop || indexRangeBottom < d)
                {
                    continue;
                }
                if (d < topIndex)
                {
                    topIndex = d;
                }
                if (d > bottomIndex)
                {
                    bottomIndex = d;
                }
                d = lc.Data[i];
                totalCount++;
                if (!Double.IsNaN(d))
                {
                    validCount++;
                }
            }
            if (totalCount <= 0)
            {
                this.Status  = Severity;
                this.Comment = "Channel " + Channel + " does not contain data between "
                               + topIndex.ToString("0.000") + " and " + bottomIndex.ToString("0.000") + " " + index.Unit;
                return;
            }
            double coverage = Convert.ToDouble(validCount) * 100.0 / Convert.ToDouble(totalCount);

            if (coverage < MinValueError || MaxValueError < coverage)
            {
                this.Status  = Severity;
                this.Comment = "Channel " + Channel + " has a coverage of "
                               + coverage.ToString("0.00") + "% in " + totalCount.ToString("0")
                               + " samples, while it should be in range ["
                               + MinValueError.ToString() + ", " + MaxValueError.ToString() + "]";
                return;
            }
            if (coverage < MinValueWarning || MaxValueWarning < coverage)
            {
                this.Status  = Severity;
                this.Comment = "Channel " + Channel + " has a coverage of "
                               + coverage.ToString("0.00") + "% in " + totalCount.ToString("0")
                               + " samples, while it should be in range ["
                               + MinValueWarning.ToString() + ", " + MaxValueWarning.ToString() + "]";
                return;
            }
            this.Status  = "Pass";
            this.Comment = "Channel " + Channel + " has a coverage of "
                           + coverage.ToString("0.00") + "% in " + totalCount.ToString("0")
                           + " samples from "
                           + topIndex.ToString("0.000") + " and " + bottomIndex.ToString("0.000") + " " + index.Unit;
            return;
        }