code: def get_rotation_and_scale(header, skew_threshold=0.001):
      
      ((xrot, yrot),
       (cdelt1, cdelt2)) = get_xy_rotation_and_scale(header)
  
      if math.fabs(xrot) - math.fabs(yrot) > skew_threshold:
          raise ValueError("Skew detected: xrot=%.4f yrot=%.4f" % (
              xrot, yrot))
      rot = yrot
  
      lonpole = float(header.get('LONPOLE', 180.0))
      if lonpole != 180.0:
          rot += 180.0 - lonpole
  
      return (rot, cdelt1, cdelt2)
docs: Calculate rotation and CDELT.