Esempio n. 1
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;
            }
        }
Esempio n. 3
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);
        }
        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);
                 * }*/
            }
        }
Esempio n. 5
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();
     }
 }
        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})");
            }
        }
Esempio n. 8
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();
 }
Esempio n. 9
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();
                }
            }
            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);
        }
Esempio n. 14
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);
            }
        }
            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);
            }
 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 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));
                //}
            }
        }
Esempio n. 18
0
            public override void ExecuteSimple()
            {
                // extract input arguments
                int worksteps = arguments.Worksteps;

                //
                //
                using (var progress = PetrelLogger.NewProgress(1, worksteps, ProgressType.Default, Cursors.Cross))
                {
                    for (int i = 1; i <= worksteps; i++)
                    {
                        PetrelLogger.InfoOutputWindow("Doing work item: " + i);
                        //
                        progress.SetProgressText("Doing work item: " + i);
                        progress.ProgressStatus = i;
                        WasteTime(1000);
                    }
                }
            }
            public override void ExecuteSimple()
            {
                // extract data from arguments
                var templateName        = arguments.Name;
                var templatePrecision   = arguments.Precision;
                var templateDisplayUnit = arguments.DisplayUnit;
                var templateLabel       = arguments.Label;
                //
                // find an appropriate measurment
                var timeMeasurement = PetrelUnitSystem.GetUnitMeasurement("Time");
                //
                // find an appropriate template collection
                var timeTwoWayTemplate            = PetrelProject.WellKnownTemplates.GeometricalGroup.TimeTwoWay;
                var geometricalTemplateCollection = timeTwoWayTemplate.TemplateCollection;
                //
                // find an appropriate color table
                var colorTableRoot = ColorTableRoot.Get(PetrelProject.PrimaryProject);
                var generalContinuousColorTable = colorTableRoot.WellKnownColorTables.Other.GeneralContinuous;
                //
                // find appropriate unit
                var unitServiceSettingsService = CoreSystem.GetService <IUnitServiceSettings>();
                var templateUnit = unitServiceSettingsService?.CurrentCatalog.GetUnit(templateDisplayUnit);

                //
                using (var transaction = DataManager.NewTransaction())
                {
                    transaction.Lock(geometricalTemplateCollection);
                    //
                    var uniqueTemplateName = PetrelSystem.TemplateService.GetUniqueName(templateName);
                    var canCreateTemplate  = geometricalTemplateCollection.CanCreateTemplate(timeTwoWayTemplate);
                    if (canCreateTemplate)
                    {
                        var newTemplate = geometricalTemplateCollection.CreateTemplate(uniqueTemplateName, generalContinuousColorTable, timeMeasurement, templateUnit);
                        if (newTemplate != null)
                        {
                            PetrelLogger.InfoOutputWindow("Create a new template with name " + uniqueTemplateName);
                        }
                    }
                    //
                    transaction.Commit();
                }
            }
Esempio n. 20
0
        public List <WellTrajectory> ForWell(Well well)
        {
            List <WellTrajectory> records = new List <WellTrajectory>();

            try
            {
                WebImporter wi = new WebImporter();
                DataTable   dt = wi.LoadSurvey(dcInfo.WebServer, dcInfo.WebServerU, dcInfo.WebServerP, well.Uwi);
                foreach (DataRow dr in dt.Rows)
                {
                    var w = this.WellTrajectoryFromRow(dr);
                    records.Add(w);
                }
            }
            catch (Exception e)
            {
                PetrelLogger.InfoOutputWindow("Failed to load wells: " + e.ToString());
            }
            return(records);
        }
Esempio n. 21
0
        public List <Well> GetAll()
        {
            List <Well>        wells = new List <Well>();
            WebImporterWrapper wi    = new WebImporterWrapper(dcInfo);

            try
            {
                DataTable dt = wi.LoadWells();
                foreach (DataRow dr in dt.Rows)
                {
                    var w = this.WellFromRow(dr);
                    wells.Add(w);
                }
            }
            catch (Exception e)
            {
                PetrelLogger.InfoOutputWindow("Failed to load wells: " + e.ToString());
            }
            return(wells);
        }
        private void help_Click(object sender, EventArgs e)
        {
            try
            {
                StreamWriter sw = new StreamWriter("C:\\help.chm");
                sw.Close();
                FileStream fs = new FileStream("C:\\help.chm", FileMode.Open, FileAccess.Write);
                Stream     str;

                fs.Write(global::WellReader.Resource_chracterizer.Well_and_Reservoir_Characterization, 0, global::WellReader.Resource_chracterizer.Well_and_Reservoir_Characterization.Count());
                fs.Close();

                System.Diagnostics.Process p = new System.Diagnostics.Process();
                p.StartInfo.FileName = "C:\\help.chm";
                p.Start();
            }
            catch
            {
                PetrelLogger.InfoOutputWindow("Unable to Read to your drive -check permissions");
            };
        }
