Esempio n. 1
0
        public List <int[]> RizeLinePointToFitPlot(string view, WellPointAndTrajectory myWell)
        {
            int xIndex = -1, yIndex = -1;

            switch (view)
            {
            case "FrontViewXZ":
                xIndex = 0;
                yIndex = 2;
                break;

            case "EndViewYZ":
                xIndex = 1;
                yIndex = 2;
                break;

            case "VerticleViewXY":
                xIndex = 0;
                yIndex = 1;
                break;
            }

            int[] myX = ResizePointToFitPlot(myWell[xIndex], Width);
            int[] myY = ResizePointToFitPlot(myWell[yIndex], Height);

            List <int[]> rizeLine = new List <int[]>();

            rizeLine.Add(myX);
            rizeLine.Add(myY);

            return(rizeLine);
        }
Esempio n. 2
0
        public void Run()
        {
            string[] pointOfView = new string[] { "FrontViewXZ", "EndViewYZ", "VerticleViewXY" }; // "FrontViewXZ", "EndViewYZ",
            for (int i = 1; i <= 8; i = i + 1)
            {
                WellPointAndTrajectory myWell = new WellPointAndTrajectory();
                string importFilePath         = "data/" + i + ".csv";

                myWell = ImportData.ReadFile(importFilePath);
                if (myWell == null)
                {
                    Console.WriteLine("Reading data from file failed.");
                    continue;
                }

                DistanceUnit           unit    = DistanceUnit.Feet;
                WellPointAndTrajectory newWell = myWell.OutputForUnitConversion(unit);

                foreach (string view in pointOfView)
                {
                    int  width = 150, height = 200;
                    Plot myPlot = new Plot(width, height);
                    myPlot.PlotWellTrajectory(view, newWell);

                    string outputFilePath = "data/" + i + "-" + view + ".txt";
                    int    saveResult     = OutputData.PrintFileAsTxt(outputFilePath, myPlot.Graph);
                    ConsoleOutputForSavingProcess(saveResult, view);
                }
            }
        }
Esempio n. 3
0
        public static WellPointAndTrajectory ReadFile(string filePath)
        {
            try
            {
                using (StreamReader myStreamReader = new StreamReader(filePath)) // filepath invalid
                {
                    WellPointAndTrajectory myWell = new WellPointAndTrajectory();
                    DistanceUnit           unit;
                    bool parsingResult = Enum.TryParse(myStreamReader.ReadLine(), out unit);
                    if (parsingResult == false)
                    {
                        Console.WriteLine("Unit unrecognized. Check first line in the file");
                        return(null);
                    }

                    String[] onePoint;
                    while (!myStreamReader.EndOfStream)
                    {
                        onePoint = myStreamReader.ReadLine().Split(',');
                        double myX = Double.Parse(onePoint[0]);  // parse error
                        double myY = Double.Parse(onePoint[1]);
                        double myZ = Double.Parse(onePoint[2]);  // index error if data loss
                        myWell.AddPoint(myX, myY, myZ, unit);
                    }

                    return(myWell);
                }
            }
            catch (FileNotFoundException ex)
            {
                // throw new FileNotFoundException($"Invalid filepath, no such file found.", ex);
                Console.WriteLine($"Invalid filepath, no such file found.\n{ex.ToString()}");
                return(null);
            }
            catch (IndexOutOfRangeException ex)
            {
                Console.WriteLine($"Point data loss, check each line has 3 coordinates.\n{ex.ToString()}");
                return(null);
            }
            catch (FormatException ex)
            {
                Console.WriteLine($"Point data parse error, check that all are double values.\n{ex.ToString()}");
                return(null);
            }
            catch (IOException ex)
            {
                Console.WriteLine(ex.ToString());
                return(null);
            }
        }
Esempio n. 4
0
        public WellPointAndTrajectory OutputForUnitConversion(DistanceUnit unit)
        {
            WellPointAndTrajectory newWell = new WellPointAndTrajectory();

            if (unit == DistanceUnit.Feet && WellPointX.Count != 0)
            {
                for (int i = 0; i < WellPointX.Count; i++)
                {
                    newWell.WellPointX.Add(this.WellPointX[i] / FeetToMeter);
                    newWell.WellPointY.Add(this.WellPointY[i] / FeetToMeter);
                    newWell.WellPointZ.Add(this.WellPointZ[i] / FeetToMeter);
                }
            }

            return(newWell);
        }
Esempio n. 5
0
        public void PlotWellTrajectory(string view, WellPointAndTrajectory myWell)
        {
            List <int[]> rizeLine = RizeLinePointToFitPlot(view, myWell);

            int[] myX = rizeLine[0];
            int[] myY = rizeLine[1];

            List <int> indexWithLargestCurvity = myWell.GetLineNodeIndexWithLargestCurvity();

            for (int i = 1; i < myY.Length; i = i + 1)
            {
                if (Graph[myY[i], myX[i]] == " ")
                {
                    Graph[myY[i], myX[i]] = "+";
                }
                ConnectingWellPoint(myX[i - 1], myY[i - 1], myX[i], myY[i]);
            }

            Graph[myY[0], myX[0]]     = @"=";
            Graph[myY[^ 1], myX[^ 1]] = @"#";