code: def altitude(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 = ground_pressure / (SCALED_PRESSURE.press_abs*100.0)
      temp = ground_temp + 273.15
      return log(scaling) * temp * 29271.267 * 0.00f altitude(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 = ground_pressure / (SCALED_PRESSURE.press_abs*100.0)
      temp = ground_temp + 273.15
      return log(scaling) * temp * 29271.267 * 0.001
docs: calculate barometric altitude