Let $S$ be a (compact, connected) Riemann surface of genus $g$ and $f: S\to \mathbb CP^1$ be a degree $d$ meromorphic function. Then the Riemann-Hurwitz formula tells us that the number of ramifications of $f$ counted with multiplicity is $2(d-1)+2g-2$.
Suppose we consider instead a map $\varphi: S\to \mathbb CP^1$ of degree $d$ that is smooth, but not necessarily holomorphic. It will have singularities, like folds, etc.
Question. Can one express the number $2(d-1)+2g-2$ as a sum of contributions, involving various types of singularities of the map $\varphi$ (say, if $\varphi$ is analytic)?