original_docstring: 
          Define initial surface type according to median elevation such that the melt can be calculated over snow or ice.
  
          Convention: (0 = off-glacier, 1 = ice, 2 = snow, 3 = firn, 4 = debris).
          Function options: 1 =
  
          Function options specified in pygem_pygem_prms.py:
          - option_surfacetype_initial
              > 1 (default) - use median elevation to classify snow/firn above the median and ice below
              > 2 - use mean elevation instead
          - include_firn : Boolean
  
          To-do list
          ----------
          Add option_surfacetype_initial to specify an AAR ratio and apply this to estimate initial conditions
  
          Parameters
          ----------
          elev_bins : np.ndarray
              Elevation bins [masl]
          Returns
          -------
          surfacetype : np.ndarray
              Updated surface type for each elevation bin
          firnline_idx : int
              Firn line index
          
docstring: Define initial surface type according to median elevation such that the melt can be calculated over snow or ice.
  
  Function options specified in pygem_pygem_prms.py:
  option_surfacetype_initial
  > 1 (default) - use median elevation to classify snow/firn above the median and ice below
  > 2 - use mean elevation instead
  include_firn : Boolean
  
  
  
  Add option_surfacetype_initial to specify an AAR ratio and apply this to estimate initial conditions
  
  Parameters
  
  elev_bins : np.ndarray
  Elevation bins [masl]
  Returns
  
  surfacetype : np.ndarray
  Updated surface type for each elevation bin
  firnline_idx : int
  Firn line index
docstring_tokens: Define initial surface type according to median elevation such that the melt can be calculated over snow or ice . Function options specified in pygem_pygem_prms . py : option_surfacetype_initial > 1 ( default ) - use median elevation to classify snow / firn above the median and ice below > 2 - use mean elevation instead include_firn : Boolean Add option_surfacetype_initial to specify an AAR ratio and apply this to estimate initial conditions Parameters elev_bins : np . ndarray Elevation bins [ masl ] Returns surfacetype : np . ndarray Updated surface type for each elevation bin firnline_idx : int Firn line index
code: def _surfacetypebinsinitial(self, elev_bins):
          """
          Define initial surface type according to median elevation such that the melt can be calculated over snow or ice.
  
          Convention: (0 = off-glacier, 1 = ice, 2 = snow, 3 = firn, 4 = debris).
          Function options: 1 =
  
          Function options specified in pygem_pygem_prms.py:
          - option_surfacetype_initial
              > 1 (default) - use median elevation to classify snow/firn above the median and ice below
              > 2 - use mean elevation instead
          - include_firn : Boolean
  
          To-do list
          ----------
          Add option_surfacetype_initial to specify an AAR ratio and apply this to estimate initial conditions
  
          Parameters
          ----------
          elev_bins : np.ndarray
              Elevation bins [masl]
          Returns
          -------
          surfacetype : np.ndarray
              Updated surface type for each elevation bin
          firnline_idx : int
              Firn line index
          """
          surfacetype = np.zeros(self.glacier_area_initial.shape)
          # Option 1 - initial surface type based on the median elevation
          if pygem_prms.option_surfacetype_initial == 1:
              surfacetype[(elev_bins < self.glacier_rgi_table.loc['Zmed']) & (self.glacier_area_initial > 0)] = 1
              surfacetype[(elev_bins >= self.glacier_rgi_table.loc['Zmed']) & (self.glacier_area_initial > 0)] = 2
          # Option 2 - initial surface type based on the mean elevation
          elif pygem_prms.option_surfacetype_initial ==2:
              surfacetype[(elev_bins < self.glacier_rgi_table['Zmean']) & (self.glacier_area_initial > 0)] = 1
              surfacetype[(elev_bins >= self.glacier_rgi_table['Zmean']) & (self.glacier_area_initial > 0)] = 2
          else:
              print("This option for 'option_surfacetype' does not exist. Please choose an option that exists. "
                    + "Exiting model run.\n")
              exit()
          # Compute firnline index
          try:
              # firn in bins >= firnline_idx
              firnline_idx = np.where(surfacetype==2)[0][0]
          except:
              # avoid errors if there is no firn, i.e., the entire glacier is melting
              firnline_idx = np.where(surfacetype!=0)[0][-1]
          # If firn is included, then specify initial firn conditions
          if pygem_prms.include_firn == 1:
              surfacetype[surfacetype == 2] = 3
              #  everything initially considered snow is considered firn, i.e., the model initially assumes there is no
              #  snow on the surface anywhere.
          return surfacetype, firnline_idx
code_tokens: def _surfacetypebinsinitial ( self , elev_bins ) : surfacetype = np . zeros ( self . glacier_area_initial . shape ) if pygem_prms . option_surfacetype_initial == 1 : surfacetype [ ( elev_bins < self . glacier_rgi_table . loc [ 'Zmed' ] ) & ( self . glacier_area_initial > 0 ) ] = 1 surfacetype [ ( elev_bins >= self . glacier_rgi_table . loc [ 'Zmed' ] ) & ( self . glacier_area_initial > 0 ) ] = 2 elif pygem_prms . option_surfacetype_initial == 2 : surfacetype [ ( elev_bins < self . glacier_rgi_table [ 'Zmean' ] ) & ( self . glacier_area_initial > 0 ) ] = 1 surfacetype [ ( elev_bins >= self . glacier_rgi_table [ 'Zmean' ] ) & ( self . glacier_area_initial > 0 ) ] = 2 else : print ( "This option for 'option_surfacetype' does not exist. Please choose an option that exists. " + "Exiting model run.\n" ) exit ( ) try : firnline_idx = np . where ( surfacetype == 2 ) [ 0 ] [ 0 ] except : firnline_idx = np . where ( surfacetype != 0 ) [ 0 ] [ - 1 ] if pygem_prms . include_firn == 1 : surfacetype [ surfacetype == 2 ] = 3 return surfacetype , firnline_idx
short_docstring: Define initial surface type according to median elevation such that the melt can be calculated over snow or ice.
short_docstring_tokens: Define initial surface type according to median elevation such that the melt can be calculated over snow or ice .
comment: """
          Define initial surface type according to median elevation such that the melt can be calculated over snow or ice.
  
          Convention: (0 = off-glacier, 1 = ice, 2 = snow, 3 = firn, 4 = debris).
          Function options: 1 =
  
          Function options specified in pygem_pygem_prms.py:
          - option_surfacetype_initial
              > 1 (default) - use median elevation to classify snow/firn above the median and ice below
              > 2 - use mean elevation instead
          - include_firn : Boolean
  
          To-do list
          ----------
          Add option_surfacetype_initial to specify an AAR ratio and apply this to estimate initial conditions
  
          Parameters
          ----------
          elev_bins : np.ndarray
              Elevation bins [masl]
          Returns
          -------
          surfacetype : np.ndarray
              Updated surface type for each elevation bin
          firnline_idx : int
              Firn line index
          """$SEP$# Option 1 - initial surface type based on the median elevation$SEP$# Option 2 - initial surface type based on the mean elevation$SEP$# Compute firnline index$SEP$# firn in bins >= firnline_idx$SEP$# avoid errors if there is no firn, i.e., the entire glacier is melting$SEP$# If firn is included, then specify initial firn conditions$SEP$#  everything initially considered snow is considered firn, i.e., the model initially assumes there is no$SEP$#  snow on the surface anywhere.