Skip to content

Undefined local variable with regrid2.crossSection.get_latitude_wts_bnds #153

Description

@zshaheen

@chengzhuzhang Uncovered this error.

A quick glance at the get_latitude_wts_bnds() function shows that wts is only declared in the if statements, thus an error on the line return (wts, bnds).
Maybe we need to initialize wts to None?

Your thoughts @dnadeau4

Traceback (most recent call last):
  File "acme_diags_driver.py", line 79, in <module>
    run_diag(parameter)
  File "/Users/zhang40/anaconda2/envs/acme_diags_env/lib/python2.7/site-packages/acme_diags-0.1-py2.7.egg/acme_diags/driver/zonal_mean_2d_driver.py", line 199, in run_diag
    mv1_reg = mv1_p.crossSectionRegrid(lev_out, lat_out)
  File "/Users/zhang40/anaconda2/envs/acme_diags_env/lib/python2.7/site-packages/cdms2/avariable.py", line 1217, in crossSectionRegrid
    fromlat, newLatitude, fromlevel, newLevel)
  File "/Users/zhang40/anaconda2/envs/acme_diags_env/lib/python2.7/site-packages/regrid2/crossSection.py", line 116, in __init__
    lat_wts_bndsIn = get_latitude_wts_bnds(latIn)
  File "/Users/zhang40/anaconda2/envs/acme_diags_env/lib/python2.7/site-packages/regrid2/crossSection.py", line 678, in get_latitude_wts_bnds
    return (wts, bnds)
UnboundLocalError: local variable 'wts' referenced before assignment

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions