Clipping data values
- remote_sensing_processor.clip_values(input_path, output_path=None, minimum=None, maximum=None, nodata=None, dtype=None, write_stac=True)[source]
Clip data values.
- Parameters:
input_path (string or STAC Item) – Path to input file, directory or STAC dataset or a STAC Item (e.g., from Planetary Computer).
output_path (string (optional)) – Path to an output file, directory, or STAC dataset. If not set, then will overwrite the input files. Must be set if input is a remote STAC Item.
minimum (int or float (optional)) – Min value.
maximum (int or float (optional)) – Max value.
nodata (int or float (default = None)) – Nodata value. If not set, then is read from inputs.
dtype (dtype definition as a string (optional)) – Requested output data type.
write_stac (bool (default = True)) – If True, then output metadata is saved to a STAC file.
- Returns:
output_path – Path where output raster is saved.
- Return type:
pathlib.Path
Examples
>>> import remote_sensing_processor as rsp >>> # Clip raster values >>> rsp.clip_values( ... input_path="/home/rsp_test/sentinel_B1.tif", ... output_path="/home/rsp_test/sentinel_B1_clipped.tif", ... minimum=0, ... maximum=10000, ... ) '/home/rsp_test/sentinel_B1_clipped.json'
>>> # Clip only lower values >>> rsp.clip_values( ... input_path="/home/rsp_test/sentinel_B1.tif", ... output_path="/home/rsp_test/sentinel_B1_clipped.tif", ... minimum=0, ... ) '/home/rsp_test/sentinel_B1_clipped.json'