(contours)
return contours_nonans
Remove contours that contain NaNs, usually these are contours that are in contact 
    with clouds.
    
    KV WRL 2020
    
    Arguments:
    -----------
    contours: list of np.array
        image contours as detected by the function skimage.measure.find_contours    
    
    Returns:
    -----------
    contours: list of np.array
        processed image contours (only the ones that do not contains NaNs)
Remove contours that contain NaNs, usually these are contours that are in contact 
    with clouds.
    
    KV WRL 2020
    
    Arguments:
    -----------
    contours: list of np.array
        image contours as detected by the function skimage.measure.find_contours    
    
    Returns:
    -----------
    contours: list of np.array
        processed image contours (only the ones that do not contains NaNs)
Remove contours that contain NaNs usually these are contours that are in contact with clouds . KV WRL 2020 Arguments : ----------- contours : list of np . array image contours as detected by the function skimage . measure . find_contours Returns : ----------- contours : list of np . array processed image contours ( only the ones that do not contains NaNs )
def process_contours(contours):
    """
    Remove contours that contain NaNs, usually these are contours that are in contact 
    with clouds.
    
    KV WRL 2020
    
    Arguments:
    -----------
    contours: list of np.array
        image contours as detected by the function skimage.measure.find_contours    
    
    Returns:
    -----------
    contours: list of np.array
        processed image contours (only the ones that do not contains NaNs) 
        
    """
    
    # initialise variable
    contours_nonans = []
    # loop through contours and only keep the ones without NaNs
    for k in range(len(contours)):
        if np.any(np.isnan(contours[k])):
            index_nan = np.where(np.isnan(contours[k]))[0]
            contours_temp = np.delete(contours[k], index_nan, axis=0)
            if len(contours_temp) > 1:
                contours_nonans.append(contours_temp)
        else:
            contours_nonans.append(contours[k])
    
    return contours_nonans
def process_contours ( contours ) : # initialise variable contours_nonans = [ ] # loop through contours and only keep the ones without NaNs for k in range ( len ( contours ) ) : if np . any ( np . isnan ( contours [ k ] ) ) : index_nan = np . where ( np . isnan ( contours [ k ] ) ) [ 0 ] contours_temp = np . delete ( contours [ k ] , index_nan , axis = 0 ) if len ( contours_temp ) > 1 : contours_nonans . append ( contours_temp ) else : contours_nonans . append ( contours [ k ] ) return contours_nonans