/// <summary>
        /// This method makes the changes on the settings data.
        /// </summary>
        /// <returns>True if everything went OK, otherwise false.</returns>
        public bool OnApply()
        {
            //
            float x;
            float y;
            float z;
            float radius;

            //
            if (float.TryParse(XTextBox.Text, out x) &&
                float.TryParse(YTextBox.Text, out y) &&
                float.TryParse(ZTextBox.Text, out z) &&
                float.TryParse(RadiusTextBox.Text, out radius))
            {
                if (radius <= 0)
                {
                    PetrelLogger.ErrorBox("Radius can not be negative");
                    return(false);
                }
                //
                _xyzObject.X      = x;
                _xyzObject.Y      = y;
                _xyzObject.Z      = z;
                _xyzObject.Radius = radius;
                //
                return(true);
            }
            //
            // if we are here, it means that parsing failed
            PetrelLogger.ErrorBox("One of the provided values could be parsed successfuly");
            return(false);
        }
        private void button11_Click(object sender, EventArgs e)
        {
            if (visual_cube == null)
            {
                MessageBox.Show("Select a valid Cube.");
                return;
            }
            Index3   start, end;
            ISubCube from;

            try
            {
                start = new Index3(0, 0, 0);
                end   = new Index3(visual_cube.NumSamplesIJK.I - 1, visual_cube.NumSamplesIJK.J - 1, visual_cube.NumSamplesIJK.K - 1);
                from  = visual_cube.GetSubCube(start, end);
            }
            catch (System.InvalidOperationException)
            {
                PetrelLogger.ErrorBox("NOT A PROPER INPUT CUBE");
                return;
            }
            float[, ,] vals = from.ToArray();
            Plot3D.Plot3DMainForm obj3D = new Plot3D.Plot3DMainForm(vals);
            obj3D.scube = visual_cube;
            obj3D.Show();
        }
예제 #3
0
        public void FromDensity()
        {
            //int count = Math.Min(velLog.SampleCount, densLog.SampleCount);

            List <WellLogSample> LogVel  = new List <WellLogSample>(velLog.Samples);
            List <WellLogSample> LogDens = new List <WellLogSample>(densLog.Samples);

            TwoLogCheck c2    = new TwoLogCheck(velLog, densLog);
            int         count = c2.count;

            if (count == 0)
            {
                PetrelLogger.ErrorBox("INPUT LOGS DO NOT HAVE SAME DEPTH SPACING");
                return;
            }
            double startMD = c2.startMD, endMD = c2.endMD;
            int    startVel = c2.startLog1, startDens = c2.startLog2;

            double[] Imp = new double[count];

            for (int i = 0; i < count; i++)
            {
                if (LogDens[i + startDens].Value.ToString() == "NaN")
                {
                    continue;
                }

                if (LogVel[i + startVel].Value.ToString() == "NaN")
                {
                    continue;
                }

                vel    = LogVel[i + startVel].Value;
                rhob   = LogDens[i + startDens].Value;
                Imp[i] = vel * rhob;
            }
            Borehole b1 = densLog.Borehole;

            using (ITransaction trans = DataManager.NewTransaction())
            {
                IPropertyVersionService pvs  = PetrelSystem.PropertyVersionService;
                ILogTemplate            glob = pvs.FindTemplateByMnemonics("Acoustic Impedance");
                PropertyVersion         pv   = pvs.FindOrCreate(glob);
                trans.Lock(b1);
                WellLog log = b1.Logs.CreateWellLog(pv);
                //log.Name = "rhoB";
                WellLogSample[] tsamples = new WellLogSample[count];

                for (int i2 = 0; i2 < count; i2++)
                {
                    double md  = startMD + i2 * c2.interval2;
                    float  val = (float)Imp[i2];
                    tsamples[i2] = new WellLogSample(md, val);
                }
                log.Samples = tsamples;
                trans.Commit();
            }
            PetrelLogger.InfoBox("The Impedance Log has been created in the same Well");
        }
예제 #4
0
        public void fromimpedance()
        {
            //int count;
            //count = ImpLog.SampleCount;
            List <WellLogSample> LogImp = new List <WellLogSample>(ImpLog.Samples);
            List <WellLogSample> LogVel = new List <WellLogSample>(VelLog.Samples);

            TwoLogCheck C2    = new TwoLogCheck(ImpLog, VelLog);
            int         count = C2.count;

            if (count == 0)
            {
                PetrelLogger.ErrorBox("INPUT LOGS DO NOT HAVE SAME DEPTH SPACING");
                return;
            }
            int startImp = C2.startLog1, startVel = C2.startLog2;

            double[] rhob = new double[count];

            for (int i = 0; i < count; i++)
            {
                if (LogImp[i + startImp].Value.ToString() == "NaN")
                {
                    continue;
                }

                if (LogVel[i + startVel].Value.ToString() == "NaN")
                {
                    continue;
                }
                rhob[i] = (double)LogImp[i + startImp].Value / LogVel[i + startVel].Value;
            }
            Borehole b1 = ImpLog.Borehole;

            using (ITransaction trans = DataManager.NewTransaction())
            {
                IPropertyVersionService pvs  = PetrelSystem.PropertyVersionService;
                ILogTemplate            glob = pvs.FindTemplateByMnemonics("Density");
                PropertyVersion         pv   = pvs.FindOrCreate(glob);
                trans.Lock(b1);
                WellLog log = b1.Logs.CreateWellLog(pv);
                //log.Name = "rhoB";
                WellLogSample[] tsamples = new WellLogSample[count];
                for (int i2 = 0; i2 < count; i2++)
                {
                    double md  = C2.startMD + C2.interval1 * i2;
                    float  val = (float)rhob[i2];
                    tsamples[i2] = new WellLogSample(md, val);
                }
                log.Samples = tsamples;
                trans.Commit();
            }
            PetrelLogger.InfoBox("The Density Log has been created in the same Well");
        }
예제 #5
0
        private void dropTarget2_DragDrop(object sender, DragEventArgs e)
        {
            RegularHeightFieldSurface field = e.Data.GetData(typeof(object)) as RegularHeightFieldSurface;

            if (field == null)
            {
                PetrelLogger.ErrorBox("Объект не является поверхностью");
                return;
            }
            tmpargs.HeiField = field;
            UpdateUiFormArgs();
        }
        private void tgtGrid_DragDrop(object sender, DragEventArgs e)
        {
            Grid grid = e.Data.GetData(typeof(object)) as Grid;

            if (grid == null)
            {
                PetrelLogger.ErrorBox("Объект не является гридом!");
                return;
            }
            tmpargs.NovozhentsevGrid = grid;
            UpdateUIFormArgs();
        }
        private void tgtWellLog_DragDrop(object sender, DragEventArgs e)
        {
            WellLog welllog = e.Data.GetData(typeof(object)) as WellLog;

            if (welllog == null)
            {
                PetrelLogger.ErrorBox("Объект не является каротажной кривой!");
                return;
            }
            tmpargs.NovozhentsevWellLog = welllog;
            UpdateUIFormArgs();
        }
예제 #8
0
        public void FromDensDt1()
        {
            //int count = Math.Min(densLog.SampleCount, dtLog.SampleCount);
            //count = Math.Min(count, poisLog.SampleCount);
            List <WellLogSample> LogDens = new List <WellLogSample>(densLog.Samples);
            List <WellLogSample> LogDt   = new List <WellLogSample>(dtLog.Samples);
            List <WellLogSample> LogPois = new List <WellLogSample>(poisLog.Samples);

            ThreeLogCheck C1    = new ThreeLogCheck(densLog, dtLog, poisLog);
            int           count = C1.count;

            if (count == 0)
            {
                PetrelLogger.ErrorBox("INPUT LOGS DO NOT HAVE SAME DEPTH SPACING");
                return;
            }
            int startDens = C1.startLog1, startDt = C1.startLog2, startPois = C1.startLog3;

            shearmod = new double[count];

            for (int i = 0; i < count; i++)
            {
                if (LogDens[i + startDens].Value.ToString() == "NaN")
                {
                    continue;
                }

                if (LogDt[i + startDt].Value.ToString() == "NaN")
                {
                    continue;
                }

                if (LogPois[i + startPois].Value.ToString() == "NaN")
                {
                    continue;
                }

                pois        = LogPois[i + startPois].Value;
                c           = 0.5 * (1 - 2 * pois) / (1 - pois);
                dens        = LogDens[i + startDens].Value;
                dt          = LogDt[i + startDt].Value;
                shearmod[i] = c * dens * 1.34 * Math.Pow(10, 10) / (Math.Pow(dt, 2));
            }

            save(densLog, C1.count, C1.startMD, C1.interval1, shearmod, "Shear modulus");
            PetrelLogger.InfoBox("The Shear Modulus Log has been created in the same Well");
        }
 private void button2_Click(object sender, EventArgs e)
 {
     if (RHO == null || DT == null || this.porText1.Text == "" || this.waterText1.Text == "" || this.VshText1.Text == "")
     {
         PetrelLogger.ErrorBox("INVALID INPUT");
     }
     else
     {
         if (!(RHO.NumSamplesIJK.I == DT.NumSamplesIJK.I && RHO.NumSamplesIJK.J == DT.NumSamplesIJK.J || RHO.NumSamplesIJK.K == DT.NumSamplesIJK.K))
         {
             PetrelLogger.ErrorBox("Cube Dimension Mismatch");
             return;
         }
         Reservoir obj1 = new Reservoir(RHO, DT);
         obj1.rhoC      = Convert.ToInt32(this.densityClayText1.Text);
         obj1.rhoQ      = Convert.ToInt32(this.densityQuartzText1.Text);
         obj1.rhoW      = Convert.ToInt32(this.densityWaterText1.Text);
         obj1.rhoO      = Convert.ToInt32(this.densityOilText1.Text);
         obj1.Kc        = Convert.ToInt64(this.bulkClayText1.Text) * 1000000;
         obj1.Kq        = Convert.ToInt64(this.bulkQuartzText1.Text) * 1000000;
         obj1.Kw        = Convert.ToInt64(this.bulkWaterText1.Text) * 1000000;
         obj1.Ko        = Convert.ToInt64(this.bulkOilText1.Text) * 1000000;
         obj1.Gc        = Convert.ToInt64(this.shearClayText1.Text) * 1000000;
         obj1.Gq        = Convert.ToInt64(this.shearQuartzText1.Text) * 1000000;
         obj1.RPMndex   = this.comboRPM2.SelectedIndex;
         obj1.minPor    = Convert.ToDouble(this.minPorText1.Text);
         obj1.maxPor    = Convert.ToDouble(this.maxPorText1.Text);
         obj1.minWater  = Convert.ToDouble(this.minWaterText1.Text);
         obj1.maxWater  = Convert.ToDouble(this.maxWaterText1.Text);
         obj1.minClay   = Convert.ToDouble(this.minClayText1.Text);
         obj1.maxClay   = Convert.ToDouble(this.maxClayText1.Text);
         obj1.porCube   = this.porText1.Text;
         obj1.clayCube  = this.VshText1.Text;
         obj1.waterCube = this.waterText1.Text;
         obj1.quality   = this.trackQuality.Value;
         obj1.workingFunction();
     }
 }
예제 #10
0
        //double[] LogPhie, LogSw, LogVsh;
        //WellLog LogType4;

        public void fromporosity()
        {
            //int count;
            //count = porLog.SampleCount;
            List <WellLogSample> LogPhie = new List <WellLogSample>(porLog.Samples);
            List <WellLogSample> LogSw   = new List <WellLogSample>(swLog.Samples);
            List <WellLogSample> LogVsh  = new List <WellLogSample>(vshLog.Samples);
            //List<WellLogSample> LogRhob = new List<WellLogSample>(LogType4.Samples);

            ThreeLogCheck C1    = new ThreeLogCheck(porLog, swLog, vshLog);
            int           count = C1.count;

            if (count == 0)
            {
                PetrelLogger.ErrorBox("INPUT LOGS DO NOT HAVE SAME DEPTH SPACING");
                return;
            }
            int startPor = C1.startLog1, startSw = C1.startLog2, startVsh = C1.startLog3;

            double[] rhob = new double[count];

            for (int i = 0; i < count; i++)
            {
                if (LogPhie[i + startPor].Value.ToString() == "NaN")
                {
                    continue;
                }

                if (LogSw[i + startSw].Value.ToString() == "NaN")
                {
                    continue;
                }

                if (LogVsh[i + startVsh].Value.ToString() == "NaN")
                {
                    continue;
                }

                phie    = (double)LogPhie[i + startPor].Value;
                sw      = (double)LogSw[i + startSw].Value;
                vsh     = (double)LogVsh[i + startVsh].Value;
                rhof    = sw * rhow + (1 - sw) * rhoh;
                rhom    = vsh * rhosh + (1 - vsh - phie) * rhomat;
                rhob[i] = phie * rhof + rhom;
                //PetrelLogger.InfoOutputWindow(rhob.ToString());
                //LogRhob[count].Value = (float)rhob;
            }
            Borehole b1 = porLog.Borehole;

            using (ITransaction trans = DataManager.NewTransaction())
            {
                IPropertyVersionService pvs  = PetrelSystem.PropertyVersionService;
                ILogTemplate            glob = pvs.FindTemplateByMnemonics("Density");
                PropertyVersion         pv   = pvs.FindOrCreate(glob);
                trans.Lock(b1);
                WellLog log = b1.Logs.CreateWellLog(pv);
                //log.Name = "rhoB";
                WellLogSample[] tsamples = new WellLogSample[count];
                for (int i2 = 0; i2 < count; i2++)
                {
                    double md  = C1.startMD + C1.interval1 * i2;
                    float  val = (float)rhob[i2];
                    tsamples[i2] = new WellLogSample(md, val);
                }
                log.Samples = tsamples;
                trans.Commit();
            }
            PetrelLogger.InfoBox("The Density Log has been created in the same Well");
        }
예제 #11
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            CustomVectorField NewVF;

            if (tmpargs.VectorField == null)
            {
                NewVF = new CustomVectorField();
            }
            else
            {
                NewVF = tmpargs.VectorField;
            }
            NewVF.koeff = double.Parse(textBoxK.Text);
            if ((NewVF.koeff > 1.0) || (NewVF.koeff <= 0.0))
            {
                PetrelLogger.ErrorBox("Коэффициент не может быть больше 1 или меньше 0!");
                return;
            }
            NewVF.gridStep   = double.Parse(textBoxStep.Text);
            NewVF.partition  = int.Parse(textBoxN.Text);
            NewVF.haveGrid   = (comboBox1.SelectedItem.Text == "Да");
            NewVF.arrowColor = colorPicker1.Color;;
            NewVF.originX    = tmpargs.HeiField.SpatialLattice.OriginalLattice.Single.OriginX;
            NewVF.originY    = tmpargs.HeiField.SpatialLattice.OriginalLattice.Single.OriginY;
            int sizeI         = tmpargs.HeiField.SpatialLattice.OriginalLattice.Single.SizeI,
                sizeJ         = tmpargs.HeiField.SpatialLattice.OriginalLattice.Single.SizeJ;
            double maxval     = 0.0,
                   spacingI   = tmpargs.HeiField.SpatialLattice.OriginalLattice.Single.SpacingI,
                   spacingJ   = tmpargs.HeiField.SpatialLattice.OriginalLattice.Single.SpacingJ,
                   spaceSizeX = spacingI * (double)sizeI,
                   spaceSizeY = spacingJ * (double)sizeJ;

            NewVF.sizeX                = (int)Math.Floor(spaceSizeX / (double)NewVF.gridStep);
            NewVF.sizeY                = (int)Math.Floor(spaceSizeY / (double)NewVF.gridStep);
            NewVF.Azimutfieldic        = tmpargs.AzField;
            NewVF.Heigtfieldic         = tmpargs.HeiField;
            double[,] NewHeightSurface = new double[sizeI, sizeJ];
            double[,] NewAzimutSurface = new double[sizeI, sizeJ];
            foreach (RegularHeightFieldSample prop in tmpargs.HeiField.Samples)
            {
                NewHeightSurface[prop.I, prop.J] = prop.Value;
            }
            foreach (RegularHeightFieldSample prop in tmpargs.AzField.Samples)
            {
                NewAzimutSurface[prop.I, prop.J] = prop.Value;
            }
            double[, ,] VectorField = new double[NewVF.sizeX, NewVF.sizeY, 18];
            for (int i = 0; i < NewVF.sizeX; i++)
            {
                for (int j = 0; j < NewVF.sizeY; j++)
                {
                    //в каждой ячейке усредняем, берем из нее N значений значений
                    for (int k = 0; k < NewVF.partition; k++)
                    {
                        for (int l = 0; l < NewVF.partition; l++)
                        {
                            int x = (int)Math.Floor(((double)i * NewVF.gridStep + k * NewVF.gridStep / (double)NewVF.partition) / (double)spacingI),
                                y = (int)Math.Floor(((double)j * NewVF.gridStep + l * NewVF.gridStep / (double)NewVF.partition) / (double)spacingJ);
                            VectorField[i, j, 0] += NewHeightSurface[x, y];
                            VectorField[i, j, 1] += NewAzimutSurface[x, y];
                        }
                        VectorField[i, j, 0] /= (double)NewVF.partition * (double)NewVF.partition;
                        VectorField[i, j, 1] /= (double)NewVF.partition * (double)NewVF.partition;
                        if (maxval < VectorField[i, j, 0])
                        {
                            maxval = VectorField[i, j, 0];
                        }
                    }
                }
            }
            double tan, ctan;

            for (int i = 0; i < NewVF.sizeX; i++)
            {
                for (int j = 0; j < NewVF.sizeY; j++)
                {
                    VectorField[i, j, 0] /= maxval;
                    tan  = Math.Tan(Math.PI / 2.0 - VectorField[i, j, 1]);
                    ctan = 1.0 / Math.Tan(Math.PI / 2.0 - VectorField[i, j, 1]);
                    if (tan > 1.0)
                    {
                        tan = 1.0;
                    }
                    else if (tan < -1.0)
                    {
                        tan = -1.0;
                    }
                    if (ctan > 1.0)
                    {
                        ctan = 1.0;
                    }
                    else if (ctan < -1.0)
                    {
                        ctan = -1.0;
                    }
                    VectorField[i, j, 2] = NewVF.originX + ((i + 0.5 * (1.0 - ctan * NewVF.koeff * VectorField[i, j, 0])) * NewVF.gridStep);
                    VectorField[i, j, 3] = NewVF.originY + ((j + 0.5 * (1.0 - tan * NewVF.koeff * VectorField[i, j, 0])) * NewVF.gridStep);
                    VectorField[i, j, 4] = NewVF.originX + ((i + 0.5 * (1.0 + ctan * NewVF.koeff * VectorField[i, j, 0])) * NewVF.gridStep);
                    VectorField[i, j, 5] = NewVF.originY + ((j + 0.5 * (1.0 + tan * NewVF.koeff * VectorField[i, j, 0])) * NewVF.gridStep);
                    float vx   = (float)VectorField[i, j, 4] - (float)VectorField[i, j, 2];
                    float vy   = (float)VectorField[i, j, 5] - (float)VectorField[i, j, 3];
                    float dist = (float)Math.Sqrt(vx * vx + vy * vy);
                    vx /= dist;
                    vy /= dist;
                    float h   = 0.5f * dist;
                    float h1  = 0.35f * dist;
                    float w   = h * (float)1 / (float)3.0;
                    float w1  = h1 * (float)1 / (float)10.0;
                    float ox  = (float)VectorField[i, j, 4] - h * vx;
                    float oy  = (float)VectorField[i, j, 5] - h * vy;
                    float ox1 = (float)VectorField[i, j, 4] - h1 * vx;
                    float oy1 = (float)VectorField[i, j, 5] - h1 * vy;
                    VectorField[i, j, 6]  = ox + w * (VectorField[i, j, 3] - VectorField[i, j, 5]) / dist;
                    VectorField[i, j, 7]  = oy + w * (VectorField[i, j, 4] - VectorField[i, j, 2]) / dist;
                    VectorField[i, j, 8]  = ox - w * (VectorField[i, j, 3] - VectorField[i, j, 5]) / dist;
                    VectorField[i, j, 9]  = oy - w * (VectorField[i, j, 4] - VectorField[i, j, 2]) / dist;
                    VectorField[i, j, 10] = ox1 - w1 * (VectorField[i, j, 3] - VectorField[i, j, 5]) / dist;
                    VectorField[i, j, 11] = oy1 - w1 * (VectorField[i, j, 4] - VectorField[i, j, 2]) / dist;
                    VectorField[i, j, 12] = ox1 + w1 * (VectorField[i, j, 3] - VectorField[i, j, 5]) / dist;
                    VectorField[i, j, 13] = oy1 + w1 * (VectorField[i, j, 4] - VectorField[i, j, 2]) / dist;
                    VectorField[i, j, 14] = (float)VectorField[i, j, 2] - w1 * (VectorField[i, j, 3] - VectorField[i, j, 5]) / dist;
                    VectorField[i, j, 15] = (float)VectorField[i, j, 3] - w1 * (VectorField[i, j, 4] - VectorField[i, j, 2]) / dist;
                    VectorField[i, j, 16] = (float)VectorField[i, j, 2] + w1 * (VectorField[i, j, 3] - VectorField[i, j, 5]) / dist;
                    VectorField[i, j, 17] = (float)VectorField[i, j, 3] + w1 * (VectorField[i, j, 4] - VectorField[i, j, 2]) / dist;
                }
            }
            NewVF.VectorField = VectorField;
            if (tmpargs.VectorField == null)
            {
                tmpargs.VectorField = NewVF;
                using (ITransaction txn = DataManager.NewTransaction())
                {
                    Project proj = PetrelProject.PrimaryProject;
                    txn.Lock(proj);
                    proj.Extensions.Add(tmpargs.VectorField);



                    txn.Commit();
                }
            }
            MapWindow map = PetrelProject.ToggleWindows.Add(WellKnownWindows.Map) as MapWindow;

            map.ShowObject(tmpargs.HeiField);
            map.ShowObject(tmpargs.AzField);
            map.ShowObject(NewVF);


            this.ParentForm.Close();
        }
