Calculate the solar position using the numba compiled functions
    and multiple threads. Very slow if functions are not numba compiled.

def solar_position_numba(unixtime, lat, lon, elev, pressure, temp, delta_t,
                         atmos_refract, numthreads, sst=False, esd=False):
    """Calculate the solar position using the numba compiled functions
    and multiple threads. Very slow if functions are not numba compiled.
    """
    # these args are the same for each thread
    loc_args = np.array([lat, lon, elev, pressure, temp, delta_t,
                         atmos_refract, sst, esd])

    # construct dims x ulength array to put the results in
    ulength = unixtime.shape[0]
    if sst:
        dims = 3
    elif esd:
        dims = 1
    else:
        dims = 6
    result = np.empty((dims, ulength), dtype=np.float64)

    if unixtime.dtype != np.float64:
        unixtime = unixtime.astype(np.float64)

    if ulength < numthreads:
        warnings.warn('The number of threads is more than the length of '
                      'the time array. Only using %s threads.'.format(ulength))
        numthreads = ulength

    if numthreads <= 1:
        solar_position_loop(unixtime, loc_args, result)
        return result

    # split the input and output arrays into numthreads chunks
    split0 = np.array_split(unixtime, numthreads)
    split2 = np.array_split(result, numthreads, axis=1)
    chunks = [[a0, loc_args, split2[i]] for i, a0 in enumerate(split0)]
    # Spawn one thread per chunk
    threads = [threading.Thread(target=solar_position_loop, args=chunk)
               for chunk in chunks]
    for thread in threads:
        thread.start()
    for thread in threads:
        thread.join()
    return result