code: def set_env_vars(init_run=None, n_runs=None, lab_path=None, dir_path=None,
                   reproduce=None):
      
      payu_env_vars = {}
  
      # Setup Python dynamic library link
      lib_paths = sysconfig.get_config_vars('LIBDIR')
      payu_env_vars['LD_LIBRARY_PATH'] = ':'.join(lib_paths)
      if 'PYTHONPATH' in os.environ:
          payu_env_vars['PYTHONPATH'] = os.environ['PYTHONPATH']
  
      # Set (or import) the path to the PAYU scripts (PAYU_PATH)
      # NOTE: We may be able to use sys.path[0] here.
      payu_binpath = os.environ.get('PAYU_PATH')
  
      if not payu_binpath or not os.path.isdir(payu_binpath):
          payu_binpath = os.path.dirname(sys.argv[0])
  
      payu_env_vars['PAYU_PATH'] = payu_binpath
  
      # Set the run counters
      if init_run:
          init_run = int(init_run)
          assert init_run >= 0
          payu_env_vars['PAYU_CURRENT_RUN'] = init_run
  
      if n_runs:
          n_runs = int(n_runs)
          assert n_runs > 0
          payu_env_vars['PAYU_N_RUNS'] = n_runs
  
      # Import explicit project paths
      if lab_path:
          payu_env_vars['PAYU_LAB_PATH'] = os.path.normpath(lab_path)
  
      if dir_path:
          payu_env_vars['PAYU_DIR_PATH'] = os.path.normpath(dir_path)
  
      if reproduce:
          payu_env_vars['PAYU_REPRODUCE'] = reproduce
  
      return payu_env_vars
docs: Construct the environment variables used by payu for resubmissions.