Exemple #1
0
 private void CreateWell(Well well, BoreholeCollection boreholeColl)
 {
     using (ITransaction tr = DataManager.NewTransaction())
     {
         tr.Lock(boreholeColl);
         Borehole borehole = boreholeColl.CreateBorehole(well.Name);
         borehole.Comments = "Imported from FIELDPRO";
         borehole.UWI      = well.Uwi;
         var coordinates = well.CartesianCoordinates();
         borehole.WellHead = new Point2(coordinates["X"], coordinates["Y"]);
         ReferenceLevel kb = new ReferenceLevel("KB", well.Z, "Kelly bushing");
         borehole.WorkingReferenceLevel = kb;
         var trajectoryRecords = this.GetTrajectoryRecords(well);
         try { borehole.Trajectory.Records = trajectoryRecords; }
         catch (ArgumentOutOfRangeException ex)
         {
             PetrelLogger.InfoOutputWindow("Failed to set trajectory: " + ex.ToString());
         }
         SetProperty("Field", well.Field, borehole, true);
         SetProperty("Area", well.Area, borehole, true);
         SetProperty("Country", well.Country, borehole, true);
         SetProperty("FIELDPRO ID", well.ID.ToString(), borehole, false);
         tr.Commit();
     }
 }
Exemple #2
0
        public List <WellAllocation> GetAll(string uwi, DateTime start, DateTime end)
        {
            List <WellAllocation> allocations = new List <WellAllocation>();
            WebImporterWrapper    wi          = new WebImporterWrapper(dcInfo);

            try
            {
                DataTable dt;
                if (frequency == Frequency.Daily)
                {
                    dt = wi.LoadDailyProduction(uwi);
                }
                else
                {
                    dt = wi.LoadMonthlyProduction(uwi);
                }
                foreach (DataRow dr in dt.Rows)
                {
                    var w = this.WellAllocationFromRow(dr);
                    allocations.Add(w);
                }
            }
            catch (Exception e)
            {
                PetrelLogger.InfoOutputWindow("Failed to load wells: " + e.ToString());
            }
            return(allocations);
        }
        public void save()
        {
            List <WellLogSample> LogDens = new List <WellLogSample>(densLog.Samples);
            Borehole             b1      = densLog.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  = LogDens[i2].MD;
                    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");
        }
Exemple #4
0
 private void UpdateArgPackFromUI()
 {
     PetrelLogger.InfoOutputWindow("enttring UpdateArgPackFromUI");
     args.DisplayTimeValue = double.Parse(DisplayTimeValue.Text);
     //
     PetrelLogger.InfoOutputWindow(args.DumpToString());
 }
        public override void Execute(Slb.Ocean.Petrel.Contexts.Context context)
        {
            //foreach (object obj in context.GetSelectedObjects())
            //{
            //    DictionaryWellPointPropertyFilter DPF = obj as DictionaryWellPointPropertyFilter;
            //    WellKnownMarkerPropertyTypes wf=new WellKnownMarkerPropertyTypes();
            //
            //    PetrelLogger.InfoOutputWindow(DPF.Name+"--"+ DPF.Droid);
            //
            //}
            WellRoot wellroot = WellRoot.Get(PetrelProject.PrimaryProject);

            PetrelLogger.InfoOutputWindow("-------------------- Well Root Navigation ----------------------");

            if (wellroot.BoreholeCollection != null)
            {
                PrintBoreholeCollection(wellroot.BoreholeCollection);
            }
            else
            {
                PetrelLogger.InfoOutputWindow("No borehole information to print.");
            }
            if (wellroot.MarkerCollectionCount > 0)
            {
                PrintMarkerCollectionDetails(wellroot.MarkerCollections.First());
            }
            else
            {
                PetrelLogger.InfoOutputWindow("No Marker collections to print");
                return;
            }
        }
        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();
        }
        /// <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);
        }
