Updated regrid to support masked arrays.