예제 #12
0
        public void FromDensity()
        {
            //int count;
            //count = Math.Min(densLog.SampleCount, vshLog.SampleCount);
            //count = Math.Min(count, swLog.SampleCount);

            List <WellLogSample> LogDens = new List <WellLogSample>(densLog.Samples);
            List <WellLogSample> LogSw   = new List <WellLogSample>(swLog.Samples);
            List <WellLogSample> LogVsh  = new List <WellLogSample>(vshLog.Samples);

            ThreeLogCheck C1    = new ThreeLogCheck(densLog, swLog, vshLog);
            int           count = C1.count;

            if (count == 0)
            {
                PetrelLogger.ErrorBox("INPUT LOGS DO NOT HAVE SAME DEPTH SPACING");
                return;
            }
            int startDens = C1.startLog1, startSw = C1.startLog2, startVsh = C1.startLog3;

            double[] phie = new double[count];

            for (int i = 0; i < count; i++)
            {
                if (LogDens[i + startDens].Value.ToString() == "NaN")
                {
                    continue;
                }

                if (LogSw[i + startSw].Value.ToString() == "NaN")
                {
                    continue;
                }

                if (LogVsh[i + startVsh].Value.ToString() == "NaN")
                {
                    continue;
                }

                dens    = (double)LogDens[i + startDens].Value;
                sw      = (double)LogSw[i + startSw].Value;
                vsh     = (double)LogVsh[i + startVsh].Value;
                rhof    = sw * rhow + (1 - sw) * rhoh;
                phie[i] = (dens - (1 - vsh) * rhomat - vsh * rhosh) / (rhof - rhomat - vsh * rhosh);
            }

            Borehole b1 = densLog.Borehole;

            using (ITransaction trans = DataManager.NewTransaction())
            {
                IPropertyVersionService pvs  = PetrelSystem.PropertyVersionService;
                ILogTemplate            glob = pvs.FindTemplateByMnemonics("Porosity");
                PropertyVersion         pv   = pvs.FindOrCreate(glob);
                trans.Lock(b1);
                WellLog log = b1.Logs.CreateWellLog(pv);
                //log.Name = "rhoB";
                WellLogSample[] tsamples = new WellLogSample[count];
                for (int i2 = 0; i2 < count; i2++)
                {
                    double md  = C1.startMD + i2 * C1.interval1;
                    float  val = (float)phie[i2];
                    tsamples[i2] = new WellLogSample(md, val);
                }
                log.Samples = tsamples;
                trans.Commit();
            }
            PetrelLogger.InfoBox("The Porosity Log has been created in the same Well");
        }
예제 #13
0
        public void FromPorosity2()
        {
            //int count;
            //count = Math.Min(porLog.SampleCount, vshLog.SampleCount);
            //count = Math.Min(count, swLog.SampleCount);

            List <WellLogSample> LogPhie = new List <WellLogSample>(porLog.Samples);
            List <WellLogSample> LogSw   = new List <WellLogSample>(swLog.Samples);
            List <WellLogSample> LogVsh  = new List <WellLogSample>(vshLog.Samples);
            ThreeLogCheck        C1      = new ThreeLogCheck(porLog, swLog, vshLog);
            int count = C1.count;

            if (count == 0)
            {
                PetrelLogger.ErrorBox("INPUT LOGS DO NOT HAVE SAME DEPTH SPACING");
                return;
            }
            int startPor = C1.startLog1, startSw = C1.startLog2, startVsh = C1.startLog3;

            double[] vel = new double[count];

            for (int i = 0; i < count; i++)
            {
                if (LogPhie[i + startPor].Value.ToString() == "NaN")
                {
                    continue;
                }

                if (LogSw[i + startSw].Value.ToString() == "NaN")
                {
                    continue;
                }

                if (LogVsh[i + startVsh].Value.ToString() == "NaN")
                {
                    continue;
                }

                phie   = (double)LogPhie[i + startPor].Value;
                sw     = (double)LogSw[i + startSw].Value;
                vsh    = (double)LogVsh[i + startVsh].Value;
                c      = vsh / (1 - phie);
                vf     = sw / dtw + (1 - sw) / dth;
                vm     = c / dtsh + (1 - c) / dtmat;
                vel[i] = Math.Pow((1 - phie), 2) * vm + phie * vf;
                //vel[i] = 1 / dt;
            }

            Borehole b1 = porLog.Borehole;

            using (ITransaction trans = DataManager.NewTransaction())
            {
                IPropertyVersionService pvs  = PetrelSystem.PropertyVersionService;
                ILogTemplate            glob = pvs.FindTemplateByMnemonics("Velocity");
                PropertyVersion         pv   = pvs.FindOrCreate(glob);
                trans.Lock(b1);
                WellLog log = b1.Logs.CreateWellLog(pv);
                //log.Name = "rhoB";
                WellLogSample[] tsamples = new WellLogSample[count];
                for (int i2 = 0; i2 < count; i2++)
                {
                    double md  = C1.startMD + C1.interval1 * i2;
                    float  val = (float)vel[i2];
                    tsamples[i2] = new WellLogSample(md, val);
                }
                log.Samples = tsamples;
                trans.Commit();
            }
            PetrelLogger.InfoBox("The Velocity Log has been created in the same Well");
        }
