Skip to content

Commit

Permalink
Updated ALOS class
Browse files Browse the repository at this point in the history
  • Loading branch information
sambowers committed Jan 16, 2018
1 parent bd46cc6 commit 07848c6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions biota/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,23 @@ def getDN(self):
DN = DN_ds.ReadAsArray()

return DN


def getGamma0(self):
def getGamma0(self, units = 'natural'):
"""
Calibrates data to gamma0 (baskscatter) in natural units.
Calibrates data to gamma0 (baskscatter) in decibels or natural units.
"""

assert units == 'natural' or units == 'decibels', "Units must be 'natural' or 'decibels'. You input %s."%units

DN = np.ma.array(self.DN, mask = np.logical_or(self.mask, self.DN == 0))

gamma0 = 10 * np.ma.log10(DN.astype(np.float) ** 2) - 83. # units = decibels
gamma0 = 10 ** (gamma0 / 10.) # Convert to natural units

return gamma0
if units == 'decibels':
return gamma0
elif units == 'natural':
return 10 ** (gamma0 / 10.) # Convert to natural units

def getAGB(self):
"""
Expand Down

0 comments on commit 07848c6

Please sign in to comment.