def numba_add(self, x, y, z, w, chnksize=100000):
    "\n        An attempt at running self.add with numba.  Key here is to chunk the points so that the numba compiled function\n        _numba_add runs multiple times, where the first run is slow as it compiles.  _numba_add is not within the class,\n        as classes aren't supported.  There is this new thing numba.jitclass, but it appears to still be experimental.\n\n        On my test dataset containing about 4.5 million soundings, I got the following results:\n        - existing add = 55.8 seconds\n        - numba_add (chunksize, time) = (100, 55.2), (1000, 21.2), (10000, 17.9), (100000, 16.6), (150000, 16.2),\n                                        (200000, 15.7), (1000000, 18.0)\n        "
    if (np.isscalar(x) or np.isscalar(y) or np.isscalar(z)):
        print('X, Y, or Z is scalar - must be numpy array.')
        sys.exit()
    self._x = x.ravel()
    self._y = y.ravel()
    self._z = z.ravel()
    if (not np.isscalar(w)):
        self._w = w.ravel()
    else:
        self._w = np.array(w)
    if (self._w.size != 1):
        if sum((self._w == 0)):
            print('Found zero weights. Weights cannot be zero.')
            print('Setting to 1e-20.')
            self._w[(self._w == 0)] = 1e-20
    if (self.zw is None):
        self.create_new_grid()
    else:
        self.expand_grid()
    ptlen = len(self._x)
    chnks = [[(i * chnksize), min(((i + 1) * chnksize), ptlen)] for i in range((int((ptlen / chnksize)) + 1))]
    for chnk in chnks:
        chnk_idx = slice(chnk[0], chnk[1])
        if (self._w.size != 1):
            chunk_w = self._w[chnk_idx]
        else:
            chunk_w = self._w
        (self.zw, self.ww, self.varw, self.nn) = _numba_add(self.xx, self.yy, self.nn, self.cinf, self._x[chnk_idx], self._y[chnk_idx], self._z[chnk_idx], chunk_w, self.type, self.zw, self.varw, self.ww)
An attempt at running self.add with numba.  Key here is to chunk the points so that the numba compiled function
_numba_add runs multiple times, where the first run is slow as it compiles.  _numba_add is not within the class,
as classes aren't supported.  There is this new thing numba.jitclass, but it appears to still be experimental.

On my test dataset containing about 4.5 million soundings, I got the following results:
- existing add = 55.8 seconds
- numba_add (chunksize, time) = (100, 55.2), (1000, 21.2), (10000, 17.9), (100000, 16.6), (150000, 16.2),
                                (200000, 15.7), (1000000, 18.0)
def numba_add(self, x, y, z, w, chnksize=100000):
    "\n        An attempt at running self.add with numba.  Key here is to chunk the points so that the numba compiled function\n        _numba_add runs multiple times, where the first run is slow as it compiles.  _numba_add is not within the class,\n        as classes aren't supported.  There is this new thing numba.jitclass, but it appears to still be experimental.\n\n        On my test dataset containing about 4.5 million soundings, I got the following results:\n        - existing add = 55.8 seconds\n        - numba_add (chunksize, time) = (100, 55.2), (1000, 21.2), (10000, 17.9), (100000, 16.6), (150000, 16.2),\n                                        (200000, 15.7), (1000000, 18.0)\n        "
    if (np.isscalar(x) or np.isscalar(y) or np.isscalar(z)):
        print('X, Y, or Z is scalar - must be numpy array.')
        sys.exit()
    self._x = x.ravel()
    self._y = y.ravel()
    self._z = z.ravel()
    if (not np.isscalar(w)):
        self._w = w.ravel()
    else:
        self._w = np.array(w)
    if (self._w.size != 1):
        if sum((self._w == 0)):
            print('Found zero weights. Weights cannot be zero.')
            print('Setting to 1e-20.')
            self._w[(self._w == 0)] = 1e-20
    if (self.zw is None):
        self.create_new_grid()
    else:
        self.expand_grid()
    ptlen = len(self._x)
    chnks = [[(i * chnksize), min(((i + 1) * chnksize), ptlen)] for i in range((int((ptlen / chnksize)) + 1))]
    for chnk in chnks:
        chnk_idx = slice(chnk[0], chnk[1])
        if (self._w.size != 1):
            chunk_w = self._w[chnk_idx]
        else:
            chunk_w = self._w
        (self.zw, self.ww, self.varw, self.nn) = _numba_add(self.xx, self.yy, self.nn, self.cinf, self._x[chnk_idx], self._y[chnk_idx], self._z[chnk_idx], chunk_w, self.type, self.zw, self.varw, self.ww)