code: def adjust_weights_discrepancy(self, resfile=None,original_ceiling=True):
          
          if resfile is not None:
              self.resfile = resfile
              self.__res = None
          obs = self.observation_data.loc[self.nnz_obs_names,:]
          swr = (self.res.loc[self.nnz_obs_names,:].residual * obs.weight)**2
          factors =  (1.0/swr).apply(np.sqrt)
          if original_ceiling:
              factors = factors.apply(lambda x: 1.0 if x > 1.0 else x)
          self.observation_data.loc[self.nnz_obs_names,"weight"] *= factors
docs: adjusts the weights of each non-zero weight observation based
          on the residual in the pest residual file so each observations contribution
          to phi is 1.0
  
          Parameters
          ----------
          resfile : str
              residual file name.  If None, try to use a residual 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