Skip to content

Commit

Permalink
Moved truncation to glint.py to minimize redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchlus committed Sep 22, 2021
1 parent 2d869b7 commit a084efb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 4 additions & 1 deletion hytools/glint/glint.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def apply_glint_correct(hy_obj, data, dimension, index):

elif hy_obj.glint['type'] == 'hedley':
data = apply_hedley_2005_correction(hy_obj, data, dimension, index)
# Can add more corrections here

#Truncate reflectance values below 0
if hy_obj.glint['truncate']:
data[(data < 0) & (data != hy_obj.no_data)]= 0

return data
8 changes: 1 addition & 7 deletions hytools/glint/hochberg_2003.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,7 @@ def apply_hochberg_2003_correction(hy_obj, data, dimension, index):
y, x = index
correction = hy_obj.ancillary['hochberg_correction'][y, x]

data_correct = data - correction

if hy_obj.glint['truncate']:
data_correct[(data_correct < 0) & (data != hy_obj.no_data)]= 0

return data_correct

return data - correction

def get_hochberg_correction(hy_obj):
"""
Expand Down

0 comments on commit a084efb

Please sign in to comment.