code: def adjust_weights_recfile(self, recfile=None,original_ceiling=True):
          
          if recfile is None:
              recfile = self.filename.replace(".pst", ".rec")
          assert os.path.exists(recfile), \
              "Pst.adjust_weights_recfile(): recfile not found: " +\
              str(recfile)
          iter_components = pst_utils.get_phi_comps_from_recfile(recfile)
          iters = iter_components.keys()
          iters.sort()
          obs = self.observation_data
          ogroups = obs.groupby("obgnme").groups
          last_complete_iter = None
          for ogroup, idxs in ogroups.iteritems():
              for iiter in iters[::-1]:
                  incomplete = False
                  if ogroup not in iter_components[iiter]:
                      incomplete = True
                      break
                  if not incomplete:
                      last_complete_iter = iiter
                      break
          if last_complete_iter is None:
              raise Exception("Pst.pwtadj2(): no complete phi component" +
                              " records found in recfile")
          self._adjust_weights_by_phi_components(
              iter_components[last_complete_iter],original_ceiling)
docs: adjusts the weights by group of the observations based on the phi components
          in a pest record file so that total phi is equal to the number of
          non-zero weighted observations
  
          Parameters
          ----------
          recfile : str
              record file name.  If None, try to use a record file
              with the Pst case name.  Default is None
          original_ceiling : bool
              flag to keep weights from increasing - this is generally a good idea.
              Default is True