def _on_land_pixel_array(self, coords): """ determines which LEs are on lond :param coords: Nx2 numpy int array of pixel coords matching the bitmap :type coords: Nx2 numpy int array of pixel coords matching the bitmap returns: a (N,) array of bools - true for particles that are on land """ mask = map(point_in_poly, [self.map_bounds] * len(coords), coords) racpy = np.copy(coords)[mask] mskgph = self.bitmap[racpy[:, 0], racpy[:, 1]] chrmgph = np.array([0] * len(coords)) chrmgph[np.array(mask)] = mskgph return chrmgph
def _attr_array_to_dict(self, np_array): '''convert np_array to list of tuples, used for map_bounds, spillable_area''' return map(tuple, np_array.tolist())