Exemple #8
0
        public void FromSonic()
        {
            int count = dtLog.SampleCount;

            List <WellLogSample> LogDt = new List <WellLogSample>(dtLog.Samples);

            double[] Imp = new double[count];

            for (int i = 0; i < count; i++)
            {
                Imp[i] = 1000.0d * GCoef * Math.Pow(1 / dtLog[i].Value, GExp) / dtLog[i].Value;
            }
            Borehole b1 = dtLog.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  = LogDt[i2].MD;
                    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");
        }
        private void PrintMarkerCollectionDetails(MarkerCollection markerColl)
        {
            /// Print the marker collection name.
            PetrelLogger.InfoOutputWindow("-------------------------------------------------------------------------------");
            PetrelLogger.InfoOutputWindow("Marker Collection Name        : " + markerColl.Name);

            if (markerColl.MarkerCount > 0)
            {
                /// Loop through all the markers and print each one's MD value, TVD value, and name of the surface it is attached to.
                PetrelLogger.InfoOutputWindow("Marker Collection Count       : " + markerColl.MarkerCount);
                PetrelLogger.InfoOutputWindow("             -------------------- Markers ---------------------------          ");
                foreach (Marker marker in markerColl.Markers)
                {
                    foreach (DictionaryWellPointProperty dwp in markerColl.MarkerPropertyCollection.DictionaryProperties)
                    {
                        if (dwp.Name == "Interpreter")
                        {
                            PetrelLogger.InfoOutputWindow(marker.PropertyAccess.GetPropertyValue <string>(dwp) + "--" + marker.Surface.Name + "--" + marker.Borehole.Name);
                        }
                    }
                }

                /*
                 * foreach (Marker marker in markerColl.Markers)
                 * {
                 *  double mdUI = PetrelUnitSystem.ConvertToUI(Domain.MD, marker.MD);
                 *  double tvdUI = PetrelUnitSystem.ConvertToUI(Domain.TVD_WRL, marker.TVD_WRL);
                 *  PetrelLogger.InfoOutputWindow("Marker MD, TVD : " + mdUI.ToString("N2") + "   " + tvdUI.ToString("N2") + "     " + marker.Surface.Name + marker.Droid);
                 * }*/
            }
        }
