E3SM-Project / e3sm_diags

E3SM Diagnostics package
https://e3sm-project.github.io/e3sm_diags
BSD 3-Clause "New" or "Revised" License
42 stars 32 forks source link

[Bug]: `UnboundLocalError: local variable 'cwv_max' referenced before assignment` for arm_diags plot with region `sgpc1` #858

Closed tomvothecoder closed 1 month ago

tomvothecoder commented 1 month ago

What happened?

There is a FIXME: comment to address this for awhile: https://github.com/E3SM-Project/e3sm_diags/blob/2b303dfdf1a83b115a8f372a81bf2f6b3bfbbc68/e3sm_diags/plot/cartopy/arm_diags_plot.py#L177-L178

What did you expect to happen? Are there are possible answers you came across?

This occurs when the region is sgpc1. The conditional that sets cwv_max and other plotting variables don't consider this region:

https://github.com/E3SM-Project/e3sm_diags/blob/2b303dfdf1a83b115a8f372a81bf2f6b3bfbbc68/e3sm_diags/plot/cartopy/arm_diags_plot.py#L136-L156

Minimal Complete Verifiable Example (MVCE)

No response

Relevant log output

No response

Anything else we need to know?

No response

Environment

Latest main and cdat-migration-fy24 branch

tomvothecoder commented 1 month ago

Hey @chengzhuzhang, this bug has been around for a long time. I can now fix it in #842.

Do you have an idea what the values should be for cwv_max, cwv_min, bin_width, and sitename?

chengzhuzhang commented 1 month ago

I think there is a typo: https://github.com/E3SM-Project/e3sm_diags/blob/2b303dfdf1a83b115a8f372a81bf2f6b3bfbbc68/e3sm_diags/plot/cartopy/arm_diags_plot.py#L152 It should be if region == "sgpc1":

tomvothecoder commented 1 month ago

Closed by #842