t0 = datetime.datetime.now() pool = mp.Pool() paths = pool.map(spread_paths, coord_set) pool.close() pool.join() t1 = datetime.datetime.now() print "time to generate new paths", t1 - t0 # Append new set of paths now that old set has been deleted. #create a flattened numpy array of size 2xN from the paths created! paths1 = GEODESIC.combine_paths(paths) paths = list(paths) paths1 = GEODESIC.remove_zeros(paths1) DENSITY = Density(paths=paths1) H, xedges, yedges = DENSITY.hist2d(paths=paths1) grad = DENSITY.hgrad(H=H) H_avg1 = np.average(H) grad_check1 = np.std(grad) H_masked = DENSITY.transform_h(H=H) grad = DENSITY.transform_grad(grad=grad) search = np.where(H < 0.1 * np.average(H)) Hmaxx, Hmaxy = search[1], search[0] Hmaxx = (lonmax - lonmin) / (nbins) * Hmaxx + lonmin
t0 = datetime.datetime.now() pool = mp.Pool() paths = pool.map(spread_paths, coord_set) pool.close() pool.join() t1 = datetime.datetime.now() print "time to generate new paths", t1-t0 # Append new set of paths now that old set has been deleted. #create a flattened numpy array of size 2xN from the paths created! paths1 = GEODESIC.combine_paths(paths) paths = list(paths) paths1 = GEODESIC.remove_zeros(paths1) DENSITY = Density(paths=paths1) H, xedges, yedges = DENSITY.hist2d(paths=paths1) grad = DENSITY.hgrad(H=H) H_avg1 = np.average(H) grad_check1 = np.std(grad) H_masked = DENSITY.transform_h(H=H) grad = DENSITY.transform_grad(grad=grad) #search = np.where(H<0.1*np.average(H)) #Hmaxx, Hmaxy = search[1], search[0]
def spread_paths(coord_list): return GEODESIC.fast_paths(coord_list) t0 = datetime.datetime.now() pool = mp.Pool() paths = pool.map(spread_paths, kappa) pool.close() pool.join() t1 = datetime.datetime.now() print t1 - t0 paths = GEODESIC.combine_paths(paths) paths = GEODESIC.remove_zeros(paths) lons, lats = paths[:, 0], paths[:, 1] if show: plt.figure() plt.scatter(lons, lats) plt.show() DENSITY = Density(paths=paths) H, xedges, yedges = DENSITY.hist2d(paths=paths) H = np.rot90(H) H = np.flipud(H) H = np.ma.masked_where(H == 0, H)
GEODESIC = Geodesic(km_point=km_points) def spread_paths(coord_list): return GEODESIC.fast_paths(coord_list) t0 = datetime.datetime.now() pool = mp.Pool() paths = pool.map(spread_paths, kappa) pool.close() pool.join() t1 = datetime.datetime.now() print t1-t0 paths = GEODESIC.combine_paths(paths) paths = GEODESIC.remove_zeros(paths) lons, lats = paths[:,0], paths[:,1] if show: plt.figure() plt.scatter(lons, lats) plt.show() DENSITY = Density(paths=paths) H, xedges, yedges = DENSITY.hist2d(paths=paths) H = np.rot90(H) H = np.flipud(H) H = np.ma.masked_where(H==0,H)