Read ESRI Grid File

Read an ESRI ASCII grid file

import os

import pooch

from PVGeo.grids import EsriGridReader

Download a sample ESRI grid file

url = "https://raw.githubusercontent.com/pyvista/vtk-data/master/Data/esri_grid.dem.zip"
file_paths = pooch.retrieve(url=url, known_hash=None, processor=pooch.Unzip())
file_path = [f for f in file_paths if os.path.basename(f) == "esri_grid.dem"][0]
file_path
'/home/runner/.cache/pooch/fb1e1863d6713886b69896153e1b360e-esri_grid.dem.zip.unzip/esri_grid.dem'
dem = EsriGridReader().apply(file_path)
dem
HeaderData Arrays
ImageDataInformation
N Cells4875263
N Points4879680
X Bounds3.666e+05, 3.732e+05
Y Bounds3.733e+06, 3.740e+06
Z Bounds0.000e+00, 0.000e+00
Dimensions2208, 2210, 1
Spacing3.000e+00, 3.000e+00, 3.000e+00
N Arrays1
NameFieldTypeN CompMinMax
DataPointsfloat641-3.936e+023.988e+02


Apply a filter to the DEM to have realistic topography

warped = dem.warp_by_scalar()
warped.plot(cmap="terrain", clim=[-100, 400])
read esri

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

Gallery generated by Sphinx-Gallery