Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix contour plot error highlighted by ORCA2 grid example #83

Open
sadielbartholomew opened this issue Jan 20, 2025 · 0 comments
Open

Fix contour plot error highlighted by ORCA2 grid example #83

sadielbartholomew opened this issue Jan 20, 2025 · 0 comments
Assignees
Labels

Comments

@sadielbartholomew
Copy link
Member

Investigate and fix test failure whereby an IndexError can appear to prevent a contour plot being made from code which should work, specifically as per the (just refreeshed) docs example:

======================================================================
ERROR: test_example_unstructured_orca_1 (__main__.UnnumberedExamplesTest.test_example_unstructured_orca_1)
Test example for unstructured grids: ORCA grid example 1.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/slb93/git-repos/cf-plot/cfplot/test/test_examples.py", line 1422, in test_example_unstructured_orca_1
    cfp.con(x=lons, y=lats, f=temp, ptype=1)
  File "/home/slb93/git-repos/cf-plot/cfplot/cfplot.py", line 3303, in con
    _cf_data_assign(f, colorbar_title, verbose=verbose)
  File "/home/slb93/git-repos/cf-plot/cfplot/cfplot.py", line 1379, in _cf_data_assign
    myz = find_z(f)
          ^^^^^^^^^
  File "/home/slb93/git-repos/cf-plot/cfplot/cfplot.py", line 10752, in find_z
    mycoords = find_dim_names(f)
               ^^^^^^^^^^^^^^^^^
  File "/home/slb93/git-repos/cf-plot/cfplot/cfplot.py", line 10724, in find_dim_names
    if field.coord(coords[i]).X:
                   ~~~~~~^^^
IndexError: list index out of range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant