docs: def ecef2geodetic(x: float, y: float, z: float,
                    ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
      """
      convert ECEF (meters) to geodetic coordinates
  
      Parameters
      ----------
      x : float or numpy.ndarray of float
          target x ECEF coordinate (meters)
      y : float or numpy.ndarray of float
          target y ECEF coordinate (meters)
      z : float or numpy.ndarray of float
          target z ECEF coordinate (meters)
      ell : Ellipsoid, optional
            reference ellipsoid
      deg : bool, optional
            degrees input/output  (False: radians in/out)
  
      Returns
      -------
      lat : float or numpy.ndarray of float
             target geodetic latitude
      lon : float or numpy.ndarray of float
             target geodetic longitude
      h : float or numpy.ndarray of float
           target altitude above geodetic ellipsoid (meters)
  
      based on:
      You, Rey-Jer. (2000). Transformation of Cartesian to Geodetic Coordinates without Iterations.
      Journal of Surveying Engineering. doi: 10.1061/(ASCE)0733-9453
      """
      if ell is None:
          ell = Ellipsoid()
  
      x = np.asarray(x)
      y = np.asarray(y)
      z = np.asarray(z)
  
      r = sqrt(x**2 + y**2 + z**2)
  
      E = sqrt(ell.a**2 - ell.b**2)
  
      # eqn. 4a
      u = sqrt(0.5 * (r**2 - E**2) + 0.5 * sqrt((r**2 - E**2)**2 + 4 * E**2 * z**2))
  
      Q = hypot(x, y)
  
      huE = hypot(u, E)
  
      # eqn. 4b
      with np.errstate(divide='ignore'):
          Beta = arctan(huE / u * z / hypot(x, y))
  
      # eqn. 13
      eps = ((ell.b * u - ell.a * huE + E**2) * sin(Beta)) / (ell.a * huE * 1 / cos(Beta) - E**2 * cos(Beta))
  
      Beta += eps
  # %% final output
      lat = arctan(ell.a / ell.b * tan(Beta))
  
      lon = arctan2(y, x)
  
      # eqn. 7
      alt = hypot(z - ell.b * sin(Beta),
                  Q - ell.a * cos(Beta))
  
      # inside ellipsoid?
      with np.errstate(invalid='ignore'):
          inside = x**2 / ell.a**2 + y**2 / ell.a**2 + z**2 / ell.b**2 < 1
      if isinstance(inside, np.ndarray):
          alt[inside] = -alt[inside]
      elif inside:
          alt = -alt
  
      if deg:
          lat = degrees(lat)
          lon = degrees(lon)
  
      return lat, lon, alt