docs: def get_z_variable(nc):
      '''
      Returns the name of the variable that defines the Z axis or height/depth
  
      :param netCDF4.Dataset nc: netCDF dataset
      '''
      z_variables = get_z_variables(nc)
      if not z_variables:
          return None
  
      # Priority is standard_name, units
      for var in z_variables:
          ncvar = nc.variables[var]
          if getattr(ncvar, 'standard_name', None) in ('depth', 'height', 'altitude'):
              return var
  
      for var in z_variables:
          ncvar = nc.variables[var]
          units = getattr(ncvar, 'units', None)
          if isinstance(units, basestring):
              if units_convertible(units, 'bar'):
                  return var
              if units_convertible(units, 'm'):
                  return var
  
      return z_variables[0]