コード例 #1
0
    def test_seplib(self):
        """`TableToTimeGrid`: check a SEPLib ordered array"""
        def sepit(a):
            a = a.swapaxes(0, 2)
            a = a.swapaxes(0, 1)
            return a

        # Use filter
        f = TableToTimeGrid()
        f.SetInputDataObject(self.table)
        f.set_dimensions(1, 2, 0, 3)
        f.set_extent(20, 2, 5, 2)
        f.set_spacing(5, 5, 5)
        f.set_origin(3.3, 6.0, 7)
        f.set_use_points(False)
        f.set_order('F')
        for t in range(2):
            f.UpdateTimeStep(t)
            ido = f.GetOutput()
            self.assertEqual(ido.GetDimensions(), (3, 6, 21))
            checkme = [None] * len(self.arrs)
            for i, arr in enumerate(self.arrs):
                a = arr.reshape((20, 2, 5, 2), order='F')[:,:,:,t]
                a = sepit(a)
                checkme[i] = a.flatten(order='F') # Order F because in XYZ format

            self.check_data_fidelity(ido, checkme, points=False)
        f.set_use_points(True)
        f.Update()
        for t in range(2):
            f.UpdateTimeStep(t)
            ido = f.GetOutput()
            self.assertEqual(ido.GetDimensions(), (2, 5, 20))
            checkme = [None] * len(self.arrs)
            for i, arr in enumerate(self.arrs):
                a = arr.reshape((20, 2, 5, 2), order='F')[:,:,:,t]
                a = sepit(a)
                checkme[i] = a.flatten(order='F') # Order F because in XYZ format
            self.check_data_fidelity(ido, checkme, points=True)
        return
コード例 #2
0
 def set_use_points(self, flag):
     TableToTimeGrid.set_use_points(self, flag)
コード例 #3
0
 def test_simple(self):
     """`TableToTimeGrid`: check simple"""
     # Use filter
     f = TableToTimeGrid()
     f.SetInputDataObject(self.table)
     f.set_dimensions(0, 1, 2, 3)
     f.set_extent(20, 2, 5, 2)
     f.set_spacing(5, 5, 5)
     f.set_origin(3.3, 6.0, 7)
     f.set_use_points(False)
     f.set_order('C')
     for t in range(2):
         f.UpdateTimeStep(t)
         ido = f.GetOutput()
         checkme = [None] * len(self.arrs)
         for i, arr in enumerate(self.arrs):
             a = arr.reshape((20, 2, 5, 2))[:,:,:,t]
             checkme[i] = a.flatten(order='F') # Order F because in XYZ format
         self.check_data_fidelity(ido, checkme, points=False)
     f.set_use_points(True)
     f.Update()
     for t in range(2):
         f.UpdateTimeStep(t)
         ido = f.GetOutput()
         checkme = [None] * len(self.arrs)
         for i, arr in enumerate(self.arrs):
             a = arr.reshape((20, 2, 5, 2))[:,:,:,t]
             checkme[i] = a.flatten(order='F') # Order F because in XYZ format
         self.check_data_fidelity(ido, checkme, points=True)
     return
コード例 #4
0
 def set_time_delta(self, dt):
     TableToTimeGrid.set_time_delta(self, dt)
コード例 #5
0
 def get_time_step_values(self):
     """This is critical for registering the timesteps"""
     return TableToTimeGrid.get_time_step_values(self)
コード例 #6
0
 def set_origin(self, x0, y0, z0):
     TableToTimeGrid.set_origin(self, x0, y0, z0)
コード例 #7
0
 def set_order(self, order):
     o = ['C', 'F']
     TableToTimeGrid.set_order(self, o[order])
コード例 #8
0
 def set_spacing(self, dx, dy, dz):
     TableToTimeGrid.set_spacing(self, dx, dy, dz)
コード例 #9
0
 def set_dimensions(self, x, y, z, t):
     TableToTimeGrid.set_dimensions(self, x, y, z, t)
コード例 #10
0
 def set_extent(self, nx, ny, nz, nt):
     TableToTimeGrid.set_extent(self, nx, ny, nz, nt)
コード例 #11
0
 def __init__(self):
     TableToTimeGrid.__init__(self)
コード例 #12
0
ファイル: read-table.py プロジェクト: zoomvr/PVGeo
import pyvista as pv
from pyvista import examples
from PVGeo.gslib import GSLibReader
from PVGeo.grids import TableToTimeGrid

###############################################################################

# points_url = 'http://www.trainingimages.org/uploads/3/4/7/0/34703305/sundarbans.zip'
filename, _ = examples.downloads._download_file('sundarbans.SGEMS.zip')

reader = GSLibReader()
table = reader.apply(filename)

# Print the file header
print(reader.get_file_header())

###############################################################################
print(table)

###############################################################################
# From inspecting the header, we realize that this dataset os gridded, so let's
# use the :class:`PVGeo.grid.TableToTimeGrid` filter to create a
# :class:`pyvista.UniformGrid` of that dataset.

# 1200 x, 1750 y, 1 z, 1 t
grid = TableToTimeGrid(extent=(1200, 1750, 1, 1)).apply(table)
print(grid)

###############################################################################
grid.plot(cpos='xy')