code: def _calc_extents(self, proj_dict):
          
          h = float(proj_dict.get('h', 1.))  # force to 64-bit float
          x = self['x']
          y = self['y']
          x_units = x.attrs.get('units', 'rad')
          if x_units == 'meters':
              h_factor = 1.
              factor = 1.
          elif x_units == 'microradian':
              h_factor = h
              factor = 1e6
          else:  # radians
              h_factor = h
              factor = 1.
          x_l = h_factor * x[0] / factor
          x_r = h_factor * x[-1] / factor
          y_l = h_factor * y[-1] / factor
          y_u = h_factor * y[0] / factor
          x_half = (x_r - x_l) / (self.ncols - 1) / 2.
          y_half = (y_u - y_l) / (self.nlines - 1) / 2.
          return x_l - x_half, y_l - y_half, x_r + x_half, y_u + y_half
docs: Calculate area extents from x/y variables.