Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion geodepy/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def grid2geo(zone, east, north, hemisphere="south", ellipsoid=grs80, prj=utm):
"Invalid Zone - Choose from 541, 542, 543, 551, 552, 553, 561, 562, 563, 572"
)
else:
if zone < 0 or zone > 60:
if zone < 1 or zone > 60:
raise ValueError("Invalid Zone - Zones from 1 to 60")

if east < -2830000 or east > 3830000:
Expand Down
12 changes: 7 additions & 5 deletions geodepy/tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,18 +297,20 @@ def test_grid2geo(self):
# Test Input Validation
with self.assertRaises(ValueError):
grid2geo(-1, 0, 500000)
with self.assertRaises(ValueError):
grid2geo(0, 500000, 0, "North")
with self.assertRaises(ValueError):
grid2geo(61, 0, 500000)
with self.assertRaises(ValueError):
grid2geo(0, -2830001, 500000)
grid2geo(1, -2830001, 500000)
with self.assertRaises(ValueError):
grid2geo(0, 3830001, 500000)
grid2geo(1, 3830001, 500000)
with self.assertRaises(ValueError):
grid2geo(0, 0, -1)
grid2geo(1, 0, -1)
with self.assertRaises(ValueError):
grid2geo(0, 0, 10000001)
grid2geo(1, 0, 10000001)
with self.assertRaises(ValueError):
grid2geo(0, 0, 500000, "fail")
grid2geo(1, 0, 500000, "fail")
# test ValueError raised if not a valid ISG zone
with self.assertRaises(ValueError):
grid2geo(zone=530, east=300000, north=1500000, ellipsoid=ans, prj=isg)
Expand Down