ocean

Setting data in the Cloned Seismic Cube


I am quite new to Ocean Framework. I had cloned a pre-existing seismic cube to create a new seismic cube .

// Getting the Parent Cube
SeismicCube ParentCube = InputSeismicLine3D.SeismicCube;
// Getting the Seismic Collection
SeismicCollection Sc = ParentCube.SeismicCollection;

//
if (Sc.CanCreateSeismicCube(ParentCube))
{
SeismicCube NewCube = Sc.CreateSeismicCube(ParentCube, ParentCube.Template);
}

Can anyone tell me how to set the trace data in the "NewCube". Thanks in advance.


Solution

  • SeismicCube has Traces property.

    From the SDK:

    Writing is only possible for cubes, which return IsWritable as true and the cube is locked in a transaction. Trace value changes (like trace[12] = 123.0) are flushed automatically at regular intervals when you advance to the next trace with enumerator.MoveNext(). The value range is recomputed when you finish iterating (MoveNext() returns false).

    In your example:

    if (Sc.CanCreateSeismicCube(ParentCube))
    {
        SeismicCube NewCube = Sc.CreateSeismicCube(ParentCube, ParentCube.Template);
        if (!NewCube.IsWriteable) 
            return;
    
        using (ITransaction trans = DataManager.NewTransaction()) {
            trans.Lock(NewCube);
            foreach (ITrace trace in NewCube.Traces)
            {
                //Do some setting of trace values here. Example only:
                for (int i = 0; i < trace.Length; i++)
                {
                    trace[i] = trace.I + trace.J + i;
                }
            }
            trans.Commit();
        }
    }