code: def parse_quadrant_measurement(quad_azimuth):
      
      def rotation_direction(first, second):
          return np.cross(_azimuth2vec(first), _azimuth2vec(second))
  
      # Parse measurement
      quad_azimuth = quad_azimuth.strip()
      try:
          first_dir = quadrantletter_to_azimuth(quad_azimuth[0].upper())
          sec_dir = quadrantletter_to_azimuth(quad_azimuth[-1].upper())
      except KeyError:
          raise ValueError('{} is not a valid azimuth'.format(quad_azimuth))
  
      angle = float(quad_azimuth[1:-1])
  
      # Convert quadrant measurement into an azimuth
      direc = rotation_direction(first_dir, sec_dir)
      azi = first_dir + direc * angle
  
      # Catch ambiguous measurements such as N10S and raise an error
      if abs(direc) < 0.9:
          raise ValueError('{} is not a valid azimuth'.format(quad_azimuth))
  
      # Ensure that 0 <= azi <= 360
      if azi < 0:
          azi += 360
      elif azi > 360:
          azi -= 360
  
      return azi
docs: Parses a quadrant measurement of the form "AxxB", where A and B are cardinal
      directions and xx is an angle measured relative to those directions.
  
      In other words, it converts a measurement such as E30N into an azimuth of
      60 degrees, or W10S into an azimuth of 260 degrees.
  
      For ambiguous quadrant measurements such as "N30S", a ValueError is raised.
  
      Parameters
      -----------
      quad_azimuth : string
          An azimuth measurement in quadrant form.
  
      Returns
      -------
      azi : float
          An azimuth in degrees clockwise from north.
  
      See Also
      --------
      parse_azimuth