예제 #14
0
        private void button2_Click(object sender, EventArgs e)
        {
            PetrelLogger.InfoOutputWindow("Generating array for edited cube");
            float[, ,] newVal = new float[scube.NumSamplesIJK.I, scube.NumSamplesIJK.J, scube.NumSamplesIJK.K];
            double min_newVal = 10e+16;
            double max_newVal = 10e-16;

            using (IProgress i1 = PetrelLogger.NewProgress(1, scube.NumSamplesIJK.I))
            {
                for (int ii = 0; ii < scube.NumSamplesIJK.I; ii++)
                {
                    for (int jj = 0; jj < scube.NumSamplesIJK.J; jj++)
                    {
                        for (int kk = 0; kk < scube.NumSamplesIJK.K; kk++)
                        {
                            newVal[ii, jj, kk] = (float)sr.Function(ii, jj, kk, vals[ii, jj, kk]);
                            if (newVal[ii, jj, kk] < min_newVal)
                            {
                                min_newVal = (double)newVal[ii, jj, kk];
                            }
                            if (newVal[ii, jj, kk] > max_newVal)
                            {
                                max_newVal = (double)newVal[ii, jj, kk];
                            }
                        }
                    }
                    i1.ProgressStatus = ii + 1;
                }
            }
            using (ITransaction txn = DataManager.NewTransaction())
            {
                try
                {
                    txn.Lock(scube.SeismicCollection);
                    Index3       size      = new Index3(scube.NumSamplesIJK.I, scube.NumSamplesIJK.J, scube.NumSamplesIJK.K);
                    IndexDouble3 tempindex = new IndexDouble3(0, 0, 0);
                    Point3       origin    = scube.PositionAtIndex(tempindex);

                    double d1, d2, d3;

                    d1 = scube.PositionAtIndex(new IndexDouble3(1, 0, 0)).X - origin.X;
                    d2 = scube.PositionAtIndex(new IndexDouble3(1, 0, 0)).Y - origin.Y;
                    d3 = scube.PositionAtIndex(new IndexDouble3(1, 0, 0)).Z - origin.Z;
                    Vector3 iVec = new Vector3(d1, d2, d3);

                    d1 = scube.PositionAtIndex(new IndexDouble3(0, 1, 0)).X - origin.X;
                    d2 = scube.PositionAtIndex(new IndexDouble3(0, 1, 0)).Y - origin.Y;
                    d3 = scube.PositionAtIndex(new IndexDouble3(0, 1, 0)).Z - origin.Z;
                    Vector3 jVec = new Vector3(d1, d2, d3);

                    d1 = scube.PositionAtIndex(new IndexDouble3(0, 0, 1)).X - origin.X;
                    d2 = scube.PositionAtIndex(new IndexDouble3(0, 0, 1)).Y - origin.Y;
                    d3 = scube.PositionAtIndex(new IndexDouble3(0, 0, 1)).Z - origin.Z;
                    Vector3 kVec = new Vector3(d1, d2, d3);

                    if (scube.SeismicCollection.CanCreateSeismicCube(size, origin, iVec, jVec, kVec))
                    {
                        Type   dataType              = typeof(float);
                        Domain vDomain               = scube.Domain;
                        IPropertyVersionService pvs  = PetrelSystem.PropertyVersionService;
                        ILogTemplate            glob = pvs.FindTemplateByMnemonics("Seismic");
                        PropertyVersion         pv   = pvs.FindOrCreate(glob);
                        Range1 <double>         r    = new Range1 <double>(min_newVal, max_newVal);
                        PetrelLogger.InfoOutputWindow("OUTPUT TEMPLATE UNDER PROCESS");
                        try
                        {
                            newCube = scube.SeismicCollection.CreateSeismicCube(size, origin, iVec, jVec, kVec, dataType, vDomain, pv, r);
                            PetrelLogger.InfoOutputWindow("OUTPUT CUBE  TEMPLATE Construction completed");
                        }
                        catch (System.InvalidOperationException e1)
                        {
                            PetrelLogger.ErrorBox(e1.Message);
                        }
                        catch (System.ArgumentNullException e1)
                        {
                            PetrelLogger.InfoOutputWindow(e1.Message);
                        }
                    }
                    newCube.Name = cubename.Text;
                    if (newCube.IsWritable)
                    {
                        txn.Lock(newCube);
                        PetrelLogger.InfoOutputWindow("Writing Data in the new cube");
                        Index3   start = new Index3(0, 0, 0);
                        Index3   end   = new Index3(newCube.NumSamplesIJK.I - 1, newCube.NumSamplesIJK.J - 1, newCube.NumSamplesIJK.K - 1);
                        ISubCube to    = newCube.GetSubCube(start, end);
                        to.CopyFrom(newVal);
                        txn.Commit();
                    }
                }
                catch (ArgumentNullException e2)
                {
                    PetrelLogger.ErrorBox("Seismic cube name or propertyVersion can not be blank (null)" + e2.Message);
                }
            }
        }
예제 #15
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.comboDensity.SelectedItem == null || this.comboSonic.SelectedItem == null || this.BRname == null)
     {
         PetrelLogger.ErrorBox("INVALID INPUT");
     }
     else
     {
         if (this.comboDensity.SelectedItem.ToString() == this.comboSonic.SelectedItem.ToString())
         {
             PetrelLogger.ErrorBox("WRONG INPUT");
             return;
         }
         WellLog densityLog = null;
         WellLog sonicLog   = null;
         if (this.mainCombo.SelectedIndex == 0 || this.mainCombo.SelectedIndex == 1)
         {
             if (this.comboDensity.SelectedItem == null || this.comboSonic.SelectedItem == null)
             {
                 PetrelLogger.InfoOutputWindow("!!Process Terminated. Log Missing!!");
             }
             else
             {
                 foreach (WellLog log in wlog)
                 {
                     if (this.comboDensity.SelectedItem.ToString() == log.Name)
                     {
                         densityLog = log;
                     }
                     else if (this.comboSonic.SelectedItem.ToString() == log.Name)
                     {
                         sonicLog = log;
                     }
                 }
             }
             if (!(densityLog == null || sonicLog == null))
             {
                 PetrelLogger.InfoOutputWindow("!!Iteration started!!");
                 RACO obj1 = new RACO(densityLog, sonicLog);
                 obj1.rhoC           = Convert.ToInt32(this.densityClayText.Text);
                 obj1.rhoQ           = Convert.ToInt32(this.densityQuartzText.Text);
                 obj1.rhoW           = Convert.ToInt32(this.densityWaterText.Text);
                 obj1.rhoO           = Convert.ToInt32(this.densityOilText.Text);
                 obj1.Kc             = Convert.ToInt64(this.bulkClayText.Text) * 1000000;
                 obj1.Kq             = Convert.ToInt64(this.bulkQuartzText.Text) * 1000000;
                 obj1.Kw             = Convert.ToInt64(this.bulkWaterText.Text) * 1000000;
                 obj1.Ko             = Convert.ToInt64(this.bulkOilText.Text) * 1000000;
                 obj1.Gc             = Convert.ToInt64(this.shearClayText.Text) * 1000000;
                 obj1.Gq             = Convert.ToInt64(this.shearQuartzText.Text) * 1000000;
                 obj1.RPMndex        = this.comboRPM.SelectedIndex;
                 obj1.porLog         = this.porText.Text;
                 obj1.clayLog        = this.claycontText.Text;
                 obj1.waterLog       = this.waterSatText.Text;
                 obj1.minPor         = Convert.ToDouble(this.minPorText.Text);
                 obj1.maxPor         = Convert.ToDouble(this.maxPorText.Text);
                 obj1.minWater       = Convert.ToDouble(this.minWaterText.Text);
                 obj1.maxWater       = Convert.ToDouble(this.maxWaterText.Text);
                 obj1.minClay        = Convert.ToDouble(this.minClayText.Text);
                 obj1.maxClay        = Convert.ToDouble(this.maxClayText.Text);
                 obj1.maincomboIndex = this.mainCombo.SelectedIndex;
                 obj1.b1             = BR;
                 obj1.workingFunction();
                 PetrelLogger.InfoOutputWindow("Process Completed");
             }
         }
     }
 }
