Error:Dear yt:I am getting the following error for the script (see below). Could you let me know what is causing it? Thank you in advance
yt.utilities.exceptions.YTUnitOperationError: The addition operator for YTArrays with units (km) and (1) is not well defined. Script:
import yt
import numpy as np
import matplotlib.pylab as pl
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from matplotlib.colors import LogNorm
from yt.visualization.api import Streamlines
from yt.units import km
from mpl_toolkits.mplot3d import Axes3D
ms = 24000000
vector_max=ms-(ms/3)
ms1=ms-vector_max
dims = (200,200,200)
x = np.genfromtxt("/work/jbi157/MODEL7/UPDATE_B/yo_n_t0.mtx", skip_header=2,usecols=1, dtype="f8")
x = x.reshape((8000000, 3), order="F")
field1 = x[:,2].reshape(dims, order="F")
field2 = x[:,1].reshape(dims, order="F")
field3 = x[:,0].reshape(dims, order="F")
data = dict(cutting_plane_velocity_x = field1,
cutting_plane_velocity_y = field2,
cutting_plane_velocity_z = field3)
bbox = np.array([[-100, 99], [-100, 99], [-100, 99]])
pf = yt.load_uniform_grid(data, dims, km, bbox=bbox, nprocs=1)
L = [0,1,0] # vector normal to cutting plane
north_vector = [0,1,1]
slc = yt.OffAxisSlicePlot(pf, L, 'cutting_plane_velocity_x', center=[0,0,0], width=(180,'km'), north_vector=north_vector)
vel = slc._frb['cutting_plane_velocity_z']
U = slc._frb['cutting_plane_velocity_x']
V = slc._frb['cutting_plane_velocity_y']
extentx = [slc.xlim[i].in_units('km') for i in (0, 1)]
extenty = [slc.ylim[i].in_units('km') for i in (0, 1)]
extent = extentx + extenty
x = np.linspace(extentx[0], extentx[1], vel.shape[0])
y = np.linspace(extenty[1], extenty[0], vel.shape[1])
X, Y = np.meshgrid(x, y)
normalize = True
if normalize is True:
N = np.sqrt(U**2+V**2)
U /= N
V /= N
norm = colors.Normalize(vmin=vel.min(), vmax=vel.max())
factor = 1
#plt.quiver(X[::factor, ::factor], Y[::factor, ::factor], U[::factor, ::factor], V[::factor, ::factor])
plt.streamplot(X,Y,U,V,norm='True')
#plt.imshow(vel.d, extent=extent)
plt.colorbar()
plt.xlabel("x")
plt.axis([-100, 99, -100, 99])
plt.savefig('L(1,0,0) N(0,1,1)')
#slc.save()