  The detection of B-mode polarization in the CMB is one of the most important
outstanding tests of inflationary cosmology. One of the necessary steps for
extracting polarization information in the CMB is reducing contamination from
so-called "ambiguous modes" on a masked sky, which contain leakage from the
larger E-mode signal. This can be achieved by utilising derivative operators on
the real-space Stokes Q and U parameters. This paper presents an algorithm and
a software package to perform this procedure on the nearly full sky, i.e., with
projects such as the Planck Surveyor and future satellites in mind; in
particular, the package can perform finite differences on masked, irregular
grids and is applied to a semi-regular spherical pixellization, the HEALPix
grid. The formalism reduces to the known finite-difference solutions in the
case of a regular grid. We quantify full-sky improvements on the possible
bounds on the CMB B-mode signal. We find that in the specific case of E and
B-mode separation, there exists a "pole problem" in our formalism which
produces signal contamination at very low multipoles l. Several solutions to
the "pole problem" are presented; one proposed solution facilitates a
calculation of a general Gaussian quadrature scheme, which finds application in
calculating accurate harmonic coefficients on the HEALPix sphere. Nevertheless,
on a masked sphere the software represents a considerable reduction in B-mode
noise from limited sky coverage.
