A method to determine the electric field of liquid argon time projection chambers using a UV laser system and its application in MicroBooNE