docs: def reduce_sm(calc_id):
      """
      Reduce the source model of the given (pre)calculation by discarding all
      sources that do not contribute to the hazard.
      """
      with datastore.read(calc_id) as dstore:
          oqparam = dstore['oqparam']
          info = dstore['source_info'].value
          ok = info['weight'] > 0
          source_ids = set(info[ok]['source_id'])
      with performance.Monitor() as mon:
          readinput.reduce_source_model(
              oqparam.inputs['source_model_logic_tree'], source_ids)
      print(mon)