Skip to content
Extraits de code Groupes Projets
Valider 1c5f7211 rédigé par Boris Nörgaard's avatar Boris Nörgaard
Parcourir les fichiers

notebook S2 preprocessing

parent a1e6579e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -140,7 +140,7 @@ def clip_imgs(list_im_to_clip, clipped_path, roi_gdf):
def apply_SCL(list_im_ROI, clipped_path, masked_path, nodata_val):
def apply_SCL(list_im_ROI, clipped_path, masked_path, nodata_val,values_to_mask = [0,1,2,3,8,9,10,11]):
for im_file in list_im_ROI:
# Get date of image
......@@ -168,20 +168,12 @@ def apply_SCL(list_im_ROI, clipped_path, masked_path, nodata_val):
#show(SCL, cmap='Set3')
SCL = SCL.astype(float)
SCL[SCL == 0] = np.nan # No data
SCL[SCL == 1] = np.nan # Saturated or defective
SCL[SCL == 2] = np.nan # Dark area pixels
SCL[SCL == 3] = np.nan # Cloud shadows
SCL[SCL == 4] = 1 # Vegetation
SCL[SCL == 5] = 1 # Not vegetated
SCL[SCL == 6] = 1 # Water
SCL[SCL == 7] = 1 # Unclassified
SCL[SCL == 8] = np.nan # Cloud medium probability
SCL[SCL == 9] = np.nan # Cloud high probability
SCL[SCL == 10] = np.nan # Thin cirrus
SCL[SCL == 11] = np.nan # Snow
for i in values_to_mask:
SCL[SCL == i] = np.nan
SCL[~np.isnan(SCL)] = 1
# Open file
src = rasterio.open(im_file, "r")
......
Ce diff est replié.
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter