code: def altitude2(SCALED_PRESSURE, ground_pressure=None, ground_temp=None):
      '''calculate barometric altitude'''
      from . import mavutil
      self = mavutil.mavfile_global
      if ground_pressure is None:
          if self.param('GND_ABS_PRESS', None) is None:
              return 0
          ground_pressure = self.param('GND_ABS_PRESS', 1)
      if ground_temp is None:
          ground_temp = self.param('GND_TEMP', 0)
      scaling = SCALED_PRESSURE.press_abs*100.0 / ground_pressure
      temp = ground_temp + 273.15
      return 153.8462 * temp * (1.0 - exp(0.190259 * log(scaling))f altitude2(SCALED_PRESSURE, ground_pressure=None, ground_temp=None):
      '''calculate barometric altitude'''
      from . import mavutil
      self = mavutil.mavfile_global
      if ground_pressure is None:
          if self.param('GND_ABS_PRESS', None) is None:
              return 0
          ground_pressure = self.param('GND_ABS_PRESS', 1)
      if ground_temp is None:
          ground_temp = self.param('GND_TEMP', 0)
      scaling = SCALED_PRESSURE.press_abs*100.0 / ground_pressure
      temp = ground_temp + 273.15
      return 153.8462 * temp * (1.0 - exp(0.190259 * log(scaling)))
docs: calculate barometric altitude