def clearcal(vis, weightonly=False):
    """Fill the imaging and calibration columns (``MODEL_DATA``,
    ``CORRECTED_DATA``, ``IMAGING_WEIGHT``) of each measurement set with
    default values, creating the columns if necessary.

    vis (string)
      Path to the input measurement set
    weightonly (boolean)
      If true, just create the ``IMAGING_WEIGHT`` column; do not fill
      in the visibility data columns.

    If you want to reset calibration models, these days you probably want
    :func:`delmod_cli`. If you want to quickly make the columns go away, you
    probably want :func:`delcal`.

    Example::

      from pwkit.environments.casa import tasks
      tasks.clearcal('myvis.ms')

    """
    tb = util.tools.table()
    cb = util.tools.calibrater()

    # cb.open() will create the tables if they're not present, so
    # if that's the case, we don't actually need to run initcalset()

    tb.open(b(vis), nomodify=False)
    colnames = tb.colnames()
    needinit = ('MODEL_DATA' in colnames) or('CORRECTED_DATA' in colnames)
    if 'IMAGING_WEIGHT' not in colnames:
        c = dict(clearcal_imaging_col_tmpl)
        c['shape'] = tb.getcell(b'DATA', 0).shape[-1:]
        tb.addcols({b'IMAGING_WEIGHT': c}, clearcal_imaging_dminfo_tmpl)
    tb.close()

    if not weightonly:
        import casadef

        if casadef.casa_version.startswith('5.'):
            cb.setvi(old=True, quiet=False)

        cb.open(b(vis))
        if needinit:
            cb.initcalset()
        cb.close()