'This transform takes an Nx1 ``numpy`` array and returns a
transformed copy.  Since the range of the Mercator scale
is limited by the user-specified threshold, the input
array must be masked to contain only valid values.
``matplotlib`` will handle masked arrays and remove the
out-of-range data from the plot.  Importantly, the
``transform`` method *must* return an array that is the
same shape as the input array, since these values need to
remain synchronized with values in the other dimension.'

def transform_non_affine(self, a):

    masked = ma.masked_where(((a < (- self.thresh)) | (a > self.thresh)), a)
    if masked.mask.any():
        return ma.log(np.abs((ma.tan(masked) + (1.0 / ma.cos(masked)))))
    else:
        return np.log(np.abs((np.tan(a) + (1.0 / np.cos(a)))))
