Skip to content

Commit

Permalink
Merge pull request #38 from mraspaud/fix-level-list
Browse files Browse the repository at this point in the history
Remove unnecessary casting in adding overlay from dictionary
  • Loading branch information
djhoese committed Dec 6, 2019
2 parents 6bb2b07 + 36ae7c6 commit eb35e25
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions pycoast/cw_base.py
Expand Up @@ -649,8 +649,8 @@ def _iterate_db(self, db_name, tag, resolution, level, zero_pad, db_root_path=No
else:
format_string += 'L%s.shp'

if type(level) not in (list,):
level = range(1,level+1)
if not isinstance(level, list):
level = range(1, level + 1)

for i in level:

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

params['level'] = int(params['level'])
params['x_offset'] = float(params['x_offset'])
params['y_offset'] = float(params['y_offset'])
params['width'] = float(params['width'])
params['outline_opacity'] = int(params['outline_opacity'])
params['fill_opacity'] = int(params['fill_opacity'])

if section != "coasts":
params.pop('fill_opacity', None)
params.pop('fill', None)
Expand Down
2 changes: 1 addition & 1 deletion pycoast/tests/test_pycoast.py
Expand Up @@ -753,7 +753,7 @@ def test_foreground(self):
self.assertTrue(fft_metric(euro_data, res),
'Writing of contours failed')

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

Expand Down

0 comments on commit eb35e25

Please sign in to comment.