示例#1
0
        /// <summary>
        /// Load and parse a LAS file, which only contains numerical well logs.
        /// Go the quick and dirty suck it all into memory and string split approach.
        /// No error handling.
        /// Untested for LAS 3.x files or for contractor specific non-standard variations.
        /// </summary>
        /// <param name="sr">The streamreader</param>
        public Well(StreamReader sr)
        {
            var headerSegments = new List <LogHeaderSegment>();
            var resultHeader   = new WellHeaderSegments();
            var resultData     = new LogData();
            var logCount       = 0;

            // The segments of a LAS file are separated by a tilde.
            // Each type of segment has a label.
            // Start at 1, not 0 index as the because first list segment is empty
            var data     = sr.ReadToEnd();
            var segments = data.Split('~').ToList();

            segments = segments.GetRange(1, segments.Count - 1);
            foreach (var segment in segments)
            {
                // Preserve the header meta data as strings as the most likely way it will be useful.
                switch (segment[0])
                {
                case 'A':
                    // The ASCII log data.
                    if (logCount > 0)
                    // Silently bypass if the compulsory log data segment is out of order.
                    {
                        resultData = new LogData(logCount, segment);
                    }
                    break;

                case 'O':
                    // The Other segment - non-delimited text format - stored as a string.
                    // var logOHeaderSegment = new LogHeaderSegment(segment, true);
                    break;

                case 'C':
                    // The Curve names, units, API code, description.
                    // Delimited by '.' and ':' and parsed as one LogDataQuadruple per line
                    var newCHeaderSegment = new LogHeaderSegment(segment, false);
                    headerSegments.Add(newCHeaderSegment);
                    logCount = newCHeaderSegment.Data.Count;
                    break;

                default:
                    // The Version, Parameter and Well information blocks.
                    // Delimited by '.' and ':' and parsed as one LogDataQuadruple per line
                    var newDefaultHeaderSegment = new LogHeaderSegment(segment, false);
                    headerSegments.Add(newDefaultHeaderSegment);
                    break;
                }
            }
            resultHeader.Segments = headerSegments;
            Header     = resultHeader;
            Data       = resultData;
            JsonHolder = "";
        }
示例#2
0
 public Well(WellHeaderSegments header, LogData data)
 {
     Header     = header;
     Data       = data;
     JsonHolder = "";
 }
示例#3
0
 public Well()
 {
     Header     = new WellHeaderSegments();
     Data       = new LogData();
     JsonHolder = "";
 }