Commit d08a0053 authored by Vincent Delbar's avatar Vincent Delbar
Browse files

ENH: allow TOC calibration + clamp and milli param

1 merge request!34ENH: allow TOC calibration + clamp and milli param
Pipeline #35380 passed with stages
in 5 minutes and 13 seconds
Showing with 13 additions and 9 deletions
+13 -9
...@@ -192,13 +192,16 @@ class Spot67Imagery(Imagery): ...@@ -192,13 +192,16 @@ class Spot67Imagery(Imagery):
""" """
def __init__(self, root_scene, reflectance): def __init__(self, root_scene, reflectance="dn", clamp=False, milli=False):
""" """
Args: Args:
root_scene: The Scene of which the Imagery instance is attached root_scene: the Scene of which the Imagery instance is attached
reflectance: optional level of reflectance (can be "dn", "toa") reflectance: optional level of reflectance (can be "dn", "toa", "toc")
clamp: normalize reflectance values
milli: convert values to milli reflectance
""" """
assert reflectance.lower() == "toa" or reflectance.lower() == "dn", "reflectance can be 'dn' or 'toa'" reflectance = reflectance.lower()
assert reflectance in ("dn", "toa", "toc"), "reflectance can be 'dn', 'toa' or 'toc'"
super().__init__(root_scene=root_scene) super().__init__(root_scene=root_scene)
# Base # Base
...@@ -206,12 +209,13 @@ class Spot67Imagery(Imagery): ...@@ -206,12 +209,13 @@ class Spot67Imagery(Imagery):
self.pan = self.root_scene.dimap_file_pan self.pan = self.root_scene.dimap_file_pan
# Radiometry correction # Radiometry correction
if reflectance.lower() == "toa": if reflectance in ("toa", "toc"):
def _toa(inp): def _calib(inp):
return pyotb.OpticalCalibration({"in": inp, "level": "toa"}) params = {"in": inp, "level": reflectance, "clamp": clamp, "milli": milli}
return pyotb.OpticalCalibration(params)
self.xs = _toa(self.xs) self.xs = _calib(self.xs)
self.pan = _toa(self.pan) self.pan = _calib(self.pan)
def get_xs(self): def get_xs(self):
""" """
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment