def _fill_pixels(one, other):
    # type: (_Raster, _Raster) -> _Raster
    """Merges two single band rasters with the same band by filling the pixels according to depth.

    """
    assert len(one.band_names) == len(other.band_names) == 1, "Rasters are not single band"

    # We raise an error in the intersection is empty.
    # Other options include returning an "empty" raster or just None.
    # The problem with the former is that GeoRaster2 expects a 2D or 3D
    # numpy array, so there is no obvious way to signal that this raster
    # has no bands. Also, returning a (1, 1, 0) numpy array is useless
    # for future concatenation, so the expected shape should be used
    # instead. The problem with the latter is that it breaks concatenation
    # anyway and requires special attention. Suggestions welcome.
    if one.band_names != other.band_names:
        raise ValueError("rasters have no bands in common, use another merge strategy")

    new_image = one.image.copy()
    other_image = other.image

    # The values that I want to mask are the ones that:
    # * Were already masked in the other array, _or_
    # * Were already unmasked in the one array, so I don't overwrite them
    other_values_mask = (np.ma.getmaskarray(other_image)[0] | (~np.ma.getmaskarray(one.image)[0]))

    # Reshape the mask to fit the future array
    other_values_mask = other_values_mask[None, ...]

    # Overwrite the values that I don't want to mask
    new_image[~other_values_mask] = other_image[~other_values_mask]

    # In other words, the values that I wanted to write are the ones that:
    # * Were already masked in the one array, _and_
    # * Were not masked in the other array
    # The reason for using the inverted form is to retain the semantics
    # of "masked=True" that apply for masked arrays. The same logic
    # could be written, using the De Morgan's laws, as
    # other_values_mask = (one.image.mask[0] & (~other_image.mask[0])
    # other_values_mask = other_values_mask[None, ...]
    # new_image[other_values_mask] = other_image[other_values_mask]
    # but here the word "mask" does not mean the same as in masked arrays.

    return _Raster(image=new_image, band_names=one.band_names)
Merges two single band rasters with the same band by filling the pixels according to depth.