Skip to content
Snippets Groups Projects
Commit d2febd42 authored by Anne Philipp's avatar Anne Philipp
Browse files

fixed grid area check for negative values

parent 095dc73c
No related branches found
No related tags found
No related merge requests found
...@@ -68,19 +68,19 @@ def check_area(grid, area, upper, lower, left , right): ...@@ -68,19 +68,19 @@ def check_area(grid, area, upper, lower, left , right):
upper, left, lower, right = components upper, left, lower, right = components
# determine area format # determine area format
if (float(upper) / 1000. >= 0.05 and if (abs(float(upper) / 1000.) >= 0.05 and
float(lower) / 1000. >= 0.05 and abs(float(lower) / 1000.) >= 0.05 and
float(left) / 1000. >= 0.05 and abs(float(left) / 1000.) >= 0.05 and
float(right) / 1000. >= 0.05): abs(float(right) / 1000.) >= 0.05):
# area is defined in 1/1000 degrees; old format # area is defined in 1/1000 degrees; old format
area = '{}/{}/{}/{}'.format(float(upper) / 1000., area = '{}/{}/{}/{}'.format(float(upper) / 1000.,
float(left) / 1000., float(left) / 1000.,
float(lower) / 1000., float(lower) / 1000.,
float(right) / 1000.) float(right) / 1000.)
elif (float(upper) / 1000. < 0.05 and elif (abs(float(upper) / 1000.) < 0.05 and
float(lower) / 1000. < 0.05 and abs(float(lower) / 1000.) < 0.05 and
float(left) / 1000. < 0.05 and abs(float(left) / 1000.) < 0.05 and
float(right) / 1000. < 0.05): abs(float(right) / 1000.) < 0.05):
# area is already in new format # area is already in new format
area = '{}/{}/{}/{}'.format(float(upper), area = '{}/{}/{}/{}'.format(float(upper),
float(left), float(left),
...@@ -88,7 +88,9 @@ def check_area(grid, area, upper, lower, left , right): ...@@ -88,7 +88,9 @@ def check_area(grid, area, upper, lower, left , right):
float(right)) float(right))
else: else:
raise ValueError('The area components have different ' raise ValueError('The area components have different '
'formats: %s ' (area)) 'formats (upper, lower, left, right): '
'{}/{}/{}/{}'.format(str(upper), str(lower),
str(left) , str(right)))
return area return area
...@@ -152,7 +154,6 @@ def check_ppid(c, ppid): ...@@ -152,7 +154,6 @@ def check_ppid(c, ppid):
return return
def check_(): def check_():
''' '''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment