Skip to content

Commit

Permalink
Per #2631, fix masked array error in the get_precision(...) function …
Browse files Browse the repository at this point in the history
…I encountered when using the utility to inspect the diffs for this PR.
  • Loading branch information
JohnHalleyGotway committed Oct 25, 2024
1 parent 380ae53 commit e386695
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/python/utility/print_pointnc2ascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ def get_nc_var_string_data(self, nc_group, var_name):
def get_precision(self, data_list):
precision = 0
for v in data_list:
if abs((v*10)-int(v*10)) < 0.000001 or abs((v*10)-int(v*10)) > 0.999998:
if np.ma.is_masked(v) or np.isnan(v):
continue
elif abs((v*10)-int(v*10)) < 0.000001 or abs((v*10)-int(v*10)) > 0.999998:
if precision < 1:
precision = 1
elif abs((v*100)-int(v*100)) < 0.000001 or abs((v*100)-int(v*100)) > 0.999998:
Expand Down

0 comments on commit e386695

Please sign in to comment.