Skip to content

Commit d933eac

Browse files
committed
Updated error message
1 parent b06424c commit d933eac

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

geoviews/tests/test_util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ def test_outside_extents():
1313

1414
msg = (
1515
"Could not project data from .+? projection to .+? projection\. "
16-
"Ensure the coordinate reference system \(crs\) matches your data and the kdims\."
16+
"Ensure the coordinate reference system \(CRS\) matches your data and the kdims, "
17+
"and the data is not ouside the bounds of the CRS."
1718
)
1819
with pytest.raises(ValueError, match=msg):
1920
project_extents(extents, src_proj, dest_proj)

geoviews/util.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,14 @@ def project_extents(extents, src_proj, dest_proj, tol=1e-6):
100100
try:
101101
geom_in_crs = dest_proj.project_geometry(geom_in_src_proj, src_proj)
102102
except (ValueError, IndexError):
103-
src_name =type(src_proj).__name__
104-
dest_name =type(dest_proj).__name__
105-
raise ValueError('Could not project data from %s projection '
106-
'to %s projection. Ensure the coordinate '
107-
'reference system (crs) matches your data '
108-
'and the kdims.' %
109-
(src_name, dest_name)) from None
103+
src_name = type(src_proj).__name__
104+
dest_name = type(dest_proj).__name__
105+
raise ValueError(
106+
f'Could not project data from {src_name} projection '
107+
f'to {dest_name} projection. Ensure the coordinate '
108+
'reference system (CRS) matches your data and the kdims, '
109+
'and the data is not ouside the bounds of the CRS.'
110+
) from None
110111
else:
111112
geom_in_crs = boundary_poly.intersection(domain_in_src_proj)
112113
return geom_in_crs.bounds

0 commit comments

Comments
 (0)