Skip to content

Commit

Permalink
WIP: User-friendly exception for OGR.get_source_data
Browse files Browse the repository at this point in the history
  • Loading branch information
jmilloy committed Aug 3, 2021
1 parent cc59d81 commit 91be103
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions podpac/core/data/ogr.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@ def extents(self):
layer = self.datasource.GetLayerByName(self.layer)
return layer.GetExtent()

def get_source_data(self, bounds={}):
"""
Raise a user-friendly exception when calling get_source_data for this node.
Arguments
---------
bounds : dict
Dictionary of bounds by dimension, optional.
Keys must be dimension names, and values are (min, max) tuples, e.g. ``{'lat': (10, 20)}``.
raises
------
AttributeError : Cannot get source data for OGR datasources
"""

raise AttributeError(
"Cannot get source data for OGR datasources. "
"The source data is a vector-based shapefile without a native resolution."
)

@common_doc(COMMON_NODE_DOC)
def _eval(self, coordinates, output=None, _selector=None):
if "lat" not in coordinates.udims or "lon" not in coordinates.udims:
Expand Down

0 comments on commit 91be103

Please sign in to comment.