code: def location(self, wave_field, depth=None, index=None):
          
          if not isinstance(wave_field, WaveField):
              wave_field = WaveField[wave_field]
  
          if index is None and depth is not None:
              for i, layer in enumerate(self[:-1]):
                  if layer.depth <= depth < layer.depth_base:
                      depth_within = depth - layer.depth
                      break
              else:
                  # Bedrock
                  i = len(self) - 1
                  layer = self[-1]
                  depth_within = 0
          elif index is not None and depth is None:
              layer = self[index]
              i = self.index(layer)
              depth_within = 0
          else:
              raise NotImplementedError
  
          return Location(i, layer, wave_field, depth_within)
docs: Create a Location for a specific depth.
  
          Parameters
          ----------
          wave_field: str
              Wave field. See :class:`Location` for possible values.
          depth: float, optional
              Depth corresponding to the :class`Location` of interest. If
              provided, then index is ignored.
          index: int, optional
              Index corresponding to layer of interest in :class:`Profile`. If
               provided, then depth is ignored and location is provided a top
               of layer.
  
          Returns
          -------
          Location
              Corresponding :class:`Location` object.