<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fromcube(cube, template):
 """Covert a decode cube to a decode array. Args: cube (decode.cube):
 Decode cube to be cast. template (decode.array):
 Decode array whose shape the cube is cast on. Returns: decode array (decode.array):
 Decode array. Notes: This functions is under development. """

    array = dc.zeros_like(template)

    y, x = array.y.values, array.x.values
    gy, gx = cube.y.values, cube.x.values
    iy = interp1d(gy, np.arange(len(gy)))(y)
    ix = interp1d(gx, np.arange(len(gx)))(x)

    for ch in range(len(cube.ch)):
        array[:,ch] = map_coordinates(cube.values[:,:,ch], (ix, iy))

    return array