If the law authorizes review of a decision in a contested case under the substantial evidence rule or if the law does not define the scope of judicial review, a court may not substitute its judgment for the judgment of the state agency on the weight of the evidence on questions committed to agency discretion but:
Tex. Gov't. Code § 2001.174