This paper is concerned with almost periodic linear systems of ODE’s and their block diagonalization. The aim is to describe a class of all "best possible" (partwise isometric) block diagonalizing transformations and to construct two closely connected functions, a projected trace and its real part, the Liouville function, playing the same role for a subspace or a subbundle as the usual trace and its real part play in Liouville’s formula. A theorem is proved which says that the projected trace of an almost periodic system is almost periodic. For the Liouville function of a one-dimensional spectral subbundle this result was obtained by Sacker and Sell. We extend it to the case of an invariant subbundle of higher dimension. If a system admits a Whitney sum invariant decomposition (e.g., a Sacker-Sell spectral decomposition) then partwise isometric block diagonalizing transformations are possible. This class includes the transformations of Bylov-Vinograd, Coppel, Palmer, and Ellis-Johnson. A theorem is proved which says that every partwise isometric transformation preserves Liouville functions of subbundles and turns them into real parts of usual block traces. In particular, for almost periodic systems, they remain almost periodic.