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

Issue with producing rotated projection with contour #66

Open
moonbooks73 opened this issue Aug 6, 2024 · 2 comments
Open

Issue with producing rotated projection with contour #66

moonbooks73 opened this issue Aug 6, 2024 · 2 comments

Comments

@moonbooks73
Copy link

moonbooks73 commented Aug 6, 2024

As we've observed I can do a default projection (cyl) with the following code, but when introducing mapset with proj as "rotated" an error occurs. I expected a rotated projection to appear with contour plots and a title. The same issue also occurs withe the "ortho" projection/

>>> f=cf.read('cfplot_data/ggap.nc')[0]
>>> cfp.gopen()
>>> cfp.con(f.subspace(pressure=850), lines=False, title = "rotated", colorbar_position=[0.1, 0.1, 0.8, 0.02], colorbar_orientation='horizontal')
>>> cfp.gclose()
>>> cfp.gopen()
>>> cfp.mapset(proj="rotated")
>>> cfp.con(f.subspace(pressure=850), lines=False, title = "rotated", colorbar_position=[0.1, 0.1, 0.8, 0.02], colorbar_orientation='horizontal')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/natalia/anaconda3/lib/python3.12/site-packages/cfplot/cfplot.py", line 1097, in con
    map_title(title)
  File "/home/natalia/anaconda3/lib/python3.12/site-packages/cfplot/cfplot.py", line 9014, in map_title
    plotvars.mymap.text(xpt, ypt, title, va='bottom',
                        ^^^
UnboundLocalError: cannot access local variable 'xpt' where it is not associated with a value

Environment

Using the main branch:

Platform: Linux-5.4.0-131-generic-x86_64-with-glibc2.31
HDF5 library: 1.12.1
netcdf library: 4.8.1
udunits2 library: /home/natalia/anaconda3/lib/libudunits2.so.0
esmpy/ESMF: not available
Python: 3.12.2
dask: 2024.5.0
netCDF4: 1.6.2
psutil: 5.9.0
packaging: 23.2
numpy: 1.26.4
scipy: 1.13.1
matplotlib: 3.8.4
cftime: 1.6.4
cfunits: 3.3.7
cfplot: 3.3.0
cfdm: 1.11.1.0
cf: 3.16.1
@moonbooks73
Copy link
Author

The same issue also occurs with the "ortho" projection.

@sadielbartholomew
Copy link
Member

Thanks Natalia for the report! I will look into it and for now we can find a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants