Read GSLib Table

Read any GSLib file as a table pyvist.Table

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())

Out:

1200 1750 1
print(table)

Out:

Table (0x7f0ea79f1648)
  N Rows:       2100000
  N Arrays:     1

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

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

Out:

UniformGrid (0x7f0ea79f1ee8)
  N Cells:      2100000
  N Points:     4205902
  X Bounds:     0.000e+00, 1.200e+03
  Y Bounds:     0.000e+00, 1.750e+03
  Z Bounds:     0.000e+00, 1.000e+00
  Dimensions:   1201, 1751, 2
  Spacing:      1.000e+00, 1.000e+00, 1.000e+00
  N Arrays:     1
grid.plot(cpos='xy')
../../_images/sphx_glr_read-table_001.png

Total running time of the script: ( 0 minutes 29.281 seconds)

Gallery generated by Sphinx-Gallery