Skip to content

Commit eb35e25

Browse files
authored
Merge pull request #38 from mraspaud/fix-level-list
Remove unnecessary casting in adding overlay from dictionary
2 parents 6bb2b07 + 36ae7c6 commit eb35e25

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

pycoast/cw_base.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,8 @@ def _iterate_db(self, db_name, tag, resolution, level, zero_pad, db_root_path=No
649649
else:
650650
format_string += 'L%s.shp'
651651

652-
if type(level) not in (list,):
653-
level = range(1,level+1)
652+
if not isinstance(level, list):
653+
level = range(1, level + 1)
654654

655655
for i in level:
656656

@@ -792,13 +792,6 @@ def add_overlay_from_dict(self, overlays, area_def, cache_epoch=None, background
792792
params = DEFAULT.copy()
793793
params.update(overlays[section])
794794

795-
params['level'] = int(params['level'])
796-
params['x_offset'] = float(params['x_offset'])
797-
params['y_offset'] = float(params['y_offset'])
798-
params['width'] = float(params['width'])
799-
params['outline_opacity'] = int(params['outline_opacity'])
800-
params['fill_opacity'] = int(params['fill_opacity'])
801-
802795
if section != "coasts":
803796
params.pop('fill_opacity', None)
804797
params.pop('fill', None)

pycoast/tests/test_pycoast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def test_foreground(self):
753753
self.assertTrue(fft_metric(euro_data, res),
754754
'Writing of contours failed')
755755

756-
overlays = {'coasts': {'level': 4, 'resolution': 'l'},
756+
overlays = {'coasts': {'level': [1, 2, 3, 4], 'resolution': 'l'},
757757
'borders': {'outline': (255, 0, 0), 'resolution': 'c'},
758758
'rivers': {'outline': 'blue', 'resolution': 'c', 'level': 5}}
759759

0 commit comments

Comments
 (0)