Exemplo n.º 1
0
 private void UpdateUIFromArgPack()
 {
     UpdateWellPresenterFromWell(WellPresenter, args.Well);
     // update unit labels
     WellHeadXUnit.Text = PetrelUnitSystem.GetDisplayUnit(Domain.X.UnitMeasurement).DisplaySymbol;
     WellHeadYUnit.Text = PetrelUnitSystem.GetDisplayUnit(Domain.Y.UnitMeasurement).DisplaySymbol;
     //
     // update well head text boxes
     WellHeadXTextBox.Value = args.WellHeadX;
     WellHeadYTextBox.Value = args.WellHeadY;
 }
Exemplo n.º 2
0
            public override void ExecuteSimple()
            {
                // extract input data
                var startX  = PetrelUnitSystem.ConvertFromUI(Domain.X, arguments.X);
                var startY  = PetrelUnitSystem.ConvertFromUI(Domain.Y, arguments.Y);
                var startZ  = PetrelUnitSystem.ConvertFromUI(Domain.ELEVATION_DEPTH, arguments.Z);
                var spacing = PetrelUnitSystem.ConvertFromUI(Domain.ELEVATION_DEPTH, arguments.Spacing);
                var nLines  = arguments.NLines;
                //
                // define default increments
                double incrementX = 500.0;
                double incrementY = 100.0;
                double incrementZ = 100.0;
                //
                // Create points
                var points = new List <Point3>();

                //
                for (int lineIndex = 0; lineIndex < nLines; lineIndex++)
                {
                    for (int pointIndex = 0; pointIndex < nLines; pointIndex++)
                    {
                        double verticalSpacing = pointIndex * spacing;
                        points.Add(new Point3(startX, startY, startZ + verticalSpacing));
                    }
                    //
                    startX += incrementX;
                    startY += incrementY;
                    startZ += incrementZ;
                }
                //
                // create empty collection
                Collection collection = Collection.NullObject;
                Project    project    = PetrelProject.PrimaryProject;

                //
                using (var transaction = DataManager.NewTransaction())
                {
                    transaction.Lock(project);
                    //
                    collection = project.CreateCollection("My Collection");
                    //
                    var pointSet = collection.CreatePointSet("My point set");
                    //
                    // set point set properties
                    pointSet.Domain = Domain.ELEVATION_DEPTH;
                    pointSet.Points = new Point3Set(points);
                    //
                    // update the output argument
                    arguments.PointSet = pointSet;
                    //
                    transaction.Commit();
                }
            }
        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));
                //}
            }
        }
            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();
                }
            }
Exemplo n.º 5
0
            public override void ExecuteSimple()
            {
                // extract input time value
                var displayTimeValue = arguments.DisplayUnitValue;
                //
                // find time measurment
                var timeMeasurement = PetrelProject.WellKnownTemplates.GeometricalGroup.TimeOneWay.UnitMeasurement;
                //
                // find core and ui units
                var displayUnit   = PetrelUnitSystem.GetDisplayUnit(timeMeasurement);
                var invariantUnit = PetrelUnitSystem.GetInvariantUnit(timeMeasurement);
                //
                // do the real conversion
                var invariantTimeValue = PetrelUnitSystem.ConvertFromUI(timeMeasurement, displayTimeValue);

                //
                // update the argument package
                arguments.SIUnitValue = invariantTimeValue;
                arguments.DisplayUnit = displayUnit.DisplaySymbol;
                arguments.SIUnit      = invariantUnit.DisplaySymbol;
            }
            public override void ExecuteSimple()
            {
                // extract input arguments
                var pointSet = arguments.PointSet;
                //
                //  find appropriate azimuth point set property type
                var azimuthPropertyType = WellKnownPointSetPropertyTypes.DipAzimuth;
                //
                var azimuthProperty = GetOrCreateWellKnownPointProperty(pointSet, azimuthPropertyType);
                //
                //
                var azimuthConverter = PetrelUnitSystem.GetConverterFromUI(PetrelProject.WellKnownTemplates.GeometricalGroup.DipAzimuth);
                //
                var rng = new Random();

                // put some values in the azimuth property
                using (var transaction = DataManager.NewTransaction())
                {
                    transaction.Lock(azimuthProperty);
                    //
                    var azimuthValues = new List <double>();
                    //
                    foreach (var _ in azimuthProperty.Records)
                    {
                        double valueInDegree  = rng.NextDouble() * 180;
                        double invariantValue = azimuthConverter.Convert(valueInDegree);
                        azimuthValues.Add(invariantValue);
                    }
                    //
                    // finally update the azimuth values
                    azimuthProperty.SetRecordValues(azimuthProperty.Records, azimuthValues);
                    //
                    transaction.Commit();
                }
                //
                // finally update the output arguments
                arguments.Azimuth = azimuthProperty;
            }
        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);
                }
            }
        }
            public override void ExecuteSimple()
            {
                // extract input data
                var grid         = arguments.Grid;
                var contactDepth = arguments.ContactDepth;

                //
                if (grid == null)
                {
                    PetrelLogger.ErrorStatus("CreateDistanceAboveContactPropertyWorkstep: Must provide input grid");
                    return;
                }
                //
                PropertyCollection properties           = grid.PropertyCollection;
                PropertyCollection oceanProperties      = FindOrCreatePropertyCollection("Ocean Properties", grid);;
                Property           property             = Property.NullObject;
                Template           aboveContactTemplate = PetrelProject.WellKnownTemplates.GeometricalGroup.AboveContact;

                //
                using (var transaction = DataManager.NewTransaction())
                {
                    transaction.Lock(oceanProperties);
                    //
                    property      = oceanProperties.CreateProperty(aboveContactTemplate);
                    property.Name = "Above Contact " + contactDepth;
                    //
                    // we are computing the difference from the constant contact and the grid.Z value
                    double constantDepth = PetrelUnitSystem.ConvertFromUI(grid.Domain, contactDepth);
                    //
                    // set data on the property for all the cells in the grid
                    double cellCenterDepth = double.NaN;
                    double propertyValue   = double.NaN;
                    Index3 currentCell     = new Index3();
                    //
                    for (int i = 0; i < grid.NumCellsIJK.I; i++)
                    {
                        for (int j = 0; j < grid.NumCellsIJK.J; j++)
                        {
                            for (int k = 0; k < grid.NumCellsIJK.K; k++)
                            {
                                currentCell.I = i;
                                currentCell.J = j;
                                currentCell.K = k;
                                //
                                // if the cell is defined and has volume, set property value
                                if (grid.IsCellDefined(currentCell) && grid.HasCellVolume(currentCell))
                                {
                                    // get cell center depth, Z value
                                    cellCenterDepth = grid.GetCellCenter(currentCell).Z;
                                    //
                                    // if the cell center is above the constant depth, set the property value as the difference
                                    propertyValue = cellCenterDepth > constantDepth
                                        ? cellCenterDepth - constantDepth
                                        : 0.0;
                                    //
                                    property[currentCell] = (float)propertyValue;
                                }
                            }
                        }
                    }
                    //
                    transaction.Commit();
                }
                //
                // update output arguments
                arguments.AboveContact = property;
            }
