Fix contour plot error highlighted by ORCA2 grid example
Open
@sadielbartholomew is already working on this.
Since Jan 20, 2025.
bug
- Dominant language
- Python
- Stars
- 21
- Forks
- 11
- Avg merge
- 7h 11m
- Merged PRs (30d)
- 1
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.