def _derZ(self, x, y, z):
    '\n        Returns the derivative with respect to z of the interpolated function\n        at each value in x,y,z. Only called internally by HARKinterpolator3D.derivativeZ.\n        '
    if _isscalar(x):
        z_pos = max(min(np.searchsorted(self.z_list, z), (self.z_n - 1)), 1)
        dfdz = ((self.xyInterpolators[z_pos].derivativeX(x, y) - self.xyInterpolators[(z_pos - 1)].derivativeX(x, y)) / (self.z_list[z_pos] - self.z_list[(z_pos - 1)]))
    else:
        m = len(x)
        z_pos = np.searchsorted(self.z_list, z)
        z_pos[(z_pos > (self.z_n - 1))] = (self.z_n - 1)
        z_pos[(z_pos < 1)] = 1
        dfdz = (np.zeros(m) + np.nan)
        if (x.size > 0):
            for i in range(1, self.z_n):
                c = (z_pos == i)
                if np.any(c):
                    dfdz[c] = ((self.xyInterpolators[i](x[c], y[c]) - self.xyInterpolators[(i - 1)](x[c], y[c])) / (self.z_list[i] - self.z_list[(i - 1)]))
    return dfdz
Returns the derivative with respect to z of the interpolated function
at each value in x,y,z. Only called internally by HARKinterpolator3D.derivativeZ.
def _derZ(self, x, y, z):
    '\n        Returns the derivative with respect to z of the interpolated function\n        at each value in x,y,z. Only called internally by HARKinterpolator3D.derivativeZ.\n        '
    if _isscalar(x):
        z_pos = max(min(np.searchsorted(self.z_list, z), (self.z_n - 1)), 1)
        dfdz = ((self.xyInterpolators[z_pos].derivativeX(x, y) - self.xyInterpolators[(z_pos - 1)].derivativeX(x, y)) / (self.z_list[z_pos] - self.z_list[(z_pos - 1)]))
    else:
        m = len(x)
        z_pos = np.searchsorted(self.z_list, z)
        z_pos[(z_pos > (self.z_n - 1))] = (self.z_n - 1)
        z_pos[(z_pos < 1)] = 1
        dfdz = (np.zeros(m) + np.nan)
        if (x.size > 0):
            for i in range(1, self.z_n):
                c = (z_pos == i)
                if np.any(c):
                    dfdz[c] = ((self.xyInterpolators[i](x[c], y[c]) - self.xyInterpolators[(i - 1)](x[c], y[c])) / (self.z_list[i] - self.z_list[(i - 1)]))
    return dfdz