Hello everyone,
I am trying to convert a set of data, which is expressed in polar coordinate, to Cartesian coordinate, so that it can be more easily used in both Paraview and VisIt. However, I notice there’s one step in my code, in which I use scipy.interpolate.griddata method, has been running for really long time. The for loop consumes super long time and overnight no variable has been converted. Here is that part of code.
–Yunlin
I am trying to convert a set of data, which is expressed in polar coordinate, to Cartesian coordinate, so that it can be more easily used in both Paraview and VisIt. However, I notice there’s one step in my code, in which I use scipy.interpolate.griddata method, has been running for really long time. The for loop consumes super long time and overnight no variable has been converted. Here is that part of code.
xcoord = radius*np.sin(theta)*np.cos(phi) ycoord = radius*np.sin(theta)*np.sin(phi) zcoord = radius*np.cos(theta) xmin = -1*max(x1f) xmax = max(x1f) ymin = -1*max(x1f) ymax = max(x1f) zmin = -1*max(x1f) zmax = max(x1f) nx = 200 ny = 200 nz = 200 xgrid = np.linspace(xmin, xmax, nx) ygrid = np.linspace(ymin, ymax, ny) zgrid = np.linspace(zmin, zmax, nz) xmesh, ymesh, zmesh = np.meshgrid(xgrid, ygrid, zgrid) print('start to convert to cartesian coordinate') for var_key in var_keys: vars()[var_key + '_cart'] = griddata(np.c_[xcoord, ycoord, zcoord], vars()[var_key + '_1D'], (xmesh, ymesh, zmesh), method='nearest')Does anyone have idea why? Thank you for reading my question.
–Yunlin