code: def temp(h):
      
  
      # Base values and gradient in table from hand-out
      # (but corrected to avoid small discontinuities at borders of layers)
      h0 = [0.0, 11000., 20000., 32000., 47000., 51000., 71000., 86852.]
  
      T0 = [288.15,  # Sea level
            216.65,  # 11 km
            216.65,  # 20 km
            228.65,  # 32 km
            270.65,  # 47 km
            270.65,  # 51 km
            214.65]  # 71 km
  
      # a = lapse rate (temp gradient)
      # integer 0 indicates isothermic layer!
      a  = [-0.0065, # 0-11 km
              0 ,    # 11-20 km
            0.001,   # 20-32 km
            0.0028,  # 32-47 km
              0 ,    # 47-51 km
            -0.0028, # 51-71 km
            -0.002]  # 71-   km
  
      # Clip altitude to maximum!
      h = max(0.0,min(float(h),h0[-1]))
  
  
      # Find correct layer
      i = 0
      while h>h0[i+1] and i<len(h0)-2:
          i = i+1
  
      # Calculate if sothermic layer
      if a[i]==0:
          T   = T0[i]
  
      # Calculate for temperature gradient
      else:
          T   = T0[i] + a[i]*(h-h0[i])
  
      return T
docs: temp (altitude): Temperature only version of ISA atmos
  
          Input:
                h =  altitude in meters 0.0 < h < 84852.
          (will be clipped when outside range, integer input allowed)
          Output:
                T    (in SI-unit: K