code: def prepare_gag_lsm(self, lsm_precip_data_var, lsm_precip_type, interpolation_type=None):
          
          if self.l2g is None:
              raise ValueError("LSM converter not loaded ...")
  
          # remove uniform precip cards
          for unif_precip_card in self.UNIFORM_PRECIP_CARDS:
              self.project_manager.deleteCard(unif_precip_card, self.db_session)
  
          with tmp_chdir(self.project_manager.project_directory):
              # PRECIPITATION CARD
              out_gage_file = '{0}.gag'.format(self.project_manager.name)
              self.l2g.lsm_precip_to_gssha_precip_gage(out_gage_file,
                                                       lsm_data_var=lsm_precip_data_var,
                                                       precip_type=lsm_precip_type)
  
              # SIMULATION TIME CARDS
              self._update_simulation_end_from_lsm()
  
              self.set_simulation_duration(self.simulation_end-self.simulation_start)
              # precip file read in
              self.add_precip_file(out_gage_file, interpolation_type)
  
              # make sure xarray dataset closed
              self.l2g.xd.close()
docs: Prepares Gage output for GSSHA simulation
  
          Parameters:
              lsm_precip_data_var(list or str): String of name for precipitation variable name or list of precip variable names.  See: :func:`~gsshapy.grid.GRIDtoGSSHA.lsm_precip_to_gssha_precip_gage`.
              lsm_precip_type(str): Type of precipitation. See: :func:`~gsshapy.grid.GRIDtoGSSHA.lsm_precip_to_gssha_precip_gage`.
              interpolation_type(str): Type of interpolation for LSM precipitation. Can be "INV_DISTANCE" or "THIESSEN". Default is "THIESSEN".