# Construct a compatible collection of meromorphic functions with prescribed orders

Let $(X,\mathcal O_X)$ be a compact Riemann surface and let $D=\sum a_x[x]$ be a divisor on $X$ (here $\mathcal O_X$ is the sheaf of holomorphic functions). Moreover fix a connected open covering $X=\bigcup U_\alpha$ (the $U_\alpha$ are generic open sets, they are not necessarily domains of charts).

Problem: Find a collection of meromorphic functions $f_\alpha:U_\alpha\to\bar{\mathbb C}$ such that:

1. $\operatorname{ord}_x(f_\alpha)=a_x$ for any $x\in U_\alpha$
2. $\frac{f_{\alpha}}{f_\beta}\in\mathcal O_X(U_\alpha\cap U_\beta)^\times$

Suppose that $x$ is a point such that $a_x\neq 0$ then consider a chart $(V,z)$ containing $x$, then one can define the map $(z-z(x))^{a_x}$ on $V$ which is meromorphic on $V$ and with order at $x$ equal to $a_x$. I'd like to use this local idea to solve the aforementioned problem, but I don't know "how to glue properly" these maps which are constructed by means of charts.

There should be some conditions (your cover should be a strict cover). For example, with the single cover $U = X = \mathbb CP^1$ and $D = [0]$, you don't have any such $\{f_{\alpha}\}$.
Now assuming none of your $U_{\alpha}$ are equal to $X$, they are all in particular non-compact. Thus it's enough to find functions $f_{\alpha}$ such that the divisor of $f_{\alpha}$ coincide exactly with $D$ on $U_{\alpha}$ (this is strongest to ask that simply the divisor of $f_{\alpha}$ coincide with $D$ on the support of $D$).
But on any non-compact Riemann surface, any divisor $D$ is the divisor of a function $f$ (cf the book of Forster, Lectures on Riemann Surfaces, page 203) and we are done.
In particular case like $P^1$ try to glue manually is a good idea but in general this is very difficult to see if some functions can be extended or not. A good solution is to use cohomology of sheaves ( there is a lot about sheaf cohomology, again in the book of Forster).