Exemple #10
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");
        }
        public override void Execute(Slb.Ocean.Petrel.Contexts.Context context)
        {
            foreach (object obj in context.GetSelectedObjects())
            {
                PetrelLogger.InfoOutputWindow("Object type: " + obj.GetType().ToString());
                PetrelLogger.InfoOutputWindow("Ocean Object type: " + GetPublicDomainObjectTypeName(obj));
                //测试3d cube下的虚拟地震属性和3d cube的差别,用反射扫描所有属性
                foreach (System.Reflection.PropertyInfo p in obj.GetType().GetProperties())
                {
                    PetrelLogger.InfoOutputWindow(p.Name + " Value//" + p.GetValue(obj));
                }
                //return;
                //测试通过线道号读取地震解释
                //HorizonInterpretation hi=new HorizonInterpretation();

                //测试三维地震体线道号 20200306

                SeismicRoot sr = SeismicRoot.Get(PetrelProject.PrimaryProject);

                /*
                 * SeismicCollection sc = new SeismicCollection();
                 * SeismicCube scube = new SeismicCube();
                 * scube.AnnotationAtIndex(0,0,0).I- scube.AnnotationAtIndex(1, 0, 0).I
                 * scube.SampleSpacingIJK
                 * scube.Origin
                 * scube.NumSamplesIJK;
                 * scube.AnnotationAtIndex()
                 */


                //测试2d plane的删除功能



                foreach (SurveyCollection surveyCollection in sr.SeismicProject.SurveyCollections)
                {
                    if (surveyCollection.Name == "All 2D seismic folder")
                    {
                        foreach (SeismicCollection seismicCollection in surveyCollection.SeismicCollections)
                        {
                            if (seismicCollection.Name == "2D Seismic - seismic survey")
                            {
                                foreach (SeismicLine2DCollection seismicLine2DCollection in seismicCollection.SeismicLine2DCollections)
                                {
                                    if (seismicLine2DCollection.Name == "2DInline 520 Time")
                                    {
                                        seismicLine2DCollection.Delete();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        public override void Execute(Slb.Ocean.Petrel.Contexts.Context context)
        {
            IEnumerable <Borehole> selectedBoreHoles = context.GetSelectedObjects().OfType <Borehole>();

            //
            //
            foreach (var borehole in selectedBoreHoles)
            {
                PetrelLogger.InfoOutputWindow($"Well: {borehole.Name} has (Min MD = {borehole.MDRange.Min}) and (Max Md = {borehole.MDRange.Max})");
            }
        }
        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");
        }
        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();
        }
Exemple #15
0
 private void UpdateUIFromArgPack()
 {
     PetrelLogger.InfoOutputWindow("enttring UpdateUIFromArgPack");
     //
     DisplayTimeValue.Text = args.DisplayTimeValue.ToString(CultureInfo.InvariantCulture);
     CoreTimeValue.Text    = args.CoreTimeValue.ToString(CultureInfo.InvariantCulture);
     //
     DisplayTimeUnit.Text = args.DisplayTimeUnit;
     CoreTimeUnit.Text    = args.CoreTimeUnit;
     //
     Refresh();
 }
        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();
        }
Exemple #17
0
            public override void ExecuteSimple()
            {
                // extract input arguments
                var cube        = arguments.Cube;
                var newCubeName = arguments.NewCubeName;

                //
                if (cube == null)
                {
                    PetrelLogger.InfoOutputWindow("CopySeismicCubeWithReversedPolarityWorkstep: cube cannot be null");
                    return;
                }
                //
                //
                var seismicCollection = cube.SeismicCollection;

                //
                if (!seismicCollection.CanCreateSeismicCube(cube))
                {
                    return;
                }
                //
                //
                using (var transaction = DataManager.NewTransaction())
                {
                    transaction.Lock(seismicCollection);
                    //
                    var newCube = seismicCollection.CreateSeismicCube(cube, cube.Template);
                    newCube.Name = newCubeName;
                    //
                    //
                    int numI = cube.NumSamplesIJK.I;
                    int numJ = cube.NumSamplesIJK.J;
                    int numK = cube.NumSamplesIJK.K;
                    //
                    for (int i = 0; i < numI; i++)     // inline samples
                    {
                        for (int j = 0; j < numJ; j++) // cross line samples
                        {
                            //
                            var originalTrace = cube.GetTrace(i, j);
                            var copiedTrace   = newCube.GetTrace(i, j);
                            //
                            for (int k = 0; k < numK; k++)
                            {
                                copiedTrace[k] = -1.0f * originalTrace[k];
                            }
                        }
                    }
                    //
                    transaction.Commit();
                }
            }
Exemple #18
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();
        }
            public override void ExecuteSimple()
            {
                // extract input data
                var originX  = arguments.X;
                var originY  = arguments.Y;
                var pointsX  = arguments.XPoints;
                var pointsY  = arguments.YPoints;
                var spacingX = arguments.XSpacing;
                var spacingY = arguments.YSpacing;
                //
                // get coordinate reference system
                var coordinateReferenceSystem = PetrelProject.PrimaryProject.GetCoordinateReferenceSystem();
                //
                Index2  sizeIJ                   = new Index2(pointsX, pointsY);
                Point2  worldOrigin              = new Point2(originX, originY);
                Vector2 worldSpacing             = new Vector2(spacingX, spacingY);
                Angle   rotation                 = new Angle(0);
                bool    axisOrientationClockwise = true;
                bool    annoationValid           = true;
                //
                SpatialLatticeInfo latticeInfo = new SpatialLatticeInfo(
                    new LatticeInfo(sizeIJ, worldOrigin, worldSpacing, rotation, axisOrientationClockwise, worldOrigin,
                                    worldSpacing, annoationValid), coordinateReferenceSystem);
                //
                Project project = PetrelProject.PrimaryProject;
                //
                double value = 0.0;

                //
                using (var transaction = DataManager.NewTransaction())
                {
                    transaction.Lock(project);
                    //
                    var collection = project.CreateCollection("My Collection");
                    //
                    var surface = collection.CreateRegularHeightFieldSurface("My surface", latticeInfo);
                    surface.Domain = Domain.ELEVATION_DEPTH;
                    //
                    var samples = new List <RegularHeightFieldSample>();
                    //
                    for (int i = 0; i < sizeIJ.I; i++)
                    {
                        for (int j = 0; j < sizeIJ.J; j++)
                        {
                            samples.Add(new RegularHeightFieldSample(i, j, value += 1.0));
                            PetrelLogger.InfoOutputWindow($"I = {i}; J = {j}; Value = {value}");
                        }
                    }
                    //
                    surface.Samples = samples;
                    transaction.Commit();
                }
            }
 private void PrintPillarFaultsInCollection(FaultCollection faultCollection)
 {
     PetrelLogger.InfoOutputWindow("\nFault collection " + faultCollection.Name + " has a pillar fault count of " + faultCollection.PillarFaultCount);
     foreach (PillarFault fault in faultCollection.PillarFaults)
     {
         PetrelLogger.InfoOutputWindow(fault.Name + " has a face count of " + fault.FaceCount + " and a node count of " + fault.NodeCount);
     }
     foreach (FaultCollection fc in faultCollection.FaultCollections)
     {
         PrintPillarFaultsInCollection(fc);
     }
 }
        public override void Execute(Slb.Ocean.Petrel.Contexts.Context context)
        {
            //TODO: Add command execution logic here

            /*
             * Template twtTemplate = PetrelProject.WellKnownTemplates.GeometricalGroup.TimeTwoWay;
             *
             * ITemplateSettingsInfoFactory factory = CoreSystem.GetService<ITemplateSettingsInfoFactory>(twtTemplate);
             * TemplateSettingsInfo info = factory.GetTemplateSettingsInfo(twtTemplate);
             * //arguments.Label = info.LegendLabel;
             * //arguments.DisplayUnit = info.Unit.Symbol;
             * //arguments.Precision = info.NumericPrecision.PrecisionValue;
             *
             * // create custom template with more detailed info
             * TemplateCollection parent = twtTemplate.TemplateCollection;
             * ITemplateService ts = PetrelSystem.TemplateService;
             * string newName = ts.GetUniqueName("My New Detailed Time");
             * Template newTWT = Template.NullObject;
             *
             * using (ITransaction txn = DataManager.NewTransaction())
             * {
             *  txn.Lock(parent);
             *  newTWT = parent.CreateTemplate(newName, info.DefaultColorTable, twtTemplate.UnitMeasurement);
             *  newTWT.Comments = "New two way time with more digits";
             *  newTWT.TemplateType = twtTemplate.TemplateType.;
             *  txn.Commit();
             * }
             * factory = CoreSystem.GetService<ITemplateSettingsInfoFactory>(newTWT);
             * TemplateSettingsInfo info2 = factory.GetTemplateSettingsInfo(newTWT);
             * info2.NumericPrecision = new NumericPrecision(6, WellKnownPrecisionTypes.DecimalPlaces);
             */

            PetrelLogger.InfoOutputWindow(string.Format("{0} clicked", @"GetTemplateIcon"));
            foreach (object obj in context.GetSelectedObjects())
            {
                Template         g     = obj as Template;
                string           gname = "D:\\test\\" + obj.GetHashCode() + ".bmp";
                ITemplateService imageFact;
                imageFact = CoreSystem.GetService <ITemplateService>();
                Bitmap imageInfo = imageFact.GetTemplateTypeImage(g.TemplateType);
                using (MemoryStream mem = new MemoryStream())
                {
                    //这句很重要,不然不能正确保存图片或出错(关键就这一句)
                    Bitmap bmp = new Bitmap(imageInfo);
                    //保存到磁盘文件
                    bmp.Save(gname, imageInfo.RawFormat);
                    bmp.Dispose();
                    MessageBox.Show("附件另存成功!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MessageBox.Show("附件另存成功a");
                }
            }
        }
        public override void Execute(Slb.Ocean.Petrel.Contexts.Context context)
        {
            PetrelLogger.InfoOutputWindow("Executing " + typeof(DisplaySelectedWellsCommandHandler).Name);
            //
            IEnumerable <object> selectedObjects = context.GetSelectedObjects();

            //
            foreach (Borehole borehole in selectedObjects.OfType <Borehole>())
            {
                PetrelLogger.InfoOutputWindow(borehole.Name);
            }
            //
            PetrelLogger.InfoOutputWindow(Environment.NewLine);
        }
Exemple #23
0
        public void FromVpvs()
        {
            int count = vpvsLog.SampleCount;
            List <WellLogSample> LogVpvs = new List <WellLogSample>(vpvsLog.Samples);

            poisn = new double[count];
            for (int i = 0; i < count; i++)
            {
                vpvs     = LogVpvs[i].Value;
                poisn[i] = 0.5d * (Math.Pow(vpvs, 2) - 2.0d) / (Math.Pow(vpvs, 2) - 1.0d);
            }
            save(vpvsLog, vpvsLog.SampleCount, LogVpvs[0].MD, LogVpvs[1].MD - LogVpvs[0].MD, poisn, "Poissons ratio");
            PetrelLogger.InfoBox("The Poisson Ratio Log has been created in the same Well");
        }
Exemple #24
0
        private void button1_Click(object sender, EventArgs e)
        {
            WellRoot           wellRoot     = WellRoot.Get(PetrelProject.PrimaryProject);
            BoreholeCollection boreholeColl = wellRoot.BoreholeCollection;
            string             WellTextData = "";
            string             TrajTextData = "";

            foreach (Borehole bh in boreholeColl)
            {
                bool bok = false;
                foreach (object itemChecked in WellsList.CheckedItems)
                {
                    if (itemChecked.ToString() == bh.Name)
                    {
                        bok = true;
                        break;
                    }
                }
                if (!bok)
                {
                    continue;
                }
                PetrelLogger.InfoOutputWindow("Loading: " + bh.Name);
                Well w = WellsImporter.Borehole2Well(bh);
                WellTextData += w.Serialize() + Environment.NewLine;

                IEnumerable <TrajectoryRecord> ie = bh.Trajectory.Records;
                foreach (TrajectoryRecord r in ie)
                {
                    WellTrajectory t = new WellTrajectory(r);
                    TrajTextData += t.Serialize(bh.Name) + Environment.NewLine;
                }
            }
            if (!string.IsNullOrEmpty(WellTextData))
            {
                string datafile = System.IO.Path.GetTempPath() + "petrelwells.txt";
                System.IO.File.WriteAllText(datafile, Well.TxtHeader + Environment.NewLine + WellTextData);
                WebImporterWrapper wi = new WebImporterWrapper(WebConfiguration.Current);
                int id = wi.UploadWells(datafile);
            }
            if (!string.IsNullOrEmpty(TrajTextData))
            {
                string datafile = System.IO.Path.GetTempPath() + "petreltraj.txt";
                System.IO.File.WriteAllText(datafile, WellTrajectory.TxtHeader + Environment.NewLine + TrajTextData);
                WebImporterWrapper wi = new WebImporterWrapper(WebConfiguration.Current);
                int id = wi.UploadTraj(datafile);
            }
        }
 private void ListAllMarkers(IEnumerable <MarkerCollection> markerCollections)
 {
     //
     // print all of the markers
     foreach (MarkerCollection markerCollection in markerCollections)
     {
         PetrelLogger.InfoOutputWindow("------------------------------------------------");
         PetrelLogger.InfoOutputWindow("Marker Collection Name: " + markerCollection.Name);
         PetrelLogger.InfoOutputWindow("Markers Count: " + markerCollection.MarkerCount);
         //
         foreach (Marker marker in markerCollection)
         {
             PetrelLogger.InfoOutputWindow("\t" + marker.DumpToString());
         }
     }
 }
            public override void ExecuteSimple()
            {
                CoreLogger.Debug("Hello World from CoreLogger!");
                PetrelLogger.InfoOutputWindow("Hello World from PetrelLogger!");
                //
                //
                var unitServiceSettings = CoreSystem.GetService <IUnitServiceSettings>();
                // even if we do not already set a coordinate reference system, this method call will pop up the window so we could select one
                var coordinateReferenceSystemName        = PetrelProject.PrimaryProject.GetCoordinateReferenceSystem().Name;
                var coordinateReferenceSystemDescription = PetrelProject.PrimaryProject.GetCoordinateReferenceSystem().Description;

                //
                PetrelLogger.InfoOutputWindow(unitServiceSettings.CurrentUISystem.Name);
                PetrelLogger.InfoOutputWindow(coordinateReferenceSystemName);
                PetrelLogger.InfoOutputWindow(coordinateReferenceSystemDescription);
            }
Exemple #27
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");
        }
Exemple #28
0
        private void ImportObservedData()
        {
            WellRoot        wellRoot        = WellRoot.Get(PetrelProject.PrimaryProject);
            ObservedDataSet observedDataSet = EnsureDailyDataSet();
            IProgress       p = PetrelLogger.NewProgress(0, wellRoot.BoreholeCollection.Count, ProgressType.Cancelable, Cursors.WaitCursor);

            using (p)
            {
                p.SetProgressText("Importing well allocations...");
                foreach (var well in wellRoot.BoreholeCollection)
                {
                    var allocations = WellAllocation.Broker(frequency).GetAll(well.UWI, start, end);
                    ImportObservedDataForWell(well, allocations, observedDataSet);
                    p.ProgressStatus = p.ProgressStatus + 1;
                }
            }
        }
Exemple #29
0
        public void FromVsh()
        {
            int count = vshLog.SampleCount;
            List <WellLogSample> LogVsh = new List <WellLogSample>(vshLog.Samples);

            poisn = new double[count];

            for (int i = 0; i < count; i++)
            {
                vsh      = LogVsh[i].Value;
                poisn[i] = 0.125 * vsh * 100.0d + 0.27;
            }
            double interval = LogVsh[1].MD - LogVsh[0].MD;

            save(vshLog, vshLog.SampleCount, LogVsh[0].MD, interval, poisn, "Poissons ratio");
            PetrelLogger.InfoBox("The Poisson Ratio Log has been created in the same Well");
        }
        public override void Execute(Slb.Ocean.Petrel.Contexts.Context context)
        {
            //TODO: Add command execution logic here
            foreach (object obj in context.GetSelectedObjects())
            {
                SeismicCube scube  = obj as SeismicCube;
                Template    t_cube = scube.Template;
                PetrelLogger.InfoOutputWindow(scube.SampleSpacingIJK.Z.ToString());
                ITemplateService service = PetrelSystem.TemplateService;
                Template         t1      = service.FindTemplateByName("Elevation time");
                double           val_UI  = PetrelUnitSystem.ConvertToUI(t1, scube.SampleSpacingIJK.Z);

                //HorizonInterpretation3D h3d0 = Htop.GetHorizonInterpretation3D(args.srcSeisCube.SeismicCollection);
                //foreach (HorizonInterpretation3DSample horSample in h3d0.Samples) {
                //    scube.IndexAtPosition(new Point3(scube.Origin.X,scube.Origin.Y, horSample.Value));
                //}
            }
        }