Esempio n. 23
0
        public static void helpCallback(object Sender, EventArgs e)
        {
            try
            {
                StreamWriter sw = new StreamWriter("C:\\help.chm");
                sw.Close();
                FileStream fs = new FileStream("C:\\help.chm", FileMode.Open, FileAccess.Write);
                Stream     str;

                fs.Write(global::WellReader.Resource_chracterizer.Geocom_Chat, 0, global::WellReader.Resource_chracterizer.Geocom_Chat.Length);
                fs.Close();

                System.Diagnostics.Process p = new System.Diagnostics.Process();
                p.StartInfo.FileName = "C:\\help.chm";
                p.Start();
            }
            catch
            {
                PetrelLogger.InfoOutputWindow("Unable to Read to your drive -check permissions");
            };
        }
            public override void ExecuteSimple()
            {
                // get current project
                Project project = PetrelProject.PrimaryProject;
                //
                // get well root
                WellRoot wellRoot = WellRoot.Get(project);
                //
                // get main borehole collection and marker collections
                var mainBoreholeCollection = wellRoot.BoreholeCollection;
                var markerCollections      = wellRoot.MarkerCollections;

                //
                //
                PetrelLogger.InfoOutputWindow("-------------------Well Root Navigation-------------");
                //
                PetrelLogger.InfoOutputWindow("---------------Boreholes-------------------");
                ListAllBoreholesRecursively(mainBoreholeCollection, 0);
                //
                PetrelLogger.InfoOutputWindow("---------------Markers---------------------");
                ListAllMarkers(markerCollections);
            }
            public override void ExecuteSimple()
            {
                PetrelLogger.InfoOutputWindow($"Executing {typeof(ParentInfoFinderWorkstep).Name}");
                //
                object petrelObject        = arguments.PetrelTreeObject;
                var    parentSourceFactory = CoreSystem.GetService <IParentSourceFactory>(petrelObject);

                //
                if (parentSourceFactory != null)
                {
                    var parentSource = parentSourceFactory.GetParentSource(petrelObject);
                    var parentObject = parentSource.Parent;
                    //
                    var nameInfoFactory = CoreSystem.GetService <INameInfoFactory>(parentObject);
                    //
                    if (nameInfoFactory != null)
                    {
                        var parentNameInfo = nameInfoFactory.GetNameInfo(parentObject);
                        PetrelLogger.InfoOutputWindow($"Parent Info are: Name = {parentNameInfo.Name}; DisplayName = {parentNameInfo.DisplayName}; TypeName = {parentNameInfo.TypeName}");
                    }
                }
            }
Esempio n. 26
0
        private void ImportWell(Well well, BoreholeCollection boreholeColl)
        {
            string uwi = well.Uwi;

            if (uwi.Trim().Length == 0)
            {
                PetrelLogger.InfoOutputWindow("Unable to import well: " + well.Name + " => UWI not defined.");
                return;
            }
            Borehole borehole = boreholeColl.FindWellByUWI(uwi);

            PetrelLogger.InfoOutputWindow("Importing well named: " + well.Name);
            if (borehole == null)
            {
                PetrelLogger.InfoOutputWindow("Creating well named: " + well.Name);
                CreateWell(well, boreholeColl);
            }
            else
            {
                PetrelLogger.InfoOutputWindow("Skip existing well: " + well.Name);
            }
        }
Esempio n. 27
0
        public void ImportFile(string f, bool skipImported)
        {
            if (skipImported && importedFiles.Contains(f))
            {
                return;
            }
            string[] lastImportedFiles;
            object[] importedObjects;
            WellRoot wellRoot = WellRoot.Get(PetrelProject.PrimaryProject);

            PetrelSystem.FileFormats.ShowImportDialog(
                PetrelSystem.FileFormats.WellKnownFileFormats.WellLog,
                Path.GetDirectoryName(f),
                wellRoot.BoreholeCollection,
                out lastImportedFiles,
                out importedObjects);
            importedFiles = importedFiles.Concat(lastImportedFiles).ToArray();
            foreach (var path in importedFiles)
            {
                PetrelLogger.InfoOutputWindow("Imported File: " + path);
            }
        }
            private void ListAllBoreholesRecursively(BoreholeCollection boreholeCollection, int indentationLevel)
            {
                string prefixIndentation =
                    Enumerable
                    .Range(0, indentationLevel)
                    .Aggregate("", (acc, curr) => acc + "\t");

                //
                // print borehole collection name
                PetrelLogger.InfoOutputWindow(prefixIndentation + "Borehole Collection: " + boreholeCollection.Name + " has " + boreholeCollection.Count + " wells");
                //
                // print all of the boreholes in the borehole collection
                foreach (Borehole borehole in boreholeCollection)
                {
                    PetrelLogger.InfoOutputWindow(prefixIndentation + "\t" + "Well: " + borehole.Name);
                }
                //
                foreach (var childBoreholeCollection in boreholeCollection.BoreholeCollections)
                {
                    ListAllBoreholesRecursively(childBoreholeCollection, indentationLevel + 1);
                }
            }
        private void PrintBoreholeCollection(BoreholeCollection boreholeCollection)
        {
            PetrelLogger.InfoOutputWindow("Borehole Collection: " + boreholeCollection.Name + " has " + boreholeCollection.Count.ToString() + " wells.");

            if (boreholeCollection.Count > 0)
            {
                foreach (Borehole well in boreholeCollection)
                {
                    double min = PetrelUnitSystem.ConvertToUI(Domain.MD, well.MDRange.Min);
                    double max = PetrelUnitSystem.ConvertToUI(Domain.MD, well.MDRange.Max);
                    //PetrelLogger.InfoOutputWindow("    Well: " + well.Name + "\t MD range: " + min.ToString() + ", " + max.ToString());
                    PetrelLogger.InfoOutputWindow("    Well: " + well.Name);
                }
            }

            if (boreholeCollection.BoreholeCollectionCount > 0)
            {
                foreach (BoreholeCollection col in boreholeCollection.BoreholeCollections)
                {
                    PrintBoreholeCollection(col);
                }
            }
        }
Esempio n. 30
0
 public override void Execute(Slb.Ocean.Petrel.Contexts.Context context)
 {
     //TODO: Add command execution logic here
     PetrelLogger.InfoOutputWindow(string.Format("{0} clicked", @"New XYZ Object"));
 }