Python Forum
interpolation takes very long time
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
interpolation takes very long time
#1
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.

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
Reply


Messages In This Thread
interpolation takes very long time - by zengwl17206 - Aug-18-2018, 12:52 AM
RE: interpolation takes very long time - by scidam - Aug-18-2018, 05:37 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020