Commit ef7da783 authored by Cresson Remi's avatar Cresson Remi
Browse files

ADD: securize sources + update docstring

1 merge request!12ENH: S2A and S3A support
Pipeline #33676 passed with stages
in 2 minutes and 52 seconds
Showing with 13 additions and 11 deletions
+13 -11
......@@ -51,7 +51,7 @@ class Source(pyotb.Output):
:return: drilled source
"""
if utils.open_vector_layer(msk_vec_file):
# Cloud mask is not empty
# Vector data not empty
rasterization = pyotb.Rasterization({"in": msk_vec_file,
"im": self,
"mode": "binary",
......@@ -64,7 +64,7 @@ class Source(pyotb.Output):
"""
Return the source masked from an uint8 binary raster (0 or 1..255).
Pixels are set to "nodata" where the mask values are 0.
:param binary_mask: input vector data filename
:param binary_mask: input mono-band binary raster filename
:param nodata: nodata value for rejected values
:return: masked source
"""
......@@ -74,7 +74,7 @@ class Source(pyotb.Output):
"mode.apply.ndval": nodata})
return self.new_source(binary_mask, manage_nodata)
def resample_over(self, ref_img, interpolator="nn", nodata=0):
def resample_over(self, ref_img, interpolator="bco", nodata=0):
"""
Return the source superimposed over the input image
:param ref_img: reference image
......@@ -82,10 +82,11 @@ class Source(pyotb.Output):
:param nodata: no data value
:return: resampled image source
"""
return self.new_source(pyotb.Superimpose({"inm": self,
"inr": ref_img,
"interpolator": interpolator,
"fv": nodata}))
superimpose = pyotb.Superimpose({"inm": self,
"inr": ref_img,
"interpolator": interpolator,
"fv": nodata})
return self.new_source(ref_img, superimpose)
def clip_over_img(self, ref_img):
"""
......@@ -93,9 +94,10 @@ class Source(pyotb.Output):
:param ref_img: reference image
:return: ROI clipped source
"""
return self.new_source(pyotb.ExtractROI({"in": self,
"mode": "fit",
"mode.fit.im": ref_img}))
extract_roi = pyotb.ExtractROI({"in": self,
"mode": "fit",
"mode.fit.im": ref_img})
return self.new_source(ref_img, extract_roi)
def clip_over_vec(self, ref_vec):
"""
......@@ -107,7 +109,7 @@ class Source(pyotb.Output):
"mode": "fit",
"mode.fit.vec": ref_vec}))
def reproject(self, epsg, interpolator="nn"):
def reproject(self, epsg, interpolator="bco"):
"""
Reproject the source into the specified EPSG
:param epsg: EPSG (int)
......
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