Skip to content

Commit

Permalink
Fixed divide by zero error, issue cedadev#28
Browse files Browse the repository at this point in the history
  • Loading branch information
nmassey001 committed Apr 26, 2021
1 parent 959c314 commit e49e951
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions S3netCDF4/utils/agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def add_var_dims(in_object, out_object, axis, fname, common_date):
axis_res = (axis_dim_values[-1] - axis_dim_values[0]) / len(axis_dim_values)
except IndexError:
axis_res = 1
# prevent divide by zero
if (axis_res == 0.0):
axis_res = 1.0
# set the location for the aggregating axis dimension
location[axis_dim_n, 0] = int(axis_dim_values[0] / axis_res)
location[axis_dim_n, 1] = location[axis_dim_n, 0] + len(axis_dim_var)
Expand Down

0 comments on commit e49e951

Please sign in to comment.