Sentinel-2 preprocessing
- remote_sensing_processor.sentinel2(archives, sen2cor=True, upscale='superres', resample='bilinear', crs=None, cloud_mask=True, clip=None, normalize=False)[source]
Preprocess Sentinel-2 imagery.
- Parameters:
archives (string or list of strings) – Path to archive / directory or list of pathes to archives / directories.
sen2cor (bool (default = True)) – Is atmospheric correction using Sen2Cor needed. Set to False if you have troubles with Sen2Cor.
upscale (string or None (default = 'superres')) – Method for upscaling 20- and 60-m bands to 10 m resolution. Can be ‘superres’ - uses neural network for superresolution, ‘resample’ - uses resampling, or None - keeps original band resolution. Set it to ‘resample’ or None if you do not have GPU that supports CUDA.
resample (resampling method from rasterio as a string (default = 'bilinear')) – Resampling method that will be used to upscale 20 and 60 m bands if upscale == ‘resample’. You can read more about resampling methods here.
crs (string (optional)) – CRS in which output data should be or same to get CRS from the first archive.
cloud_mask (bool (default = True)) – Is cloud masking needed.
clip (string (optional)) – Path to vector file to be used to crop the image.
normalize (bool (default = False)) – Is min-max normalization to 0-1 range needed.
- Returns:
List of paths where preprocessed Sentinel-2 products are saved.
- Return type:
list of strings
Examples
>>> import remote_sensing_processor as rsp >>> from glob import glob >>> sentinel2_imgs = glob('/home/rsp_test/sentinels/*.zip') >>> print(sentinel2_imgs) ['/home/rsp_test/sentinels/L1C_T42VWR_A032192_20210821T064626.zip', '/home/rsp_test/sentinels/L1C_T42WXS_A032192_20210821T064626.zip', '/home/rsp_test/sentinels/L1C_T43VCL_A032192_20210821T064626.zip', '/home/rsp_test/sentinels/L1C_T43VDK_A031391_20210626T063027.zip', '/home/rsp_test/sentinels/L1C_T43VDL_A023312_20210823T063624.zip', '/home/rsp_test/sentinels/L1C_T43VDL_A031577_20210709T064041.zip'] >>> output_sentinels = rsp.sentinel2(sentinel2_imgs) Preprocessing of /home/rsp_test/sentinels/L1C_T42VWR_A032192_20210821T064626.zip completed Preprocessing of /home/rsp_test/sentinels/L1C_T42WXS_A032192_20210821T064626.zip completed Preprocessing of /home/rsp_test/sentinels/L1C_T43VCL_A032192_20210821T064626.zip completed Preprocessing of /home/rsp_test/sentinels/L1C_T43VDK_A031391_20210626T063027.zip completed Preprocessing of /home/rsp_test/sentinels/L1C_T43VDL_A023312_20210823T063624.zip completed Preprocessing of /home/rsp_test/sentinels/L1C_T43VDL_A031577_20210709T064041.zip completed >>> print(output_sentinels) ['/home/rsp_test/sentinels/L1C_T42VWR_A032192_20210821T064626/', '/home/rsp_test/sentinels/L1C_T42WXS_A032192_20210821T064626/', '/home/rsp_test/sentinels/L1C_T43VCL_A032192_20210821T064626/', '/home/rsp_test/sentinels/L1C_T43VDK_A031391_20210626T063027/', '/home/rsp_test/sentinels/L1C_T43VDL_A023312_20210823T063624/', '/home/rsp_test/sentinels/L1C_T43VDL_A031577_20210709T064041/']