예제 #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Workstep1UI"/> class.
        /// </summary>
        /// <param name="workstep">the workstep instance</param>
        /// <param name="args">the arguments</param>
        /// <param name="context">the underlying context in which this UI is being used</param>
        public CrossPlotUI(WellLog _x, WellLog _y, WellLog _z)
        {
            InitializeComponent();
            logX           = _x;
            logY           = _y;
            logZ           = _z;
            DoubleBuffered = true;
            ResizeRedraw   = true;
            List <WellLogSample> listX = new List <WellLogSample>(logX.Samples);
            List <WellLogSample> listY = new List <WellLogSample>(logY.Samples);
            List <WellLogSample> listZ = new List <WellLogSample>(logZ.Samples);

            if (listX.Count == 0 || listY.Count == 0 || listZ.Count == 0)
            {
                PetrelLogger.ErrorBox("NULL LOG found");
            }
            else
            {
                List <float>         xvals = new List <float>(listX.Count);
                List <float>         yvals = new List <float>(listY.Count);
                List <float>         zvals = new List <float>(listZ.Count);
                List <WellLogSample> abc   = new List <WellLogSample>(logX.Samples);
                for (int i = 0; i < listX.Count; i++)
                {
                    xvals.Add(listX[i].Value);
                    yvals.Add(listY[i].Value);
                    zvals.Add(listZ[i].Value);
                }
                xvals.Sort();
                yvals.Sort();
                zvals.Sort();

                List <float>         valsx = new List <float>(logX.SampleCount);
                List <WellLogSample> samp  = new List <WellLogSample>(logX.Samples);
                for (int i = 0; i < samp.Count; i++)
                {
                    valsx.Add(samp[i].Value);
                }
                valsx.Sort();
                centerX.Value = (decimal)valsx[0];
                float delta = 10000;
                for (int i = 0; i < valsx.Count - 1; i++)
                {
                    if (delta > valsx[i + 1] - valsx[i] &&
                        valsx[i + 1] - valsx[i] > 0.00001)
                    {
                        delta = valsx[i + 1] - valsx[i];
                    }
                }
                deltaX.Value = (decimal)delta;


                List <float> valsy = new List <float>(logY.SampleCount);
                samp = new List <WellLogSample>(logY.Samples);
                for (int i = 0; i < samp.Count; i++)
                {
                    valsy.Add(samp[i].Value);
                }
                valsy.Sort();
                centerY.Value = (decimal)valsy[0];
                delta         = 100000;
                for (int i = 0; i < valsy.Count - 1; i++)
                {
                    if (delta > valsy[i + 1] - valsy[i] &&
                        valsy[i + 1] - valsy[i] > 0.00001)
                    {
                        delta = valsy[i + 1] - valsy[i];
                    }
                }
                deltaY.Value = (decimal)delta;
                List <float> valsz = new List <float>(logZ.SampleCount);
                samp = new List <WellLogSample>(logZ.Samples);
                for (int i = 0; i < samp.Count; i++)
                {
                    valsz.Add(samp[i].Value);
                }
                valsz.Sort();
                centerZ.Value = (decimal)valsz[0];
                delta         = 100000;
                for (int i = 0; i < valsz.Count - 1; i++)
                {
                    if (delta > valsz[i + 1] - valsz[i] &&
                        valsz[i + 1] - valsz[i] > 0.00001)
                    {
                        delta = valsz[i + 1] - valsz[i];
                    }
                }
                deltaZ.Value = (decimal)delta;

                float    xc   = (float)centerX.Value;
                float    yc   = (float)centerY.Value;
                float    zc   = (float)centerZ.Value;
                float    dx   = (float)deltaX.Value;
                float    dy   = (float)deltaY.Value;
                float    dz   = (float)deltaZ.Value;
                Point3[] vals = new Point3[listX.Count];
                double[] min  = new double[3];
                double[] max  = new double[3];
                Point3[] minP = new Point3[3];
                Point3[] maxP = new Point3[3];
                max[0] = double.NegativeInfinity;
                max[1] = double.NegativeInfinity;
                max[2] = double.NegativeInfinity;
                min[0] = double.PositiveInfinity;
                min[1] = double.PositiveInfinity;
                min[2] = double.PositiveInfinity;
                for (int i = 0; i < listX.Count; i++)
                {
                    vals[i] = new Point3((listX[i].Value - xc) / dx, (listY[i].Value - yc) / dy,
                                         (listZ[i].Value - zc) / dz);
                    if (vals[i].X < min[0])
                    {
                        min[0]  = vals[i].X;
                        minP[0] = vals[i];
                    }
                    if (vals[i].Y < min[1])
                    {
                        min[1]  = vals[i].Y;
                        minP[1] = vals[i];
                    }
                    if (vals[i].Z < min[2])
                    {
                        min[2]  = vals[i].Z;
                        minP[2] = vals[i];
                    }
                    if (vals[i].X > max[0])
                    {
                        max[0]  = vals[i].X;
                        maxP[0] = vals[i];
                    }
                    if (vals[i].Y > max[1])
                    {
                        max[1]  = vals[i].Y;
                        maxP[1] = vals[i];
                    }
                    if (vals[i].Z > max[2])
                    {
                        max[2]  = vals[i].Z;
                        maxP[2] = vals[i];
                    }
                }

                sr = new Surface3DRenderer(70, 35, 40, 0, 0, ClientRectangle.Width, ClientRectangle.Height,
                                           0, 0, vals, min, max, minP, maxP);
                Invalidate();
            }
        }
예제 #17
0
        public void workingFunction()
        {
            List <WellLogSample> den = new List <WellLogSample>(density.Samples);
            List <WellLogSample> dt  = new List <WellLogSample>(sonic.Samples);

            if (den.Count == 0 || dt.Count == 0)
            {
                PetrelLogger.ErrorBox("NULL LOG found");
                return;
            }
            Console.WriteLine(den.Count);
            Console.WriteLine(dt.Count);

            int    i;
            double startMD, endMD;
            int    startden = 0,
                   endden   = 0,
                   startdt  = 0,
                   enddt    = 0;

            int    count     = 0;
            double interval1 = den[1].MD - den[0].MD;
            double interval2 = dt[1].MD - dt[0].MD;

            if (Math.Abs(interval1 - interval2) > 10e-4)
            {
                PetrelLogger.ErrorBox("DEPTH INTERVAL MISMATCH");
                return;
            }
            double interval = interval1;

            if (!(Math.Abs(den[0].MD - dt[0].MD) < 10e-4 && Math.Abs(den[den.Count - 1].MD - dt[dt.Count - 1].MD) < 10e-4))
            {
                if (den[0].MD > dt[0].MD)
                {
                    startMD = den[0].MD;
                }
                else
                {
                    startMD = dt[0].MD;
                }
                if (den[den.Count - 1].MD > dt[dt.Count - 1].MD)
                {
                    endMD = dt[dt.Count - 1].MD;
                }
                else
                {
                    endMD = den[den.Count].MD;
                }
                for (int xxx = 0; xxx < den.Count; xxx++)
                {
                    if (Math.Abs(den[xxx].MD - startMD) < 10e-4)
                    {
                        startden = xxx;
                    }
                    if (Math.Abs(den[xxx].MD - endMD) < 10e-4)
                    {
                        endden = xxx;
                    }
                }
                for (int xxx = 0; xxx < dt.Count; xxx++)
                {
                    if (Math.Abs(dt[xxx].MD - startMD) < 10e-4)
                    {
                        startdt = xxx;
                    }
                    if (Math.Abs(dt[xxx].MD - endMD) < 10e-4)
                    {
                        enddt = xxx;
                    }
                }
                count = endden - startden + 1;
            }
            else
            {
                count   = den.Count;
                startMD = den[0].MD;
                endMD   = den[den.Count - 1].MD;
            }


            float[] C2     = new float[count];
            float[] S2     = new float[count];
            float[] phi2   = new float[count];
            float[] error1 = new float[count];


            using (IProgress i1 = PetrelLogger.NewProgress(1, count))
            {
                for (i = 0; i < count; i++)
                {
                    float ac_imp;
                    if (den[i + startden].Value.ToString() == "NaN")
                    {
                        continue;
                    }
                    if (dt[i + startdt].Value.ToString() == "NaN")
                    {
                        continue;
                    }
                    float rho  = den[i + startden].Value;
                    float son  = dt[i + startdt].Value;
                    float Vinv = 1.0f / son;
                    ac_imp    = rho * Vinv;
                    error1[i] = 1.0e35f;
                    for (float phi = (float)minPor; phi <= (float)(maxPor + 0.1); phi += 0.1f)
                    {
                        for (float S = (float)minWater; S <= (float)(maxWater + 0.1); S += 0.1f)
                        {
                            for (float C = (float)minClay; C <= (float)(maxClay + 0.1); C += 0.1f)
                            {
                                double error = dfunc(ac_imp, rho, Vinv, C, S, phi);
                                if (error1[i] > (float)error)
                                {
                                    C2[i]     = C;
                                    S2[i]     = S;
                                    phi2[i]   = phi;
                                    error1[i] = (float)error;
                                }
                            }
                        }
                    }
                    updateVals(ac_imp, rho, Vinv, ref C2[i], ref S2[i], ref phi2[i]);
                    i1.ProgressStatus = i + 1;
                }
            }
            b1 = density.Borehole;
            using (ITransaction trans = DataManager.NewTransaction())
            {
                IPropertyVersionService pvs  = PetrelSystem.PropertyVersionService;
                ILogTemplate            glob = pvs.FindTemplateByMnemonics("Porosity");
                PropertyVersion         pv   = pvs.FindOrCreate(glob);
                trans.Lock(b1);
                WellLog         log      = b1.Logs.CreateWellLog(pv);
                WellLogSample[] tsamples = new WellLogSample[count];
                for (int i2 = 0; i2 < count; i2++)
                {
                    double md  = startMD + i2 * interval;
                    float  val = phi2[i2];
                    tsamples[i2] = new WellLogSample(md, val);
                }
                log.Samples = tsamples;
                trans.Commit();
            }
            using (ITransaction trans = DataManager.NewTransaction())
            {
                IPropertyVersionService pvs  = PetrelSystem.PropertyVersionService;
                ILogTemplate            glob = pvs.FindTemplateByMnemonics(clayLog);
                PropertyVersion         pv   = pvs.FindOrCreate(glob);
                trans.Lock(b1);
                WellLog         log      = b1.Logs.CreateWellLog(pv);
                WellLogSample[] tsamples = new WellLogSample[count];
                for (int i2 = 0; i2 < count; i2++)
                {
                    double md  = startMD + i2 * interval;
                    float  val = C2[i2];
                    tsamples[i2] = new WellLogSample(md, val);
                }
                log.Samples = tsamples;
                trans.Commit();
            }
            using (ITransaction trans = DataManager.NewTransaction())
            {
                IPropertyVersionService pvs  = PetrelSystem.PropertyVersionService;
                ILogTemplate            glob = pvs.FindTemplateByMnemonics(waterLog);

                PropertyVersion pv = pvs.FindOrCreate(glob);
                trans.Lock(b1);
                WellLog         log      = b1.Logs.CreateWellLog(pv);
                WellLogSample[] tsamples = new WellLogSample[count];
                for (int i2 = 0; i2 < count; i2++)
                {
                    double md  = startMD + i2 * interval;
                    float  val = S2[i2];
                    tsamples[i2] = new WellLogSample(md, val);
                }
                log.Samples = tsamples;
                trans.Commit();
            }
        }
