Let $C$ be a compact Riemann surface, and let $U$ be a Zariski open subset in $C.$ Let $L$ be a local system (with coefficients $\mathbb C$ or $\mathbb Q_{\ell}$) on $U.$ For each point $z_i\in C-U,$ let $M_i$ be the monodromy matrix of $L$ around $z_i.$ If we identify $L$ as a representation of $\pi_1(U),$ and let $\gamma_i$ be a small loop in $U$ around $z_i,$ then $M_i$ is the image of $\gamma_i$ under the representation $\rho_L:\pi_1(U,a)\to GL(L_a)$ (where $a$ is a base point and $L_a$ is the fiber of $L$ at $a$).
Here's my question. It seems to me that there should be some relation between (the traces of) these monodromies (as well as the monodromies around loops in $\pi_1(C)$) and (Betti numbers of) the cohomology groups $H^i_c(U,L)$ of $L$ with compact support, but I don't know the precise formulation or reference.
As an example, if $C$ has genus $g$ and $L=\mathbb C$ is constant of rank 1, then $H^1_c(U,\mathbb C)$ has dimension $2g+n-1,$ where $n$ is the number of points at infinity. This number is the rank of $\pi_1(U),$ and each ``canonical generator" of $\pi_1(U)$ has trace 1.