Is 'sometimes', 'obviously' too informal in scientific writing?
Neither “sometimes” nor “obviously” is in any way informal, as you will see by consulting an English dictionary.
The overriding principle in scientific writing is to express your ideas in a clear and unambiguous manner. If a word satisfies these criteria, use it.
The only possible problem I see with “obviously” is subjectivity and emotion, which are generally best avoided in scientific writing. But if something is really obvious, then the use of “obviously” avoids appearing to speak down to the reader.