Let $(E,\mathcal E,\mu)$ be a probability space, $$L^2_0(\mu):=\left\{f\in L^2(\mu):\int f\:{\rm d}\mu=0\right\}$$ and $$U:L^2(\mu)\to L^2(\mu)\;,\;\;\;f\mapsto\int f\:{\rm d}\mu=\langle 1,f\rangle_{L^2(\mu)}1.$$ Note that $U$ is a nonnegative self-adjoint linear operator on $L^2(\mu)$ with $\mathcal N(U)=L^2_0(\mu)$. Moreover, if $(f_i)_{i\in I}$ is an orthonormal basis of $L^2(\mu)$, then $$\sum_{i\in I}\langle Uf_i,f_i\rangle_{L^2(\mu)}=\sum_{i\in I}\left|\langle1,f_i\rangle_{L^2(\mu)}\right|^2=\left\|1\right\|_{L^2(\mu)}^2=1\tag1$$ by Parseval's identity. So, if $|I|\le|\mathbb N|$, then $U$ is trace-class (cf. When is $L^2(\mu)$ separable?)
If $L^2(\mu)$ is separable, we know that there is an orthonormal basis of $L^2(\mu)$ consisting of eigenvectors of $U$ (the only eigenvalues are $0$ and $1$). The reason is that in that case $U$ is compact by $(1)$. In the non-separable case, the general spectral theorem applies and yields a resolution of the identity. Actually, since our operator is bounded, there is a continuous linear, multiplicative and involutive $\Phi:C(\sigma(U))\to\mathfrak L(L^2(\mu))$ with $\Phi(\operatorname{id})=U$, $\Phi(1)=\operatorname{id}_{L^2(\mu)}$. How does $\Phi$ look like in our concrete situation? And how is it related to the resolution of the identity from the spectral theorem?