Exemplo n.º 1
0
 /// <summary>
 /// Process a LAS line while in the context of Parameters Section
 /// </summary>
 /// <param name="line">Line to be processed</param>
 /// <param name="errorMessage">Error message</param>
 /// <returns>True if processing was OK</returns>
 private bool processLineParameterSectionState(string line, ref string errorMessage)
 {
     if (IsNullOrWhiteSpace(line))
     {
         errorMessage = "Empty line.";
         return(false);
     }
     else if (line[0] == '~')
     {
         return(processSectionInitialLetter(line[1], ref errorMessage));
     }
     else if (line[0] == '#') // Comment line
     {
         return(true);
     }
     else
     {
         LASField field = processLineInformationSection(line);
         if (field.Mnemonic.Length == 0)
         {
             errorMessage = "LAS line mnemonic is empty.";
             return(false);
         }
         else
         {
             _parameterInformation.Add(field);
         }
         return(true);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Validates Curve Section
        /// </summary>
        /// <param name="errorMessage">Error message</param>
        /// <returns>True if Curve Section is valid</returns>
        private bool validateCurveSection(ref string errorMessage)
        {
            if (_curveInformation.Count == 0)
            {
                errorMessage = "Curve Section must not be empty.";
                return(false);
            }

            LASField field = _curveInformation[0];

            // Validates domain curve
            if (!field.Mnemonic.Equals("DEPT") && !field.Mnemonic.Equals("DEPTH") &&
                !field.Mnemonic.Equals("TIME"))
            {
                errorMessage = "First curve must be DEPT, DEPTH or TIME.";
                return(false);
            }

            // Validates domain unit
            switch (field.Mnemonic)
            {
            case "DEPT":
            case "DEPTH":
                switch (field.Unit)
                {
                case "M":
                case "F":
                case "FT":
                    break;

                default:
                    errorMessage = "DEPT or DEPTH only accepts M, F or FT as unit.";
                    return(false);
                }
                break;

            default:     //TIME
                // Checks if unit is empty or has : / \ - (meaning it is in a non-floating point convertible format)
                if (IsNullOrWhiteSpace(field.Unit) || !field.Unit.FirstOrDefault(isInvalidDateChar).Equals('\0'))
                {
                    errorMessage = "TIME unit must be convertible to a floating point representation of time.";
                    return(false);
                }
                break;
            }

            // Validates domain curve unit compared to START, STOP and STEP unit
            if (!field.Unit.Equals(_domainUnit))
            {
                errorMessage = string.Format("Unit {0} is different from START, STOP and STEP unit {1}", field.Unit, _domainUnit);
                return(false);
            }

            return(true);
        }