diff --git a/scenes/spot.py b/scenes/spot.py index 9765172a89ef00087df0380948e235c4042e5676..9bf40cd67322a6f801171f898118c1e9b6f95b05 100644 --- a/scenes/spot.py +++ b/scenes/spot.py @@ -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: - root_scene: The Scene of which the Imagery instance is attached - reflectance: optional level of reflectance (can be "dn", "toa") + root_scene: the Scene of which the Imagery instance is attached + 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) # Base @@ -206,12 +209,13 @@ class Spot67Imagery(Imagery): self.pan = self.root_scene.dimap_file_pan # Radiometry correction - if reflectance.lower() == "toa": - def _toa(inp): - return pyotb.OpticalCalibration({"in": inp, "level": "toa"}) + if reflectance in ("toa", "toc"): + def _calib(inp): + params = {"in": inp, "level": reflectance, "clamp": clamp, "milli": milli} + return pyotb.OpticalCalibration(params) - self.xs = _toa(self.xs) - self.pan = _toa(self.pan) + self.xs = _calib(self.xs) + self.pan = _calib(self.pan) def get_xs(self): """