예제 #1
0
            public override void ExecuteSimple()
            {
                // extract input argument
                var simulationCase = arguments.SimulationCase;

                if (simulationCase == null)
                {
                    PetrelLogger.ErrorStatus("RunCaseWorkstep: simulation case cannot be null");
                    return;
                }
                //
                // get case runner for the case
                var caseRunner = SimulationSystem.GetCaseRunner(simulationCase);

                //
                // export and run the case
                caseRunner.Export();
                caseRunner.Run();
            }
            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;
            }
예제 #3
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();
                }
            }
예제 #4
0
            public override void ExecuteSimple()
            {
                // extract input data from arguments
                var cube            = arguments.Cube;
                var horizon         = arguments.Horizon;
                var horizonProperty = arguments.Horizon3DProperty;

                //
                // make sure that correct input arguments are provided
                if (cube == null || horizon == null)
                {
                    PetrelLogger.ErrorStatus("SeismicInterpretationWorkstep: Arguments cannot be empty");
                    return;
                }
                //
                if (!Equals(cube.Domain, horizon.Domain))
                {
                    PetrelLogger.ErrorStatus("SeismicInterpretationWorkstep: Cube and Horizon must be in the same domain");
                    return;
                }
                //
                //
                using (var transaction = DataManager.NewTransaction())
                {
                    // create an output horizon property if the user did not supply one
                    if (horizonProperty == null)
                    {
                        transaction.Lock(horizon);
                        //
                        // create the property, use the template of the cube
                        var horizonInterpretation = horizon.GetHorizonInterpretation3D(cube.SeismicCollection);
                        //
                        if (horizonInterpretation == null)
                        {
                            PetrelLogger.ErrorStatus("HelloSeismic: Unable to get Horizon Interpretation 3D from HzInt");
                            return;
                        }
                        //
                        horizonProperty      = horizonInterpretation.CreateProperty(cube.Template);
                        horizonProperty.Name = "My New Property";
                    }
                    else
                    {
                        transaction.Lock(horizonProperty);
                    }
                    //
                    // process the horizon property points
                    foreach (PointPropertyRecord record in horizonProperty)
                    {
                        record.Value = double.NaN;
                        //
                        var point = record.Geometry;
                        //
                        // find the seismic sample at the point
                        var pointIndex = cube.IndexAtPosition(point);
                        //
                        // Process the point if we have a valid seismic location.
                        // IndexAtPosition returns NaNs if the position does not map to IJK in cube
                        if (IsIndexDouble3Defined(pointIndex))
                        {
                            Index3 seismicIndex = pointIndex.ToIndex3();
                            //
                            // get the trace containing the seismic sample
                            ITrace trace = cube.GetTrace(seismicIndex.I, seismicIndex.J);
                            //
                            // set the property value to the corresponding trace sample value
                            record.Value = trace[seismicIndex.K];
                        }
                    }
                }
                // update output arguments
                arguments.Horizon3DProperty = horizonProperty;
            }
            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);
                }
            }