docs: def get_site_collection(oqparam):
      """
      Returns a SiteCollection instance by looking at the points and the
      site model defined by the configuration parameters.
  
      :param oqparam:
          an :class:`openquake.commonlib.oqvalidation.OqParam` instance
      """
      mesh = get_mesh(oqparam)
      req_site_params = get_gsim_lt(oqparam).req_site_params
      if oqparam.inputs.get('site_model'):
          sm = get_site_model(oqparam)
          try:
              # in the future we could have elevation in the site model
              depth = sm['depth']
          except ValueError:
              # this is the normal case
              depth = None
          sitecol = site.SiteCollection.from_points(
              sm['lon'], sm['lat'], depth, sm, req_site_params)
          if oqparam.region_grid_spacing:
              logging.info('Reducing the grid sites to the site '
                           'parameters within the grid spacing')
              sitecol, params, _ = geo.utils.assoc(
                  sm, sitecol, oqparam.region_grid_spacing * 1.414, 'filter')
              sitecol.make_complete()
          else:
              params = sm
          for name in req_site_params:
              if name in ('vs30measured', 'backarc') \
                     and name not in params.dtype.names:
                  sitecol._set(name, 0)  # the default
              else:
                  sitecol._set(name, params[name])
      elif mesh is None and oqparam.ground_motion_fields:
          raise InvalidFile('You are missing sites.csv or site_model.csv in %s'
                            % oqparam.inputs['job_ini'])
      elif mesh is None:
          # a None sitecol is okay when computing the ruptures only
          return
      else:  # use the default site params
          sitecol = site.SiteCollection.from_points(
              mesh.lons, mesh.lats, mesh.depths, oqparam, req_site_params)
      ss = os.environ.get('OQ_SAMPLE_SITES')
      if ss:
          # debugging tip to reduce the size of a calculation
          # OQ_SAMPLE_SITES=.1 oq engine --run job.ini
          # will run a computation with 10 times less sites
          sitecol.array = numpy.array(random_filter(sitecol.array, float(ss)))
          sitecol.make_complete()
      return sitecol