<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wd_grid_to_mesh_dict(the_grid, q, F, d):
 """ Transform a wd-style mesh to the format used by PHOEBE. Namely this handles translating vertices from Nx9 to Nx3x3 and creating the array of indices for each triangle. :parameter record-array the_grid: output from discretize_wd_style :parameter float q: mass-ratio (M_this/M_sibling) :parameter float F: syncpar :parameter float d: instantaneous unitless separation :return: the dictionary in PHOEBE's format to be passed to a Mesh class """


    # WD returns a list of triangles with 9 coordinates (v1x, v1y, v1z, v2x, ...)
    triangles_9N = the_grid[:,4:13]

    new_mesh = {}
    # force the mesh to be computed at centers rather than the PHOEBE default
    # of computing at vertices and averaging for the centers.  This will
    # propogate to all ComputedColumns, which means we'll fill those quanities
    # (ie normgrads, velocities) per-triangle.
    new_mesh['compute_at_vertices'] = False
    # PHOEBE's mesh structure stores vertices in an Nx3 array
    new_mesh['vertices'] = triangles_9N.reshape(-1,3)
    # and triangles as indices pointing to each of the 3 vertices (Nx3)
    new_mesh['triangles'] = np.arange(len(triangles_9N)*3).reshape(-1,3)
    new_mesh['centers'] = the_grid[:,0:3]

    new_mesh['tnormals'] = the_grid[:,13:16]
    norms = np.linalg.norm(new_mesh['tnormals'], axis=1)
    new_mesh['normgrads'] = norms
    # TODO: do this the right way by dividing along axis=1 (or using np.newaxis as done for multiplying in ComputedColumns)
    new_mesh['tnormals'] = np.array([tn/n for tn,n in zip(new_mesh['tnormals'], norms)])

    # NOTE: there are no vnormals in wd-style mesh

    new_mesh['areas'] = the_grid[:,3]
    new_mesh['tareas'] = the_grid[:,18]

    # TESTING ONLY - remove this eventually ??? (currently being used
    # to test WD-style eclipse detection by using theta and phi (lat and long)
    # to determine which triangles are in the same "strip")
    new_mesh['thetas'] = the_grid[:,16]
    new_mesh['phis'] = the_grid[:,17]

    # TODO: get rid of this list comprehension
    # grads = np.array([libphoebe.roche_gradOmega_only(q, F, d, c) for c in new_mesh['centers']])

    # new_mesh['normgrads'] = np.sqrt(grads[:,0]**2+grads[:,1]**2+grads[:,2]**2)
    # new_mesh['normgrads'] = norms #np.linalg.norm(grads, axis=1)

    # TODO: actually compute the numerical volume (find old code)
    new_mesh['volume'] = compute_volume(new_mesh['areas'], new_mesh['centers'], new_mesh['tnormals'])
    # new_mesh['area'] # TODO: compute surface area??? (not sure if needed)
    new_mesh['velocities'] = np.zeros(new_mesh['centers'].shape)

    return new_mesh