def polaranisotropy(data, pwdist, lags, tol, nsectors): angle = 360.0 / nsectors atol = angle / 2.0 sectors = [atol + i * angle for i in range(nsectors)] fig, ax = subplots() cnorm = colors.Normalize(vmin=0, vmax=1) scalarmap = cm.ScalarMappable(norm=cnorm, cmap=cm.jet) for sector in sectors: for lag in lags: anisodata = (data, pwdist, lag, tol, sector, atol) indices = variograms.anilagindices(*anisodata) sv = variograms.semivariance(data, indices) fc = scalarmap.to_rgba(sv) center, r, width = (0, 0), lag, lags[0] * 2 theta1 = utilities.degree_to_bearing(sector + atol) theta2 = utilities.degree_to_bearing(sector - atol) wedge = mpatches.Wedge(center, r, theta1, theta2, width, color=fc) ax.add_patch(wedge) ax.set_xlim(-lags[-1], lags[-1]) ax.set_ylim(-lags[-1], lags[-1]) ax.set_aspect('equal')
def anisotropiclags(data, pwdist, lag, tol, angle, atol): ''' SPatial ANIsotropy PLOT ''' index = variograms.lagindices(pwdist, lag, tol) anindex = variograms.anilagindices(data, pwdist, lag, tol, angle, atol) fig, ax = subplots() # plot the lagged distances for pair in index: head, tail = data[pair] hx, hy, hz = head tx, ty, tz = tail x = [hx, tx] y = [hy, ty] ax.plot(x, y, 'k-', lw=2, alpha=0.25) # plot the lagged distances within # the anisotropy angle and tolerance for pair in anindex: head, tail = data[pair] hx, hy, hz = head tx, ty, tz = tail x = [hx, tx] y = [hy, ty] ax.plot(x, y, 'r-', lw=1) ax.set_xlabel('X') ax.set_ylabel('Y')
def anisotropiclags(data, pwdist, lag, tol, angle, atol): ''' SPatial ANIsotropy PLOT ''' index = variograms.lagindices(pwdist, lag, tol) anindex = variograms.anilagindices(data, pwdist, lag, tol, angle, atol) fig, ax = subplots() # plot the lagged distances for pair in index: head, tail = data[pair] hx, hy, hz = head tx, ty, tz = tail x = [hx, tx] y = [hy, ty] ax.plot(x, y, 'k-', lw=2, alpha=0.25) # a sanity check # mx, my = np.mean( x ), np.mean( y ) # br = utilities.bearing( ( hx, hy ), ( tx, ty ) ) # ax.text( mx, my, '{0:3.2f}'.format( br ) ) # plot the lagged distances within # the anisotropy angle and tolerance for pair in anindex: head, tail = data[pair] hx, hy, hz = head tx, ty, tz = tail x = [hx, tx] y = [hy, ty] ax.plot(x, y, 'r-', lw=1) ax.set_xlabel('X') ax.set_ylabel('Y')