Exemplo n.º 9
0
            public override void ExecuteSimple()
            {
                // extract input arguments
                var cube = arguments.Cube;

                //
                if (cube == null)
                {
                    PetrelLogger.ErrorStatus("PrintSeismicCubeCornersWorkstep: cube cannot be null");
                    return;
                }
                //
                // extract max i, j and k values
                int maxI = cube.NumSamplesIJK.I - 1;
                int maxJ = cube.NumSamplesIJK.J - 1;
                int maxK = cube.NumSamplesIJK.K - 1;
                //
                // create positions indecies
                List <Index3> corners = new List <Index3>()
                {
                    new Index3(0, 0, 0),
                    new Index3(0, maxJ, 0),
                    new Index3(maxI, maxJ, 0),
                    new Index3(maxI, 0, 0),
                    new Index3(0, 0, maxK),
                    new Index3(0, maxJ, maxK),
                    new Index3(maxI, maxJ, maxK),
                    new Index3(maxI, 0, maxK),
                };
                //
                //
                var cornerPoints   = new List <Point3>();
                var uiCornerPoints = new List <Point3>();

                //
                foreach (var corner in corners)
                {
                    var cornerPoint = cube.PositionAtIndex(corner.ToIndexDouble3());
                    //
                    // convert to UI
                    var x = PetrelUnitSystem.ConvertToUI(Domain.X, cornerPoint.X);
                    var y = PetrelUnitSystem.ConvertToUI(Domain.Y, cornerPoint.Y);
                    var z = PetrelUnitSystem.ConvertToUI(cube.Domain, cornerPoint.Z);
                    //
                    cornerPoints.Add(cornerPoint);
                    uiCornerPoints.Add(new Point3(x, y, z));
                }
                //
                for (var index = 0; index < corners.Count; index++)
                {
                    var corner      = corners[index];
                    var cornerPoint = uiCornerPoints[index];
                    //
                    PetrelLogger.InfoOutputWindow($"Index: {corner}");
                    PetrelLogger.InfoOutputWindow($"\tPosition: {cornerPoint}");
                }
                //
                // create pointset for the corner points
                var        project    = PetrelProject.PrimaryProject;
                Collection collection = Collection.NullObject;

                //
                //
                using (var transaction = DataManager.NewTransaction())
                {
                    transaction.Lock(project);
                    //
                    collection = project.CreateCollection("My Collection");
                    //
                    var pointSet = collection.CreatePointSet("My Seismic Corners");
                    //
                    pointSet.Domain = cube.Domain;
                    //
                    pointSet.Points = new Point3Set(cornerPoints);
                    //
                    transaction.Commit();
                }
            }
            public override void ExecuteSimple()
            {
                // extract input data
                var grid = arguments.Grid;

                if (grid == null)
                {
                    PetrelLogger.ErrorStatus("HelloGridWorkstep: Grid argument cannot be empty");
                    return;
                }
                //
                // get total number of cells in the grid
                Index3 numCells = grid.NumCellsIJK;

                arguments.NumCells = numCells.I * numCells.J * numCells.K;
                //
                // get cell and volume
                double px = PetrelUnitSystem.ConvertFromUI(Domain.X, arguments.PointX);
                double py = PetrelUnitSystem.ConvertFromUI(Domain.Y, arguments.PointY);
                double pz = PetrelUnitSystem.ConvertFromUI(grid.Domain, arguments.PointZ);
                //
                Point3 point = new Point3(px, py, pz);
                //
                Index3 cellIndex = grid.GetCellAtPoint(point);

                //
                arguments.CellVolume = Double.NaN;
                if (cellIndex != null && grid.HasCellVolume(cellIndex))
                {
                    arguments.CellVolume = grid.GetCellVolume(cellIndex);
                }
                //
                // get cell corners
                PetrelLogger.InfoOutputWindow("The corner points of the cell are: ");
                foreach (Point3 cellCorner in grid.GetCellCorners(cellIndex, CellCornerSet.All))
                {
                    double x = PetrelUnitSystem.ConvertToUI(Domain.X, cellCorner.X);
                    double y = PetrelUnitSystem.ConvertToUI(Domain.Y, cellCorner.Y);
                    double z = PetrelUnitSystem.ConvertToUI(grid.Domain, cellCorner.Z);
                    //
                    PetrelLogger.InfoOutputWindow($"X = {x}, Y = {y}, Z = {z}");
                }
                //
                // check to see if node is defined at (10,10,10)
                Index3    nodeIndex3 = new Index3(10, 10, 10);
                Direction direction  = Direction.NorthEast;

                if (grid.IsNodeDefined(nodeIndex3, direction))
                {
                    PetrelLogger.InfoOutputWindow("The node is defined at 10, 10, 10 with NorthWest direction");
                }
                //
                // check to see if node is faulted at 10, 10
                Index2 nodeIndex2 = new Index2(10, 10);

                if (grid.IsNodeFaulted(nodeIndex2))
                {
                    // then get faults at the given node
                    foreach (PillarFault fault in grid.GetPillarFaultsAtNode(nodeIndex2))
                    {
                        PetrelLogger.InfoOutputWindow("The fault name at node is " + fault.Description.Name);
                    }
                }
                //
                // get all the horizons in the grid and output each one's name, type, and K index
                PetrelLogger.InfoOutputWindow("\nThere are " + grid.HorizonCount + " horizons in the grid, and their names are:");
                foreach (Horizon hz in grid.Horizons)
                {
                    PetrelLogger.InfoOutputWindow(hz.Name + " is of type " + hz.HorizonType.ToString() + " and is at K index " + hz.K);
                }
                //
                // get all the zones in grid and output their names; these are hierachical
                PetrelLogger.InfoOutputWindow("\nThere are " + grid.ZoneCount + " zones in the grid, and their names are:");
                foreach (Zone z in grid.Zones)
                {
                    PetrelLogger.InfoOutputWindow(z.Name + " has a zone count of " + z.ZoneCount + " and contains these zones:");
                    foreach (Zone subZone in z.Zones)
                    {
                        PetrelLogger.InfoOutputWindow(subZone.Name);
                    }
                }
                //
                //
                PrintPillarFaultsInCollection(grid.FaultCollection);
                //
                // get all the segments in the grid and output their names and cell count
                PetrelLogger.InfoOutputWindow("\nThere are " + grid.SegmentCount + " segments in the grid, and their names are:");
                foreach (Segment seg in grid.Segments)
                {
                    PetrelLogger.InfoOutputWindow(seg.Name + " has a cell count of " + seg.CellCount);
                }
            }