Read GSLib Table

Read any GSLib file as a table pyvist.Table

from pyvista import examples

from PVGeo.grids import TableToTimeGrid
from PVGeo.gslib import GSLibReader
# 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
table
HeaderData Arrays
TableInformation
N Rows2100000
N Arrays1
NameTypeN CompMinMax
vfloat6412.667e+002.550e+02


From inspecting the header, we realize that this dataset is 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), order='F').apply(table)
grid
HeaderData Arrays
UniformGridInformation
N Cells2100000
N Points4205902
X Bounds0.000e+00, 1.200e+03
Y Bounds0.000e+00, 1.750e+03
Z Bounds0.000e+00, 1.000e+00
Dimensions1201, 1751, 2
Spacing1.000e+00, 1.000e+00, 1.000e+00
N Arrays1
NameFieldTypeN CompMinMax
vCellsfloat6412.667e+002.550e+02


grid.plot(cpos='xy')
read table

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

Gallery generated by Sphinx-Gallery