예제 #18
0
        public void workingFunction()
        {
            maincomboIndex = 0;
            SeismicRoot    seismicRoot = SeismicRoot.Get(PetrelProject.PrimaryProject);
            SeismicProject proj        = seismicRoot.SeismicProject;


            float[, ,] phi2 = new float[cubeDensity.NumSamplesIJK.I, cubeDensity.NumSamplesIJK.J, cubeDensity.NumSamplesIJK.K];
            float[, ,] S2   = new float[cubeDensity.NumSamplesIJK.I, cubeDensity.NumSamplesIJK.J, cubeDensity.NumSamplesIJK.K];
            float[, ,] C2   = new float[cubeDensity.NumSamplesIJK.I, cubeDensity.NumSamplesIJK.J, cubeDensity.NumSamplesIJK.K];
            float minphi2 = 1.0f;
            float maxphi2 = 0.0f;
            float minC2   = 1.0f;
            float maxC2   = 0.0f;
            float minS2   = 1.0f;
            float maxS2   = 0.0f;

            using (ITransaction txn = DataManager.NewTransaction())
            {
                try
                {
                    using (IProgress i1 = PetrelLogger.NewProgress(1, cubeDensity.NumSamplesIJK.J))
                    {
                        for (int p = 0; p < cubeDensity.NumSamplesIJK.I; p++)
                        {
                            for (int q = 0; q < cubeDensity.NumSamplesIJK.J; q++)
                            {
                                ITrace trace1 = cubeDensity.GetTrace(p, q);
                                ITrace trace2 = cubeSonic.GetTrace(p, q);
                                //ITrace tracePor = PHI_CUBE.GetTrace(p, q);
                                //ITrace traceSw = SW_CUBE.GetTrace(p, q);
                                //ITrace traceVSh = VSHALE_CUBE.GetTrace(p, q);
                                for (int k = 0; k < trace1.Length; k++)
                                {
                                    double sample1 = trace1[k];
                                    double sample2 = trace2[k];
                                    float  rho     = (float)sample1;
                                    float  Vinv    = (float)(1.0 / sample2);
                                    float  ac_imp  = rho * Vinv;
                                    float  error1  = 100e30f;

                                    for (float phi = (float)minPor; phi <= (float)(maxPor + 0.1); phi += 0.1f)
                                    {
                                        for (float S = (float)minWater; S <= (float)(maxWater + 0.1); S += 0.1f)
                                        {
                                            for (float C = (float)minClay; C <= (float)(maxClay + 0.1); C += 0.1f)
                                            {
                                                double error = dfunc(ac_imp, rho, Vinv, C, S, phi);
                                                if (error1 > (float)error)
                                                {
                                                    C2[p, q, k]   = C;
                                                    S2[p, q, k]   = S;
                                                    phi2[p, q, k] = phi;
                                                    error1        = (float)error;
                                                }
                                            }
                                        }
                                    }
                                    updateVals(ac_imp, rho, Vinv, ref C2[p, q, k], ref S2[p, q, k], ref phi2[p, q, k]);
                                    if (phi2[p, q, k] < minphi2)
                                    {
                                        minphi2 = phi2[p, q, k];
                                    }
                                    if (phi2[p, q, k] > maxphi2)
                                    {
                                        maxphi2 = phi2[p, q, k];
                                    }
                                    if (C2[p, q, k] < minC2)
                                    {
                                        minC2 = C2[p, q, k];
                                    }
                                    if (C2[p, q, k] > maxC2)
                                    {
                                        maxC2 = C2[p, q, k];
                                    }
                                    if (S2[p, q, k] < minS2)
                                    {
                                        minS2 = S2[p, q, k];
                                    }
                                    if (S2[p, q, k] > maxS2)
                                    {
                                        maxS2 = S2[p, q, k];
                                    }
                                }
                            }
                            i1.ProgressStatus = p + 1;
                        }
                    }
                    txn.Lock(proj);
                    txn.Lock(scol);
                    Index3       size      = new Index3(cubeDensity.NumSamplesIJK.I, cubeDensity.NumSamplesIJK.J, cubeDensity.NumSamplesIJK.K);
                    IndexDouble3 tempindex = new IndexDouble3(0, 0, 0);
                    Point3       origin    = cubeDensity.PositionAtIndex(tempindex);

                    double d1, d2, d3;

                    d1 = cubeDensity.PositionAtIndex(new IndexDouble3(1, 0, 0)).X - origin.X;
                    d2 = cubeDensity.PositionAtIndex(new IndexDouble3(1, 0, 0)).Y - origin.Y;
                    d3 = cubeDensity.PositionAtIndex(new IndexDouble3(1, 0, 0)).Z - origin.Z;
                    Vector3 iVec = new Vector3(d1, d2, d3);

                    d1 = cubeDensity.PositionAtIndex(new IndexDouble3(0, 1, 0)).X - origin.X;
                    d2 = cubeDensity.PositionAtIndex(new IndexDouble3(0, 1, 0)).Y - origin.Y;
                    d3 = cubeDensity.PositionAtIndex(new IndexDouble3(0, 1, 0)).Z - origin.Z;
                    Vector3 jVec = new Vector3(d1, d2, d3);

                    d1 = cubeDensity.PositionAtIndex(new IndexDouble3(0, 0, 1)).X - origin.X;
                    d2 = cubeDensity.PositionAtIndex(new IndexDouble3(0, 0, 1)).Y - origin.Y;
                    d3 = cubeDensity.PositionAtIndex(new IndexDouble3(0, 0, 1)).Z - origin.Z;
                    Vector3 kVec = new Vector3(d1, d2, d3);


                    /*double inlineI = (cubeDensity.Lattice.Single.SpacingI) * Math.Sin(cubeDensity.Lattice.Single.RotationJ);
                     * double inlineJ = (cubeDensity.Lattice.Single.SpacingI) * Math.Cos(cubeDensity.Lattice.Single.RotationJ);
                     * double crosslineI = (cubeDensity.Lattice.Single.SpacingJ) * Math.Sin(cubeDensity.Lattice.Single.RotationJ);
                     * double crosslineJ = (cubeDensity.Lattice.Single.SpacingJ) * -Math.Cos(cubeDensity.Lattice.Single.RotationJ);
                     * Vector3 iSpacing = new Vector3(inlineJ, inlineI, 0.0);
                     * Vector3 jSpacing = new Vector3(crosslineI, crosslineJ, 0.0);
                     * Vector3 kSpacing = new Vector3(0.0, 0.0, 3.048);
                     */
                    if (scol.CanCreateSeismicCube(size, origin, iVec, jVec, kVec))
                    {
                        Type   dataType              = typeof(float);
                        Domain vDomain               = cubeDensity.Domain;
                        IPropertyVersionService pvs  = PetrelSystem.PropertyVersionService;
                        ILogTemplate            glob = pvs.FindTemplateByMnemonics("Seismic");
                        PropertyVersion         pv   = pvs.FindOrCreate(glob);
                        //PropertyVersion pv = cubeDensity.PropertyVersion;
                        Range1 <double> r1 = new Range1 <double>(minphi2, maxphi2);
                        Range1 <double> r2 = new Range1 <double>(minS2, maxS2);
                        Range1 <double> r3 = new Range1 <double>(minC2, maxC2);
                        PetrelLogger.InfoOutputWindow("OUTPUT TEMPLATE UNDER PROCESS");
                        try
                        {
                            PHI_CUBE    = scol.CreateSeismicCube(size, origin, iVec, jVec, kVec, dataType, vDomain, pv, r1);
                            SW_CUBE     = scol.CreateSeismicCube(size, origin, iVec, jVec, kVec, dataType, vDomain, pv, r2);
                            VSHALE_CUBE = scol.CreateSeismicCube(size, origin, iVec, jVec, kVec, dataType, vDomain, pv, r3);
                        }
                        catch (System.InvalidOperationException e)
                        {
                            PetrelLogger.ErrorBox(e.Message);
                        }
                        catch (System.ArgumentNullException e)
                        {
                            PetrelLogger.InfoOutputWindow(e.Message);
                        }
                    }

                    PHI_CUBE.Name    = porCube;
                    SW_CUBE.Name     = waterCube;
                    VSHALE_CUBE.Name = clayCube;

                    if (PHI_CUBE.IsWritable)
                    {
                        using (ITransaction txn1 = DataManager.NewTransaction())
                        {
                            PetrelLogger.InfoOutputWindow("Writing Data in the Porosity cube");
                            Index3   start = new Index3(0, 0, 0);
                            Index3   end   = new Index3(cubeDensity.NumSamplesIJK.I - 1, cubeDensity.NumSamplesIJK.J - 1, cubeDensity.NumSamplesIJK.K - 1);
                            ISubCube to    = cubeDensity.GetSubCube(start, end);
                            to.CopyFrom(phi2);
                            txn1.Commit();
                        }
                    }
                    if (SW_CUBE.IsWritable)
                    {
                        using (ITransaction txn1 = DataManager.NewTransaction())
                        {
                            PetrelLogger.InfoOutputWindow("Writing Data in the Water Saturation cube");
                            Index3   start = new Index3(0, 0, 0);
                            Index3   end   = new Index3(cubeDensity.NumSamplesIJK.I - 1, cubeDensity.NumSamplesIJK.J - 1, cubeDensity.NumSamplesIJK.K - 1);
                            ISubCube to    = cubeDensity.GetSubCube(start, end);
                            to.CopyFrom(S2);
                            txn1.Commit();
                        }
                    }
                    if (VSHALE_CUBE.IsWritable)
                    {
                        using (ITransaction txn1 = DataManager.NewTransaction())
                        {
                            PetrelLogger.InfoOutputWindow("Writing Data in the Shale Volume cube");
                            Index3   start = new Index3(0, 0, 0);
                            Index3   end   = new Index3(cubeDensity.NumSamplesIJK.I - 1, cubeDensity.NumSamplesIJK.J - 1, cubeDensity.NumSamplesIJK.K - 1);
                            ISubCube to    = cubeDensity.GetSubCube(start, end);
                            to.CopyFrom(C2);
                            txn1.Commit();
                        }
                    }
                    txn.Commit();
                    PetrelLogger.InfoOutputWindow("OUTPUT CUBES' Construction completed");
                }

                catch (ArgumentNullException e)
                {
                    PetrelLogger.ErrorBox("Seismic cube name or propertyVersion can not be blank (null)" + e.Message);
                }
            }
        }
