Read Surfer Grid File

Read an Surfer ASCII grid file

import pooch

from PVGeo.grids import SurferGridReader

Download a sample Surfer grid file

fname = "surfer-grid.grd"
url = "https://github.com/OpenGeoVis/PVGeo/raw/main/tests/data/{}".format(fname)
file_path = pooch.retrieve(url=url, known_hash=None)

dem = SurferGridReader().apply(file_path)
dem
HeaderData Arrays
ImageDataInformation
N Cells40001
N Points40404
X Bounds0.000e+00, 1.105e+06
Y Bounds0.000e+00, 9.050e+05
Z Bounds0.000e+00, 0.000e+00
Dimensions222, 182, 1
Spacing5.000e+03, 5.000e+03, 1.000e+00
N Arrays1
NameFieldTypeN CompMinMax
DataPointsfloat641-2.519e+021.754e+02


Apply a filter to the DEM to have realistic topography

warped = dem.warp_by_scalar(scale_factor=300.0)
warped.plot(cmap="terrain")
read surfer

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

Gallery generated by Sphinx-Gallery