def calc_edge(index, shellindex, MC): # Find all the points just inside the clouds maskindex = expand_indexes(shellindex, MC) # From the expanded mask, select the points inside the cloud edgeindex = numpy.intersect1d(maskindex, index, assume_unique=True) return edgeindex
def calc_shell(index, MC): # Expand the cloud points outward maskindex = expand_indexes(index, MC) # From the expanded mask, select the points outside the cloud shellindex = numpy.setdiff1d(maskindex, index, assume_unique=True) return shellindex
def expand_cloudlet(cloudlet, indexes, MC): """Given an array of indexes composing a cloudlet and a boolean mask array indicating if each model index may be expanded into (True) or not (False), expand the cloudlet into the permissable indicies that are find all indicies adjacent to the cloudlet. Returns an array of the indicies composing the expanded cloudlet, and an array of the remaining indicies that may be expanded into. """ # Expand the cloudlet indexes into their nearest neighbours expanded_cloudlet = expand_indexes(cloudlet, MC) # Find the mask values of the expanded indexes mask = indexes[expanded_cloudlet] # Select the expanded cloudlet indexes that may be expanded into new_points = expanded_cloudlet[mask] # Remove the indicies that have been added to the cloudlet indexes[new_points] = False return new_points, indexes