예제 #19
0
        public void FromNeutron()
        {
            //int count;
            //count = GnLog.SampleCount;

            //count=Math.Min(GnLog.SampleCount, vshLog.SampleCount);

            List <WellLogSample> LogGn  = new List <WellLogSample>(GnLog.Samples);
            List <WellLogSample> LogVsh = new List <WellLogSample>(vshLog.Samples);

            TwoLogCheck C4    = new TwoLogCheck(GnLog, vshLog);
            int         count = C4.count;

            if (count == 0)
            {
                PetrelLogger.ErrorBox("INPUT LOGS DO NOT HAVE SAME DEPTH SPACING");
                return;
            }
            int startGn = C4.startLog1, startVsh = C4.startLog2;

            double[] phie = new double[count];

            for (int i = 0; i < count; i++)
            {
                if (LogGn[i + startGn].Value.ToString() == "NaN")
                {
                    continue;
                }

                if (LogVsh[i + startVsh].Value.ToString() == "NaN")
                {
                    continue;
                }

                Gn      = (double)LogGn[i + startGn].Value;
                vsh     = (double)LogVsh[i + startVsh].Value;
                phie[i] = Gn - vsh * Gnsh * 100;
            }

            Borehole b1 = vshLog.Borehole;

            using (ITransaction trans = DataManager.NewTransaction())
            {
                IPropertyVersionService pvs  = PetrelSystem.PropertyVersionService;
                ILogTemplate            glob = pvs.FindTemplateByMnemonics("Porosity");
                PropertyVersion         pv   = pvs.FindOrCreate(glob);
                trans.Lock(b1);
                WellLog log = b1.Logs.CreateWellLog(pv);
                //log.Name = "rhoB";
                WellLogSample[] tsamples = new WellLogSample[count];
                for (int i2 = 0; i2 < count; i2++)
                {
                    double md  = C4.startMD + i2 * C4.interval1;
                    float  val = (float)phie[i2];
                    tsamples[i2] = new WellLogSample(md, val);
                }
                log.Samples = tsamples;
                trans.Commit();
            }
            PetrelLogger.InfoBox("The Porosity Log has been created in the same Well");
        }