Skip to content

Commit

Permalink
feat: catch pyogrio errors when reading zones for geopandas>1
Browse files Browse the repository at this point in the history
  • Loading branch information
martibosch committed Oct 22, 2024
1 parent 4c3955a commit 913fb06
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pylandstats/zonal.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from fiona import errors as fiona_errors
except ImportError:
fiona_errors = None
try:
from pyogrio import errors as pyogrio_errors
except ImportError:
pyogrio_errors = None


from . import multilandscape
from .landscape import Landscape
Expand All @@ -22,6 +27,8 @@
ZONES_READ_ERRORS = [AttributeError, TypeError]
if fiona_errors is not None:
ZONES_READ_ERRORS.append(fiona_errors.DriverError)
if pyogrio_errors is not None:
ZONES_READ_ERRORS.append(pyogrio_errors.DataSourceError)
ZONES_READ_ERRORS = tuple(ZONES_READ_ERRORS)

_compute_zonal_statistics_gdf_doc = """
Expand Down

0 comments on commit 913fb06

Please sign in to comment.