Polar stereo stipple() fails for data on curvilinear/2d grid
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 42/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- matplotlib, python
- Área
- data-visualization
Línea de trabajo
Reproduce el fallo con polar_test_2d_coord_data.py del archivo adjunto y compáralo después con el caso funcional polar_test_1d_coord_data.py. Lee las propuestas de stipple_fix.py y regrid_fix.py junto con las rutas stipple() y regrid() de cfplot.py; se considera terminado cuando el stippling en una cuadrícula curvilínea produce un gráfico sin romper el caso de coordenadas 1D.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hi Sadie!
Subject of the issue
Attempting to stipple() over a polar stereo contour plot from data that had 2d lon and lat grid (e.g lon(i,j)) fails.
Steps to reproduce
See attached code
Your environment
The version of cf-plot and its dependencies in which you are encountering an issue.
cf.environment(paths=False) Platform: Linux-5.14.0-503.38.1.el9_5.x86_64-x86_64-with-glibc2.34 HDF5 library: 1.14.2 netcdf library: 4.9.4-development udunits2 library: libudunits2.so.0 esmpy/ESMF: not available Python: 3.10.16 dask: 2025.3.0 netCDF4: 1.7.2 h5netcdf: 1.6.3 h5py: 3.14.0 s3fs: 2025.5.1 psutil: 7.0.0 packaging: 24.2 numpy: 2.2.4 scipy: 1.15.3 matplotlib: 3.10.3 cftime: 1.6.4.post1 cfunits: 3.3.7 cfplot: 3.4.0 cfdm: 1.12.1.0 cf: 3.17.0
Expected behaviour
A stippled plot should be produced
Actual behaviour
Tell us what happens instead. If you see an error please provide the traceback, ideally in full.
`Traceback (most recent call last):
File "/apps/jasmin/jaspy/miniforge_envs/jaspy3.11/mf3-23.11.0-0/envs/jaspy3.11-mf3-23.11.0-0-v20240815/lib/python3.11/site-packages/cfplot/cfplot.py", line 9579, in add_cyclic
field, lons = cartopy_util.add_cyclic_point(field, lons)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/apps/jasmin/jaspy/miniforge_envs/jaspy3.11/mf3-23.11.0-0/envs/jaspy3.11-mf3-23.11.0-0-v20240815/lib/python3.11/site-packages/cartopy/util.py", line 69, in add_cyclic_point
raise ValueError('The coordinate must be 1-dimensional.')
ValueError: The coordinate must be 1-dimensional.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gws/nopw/j04/canari/users/dlrhodso/spring2025/analysis/FWC/polar_plot_example/./polar_test_2d_coord_data.py", line 10, in
cfp.stipple(f=data,min=28.0,max=40.0)
File "/apps/jasmin/jaspy/miniforge_envs/jaspy3.11/mf3-23.11.0-0/envs/jaspy3.11-mf3-23.11.0-0-v20240815/lib/python3.11/site-packages/cfplot/cfplot.py", line 5073, in stipple
field, xpts = add_cyclic(field, xpts)
^^^^^^^^^^^^^^^^^^^^^^^
File "/apps/jasmin/jaspy/miniforge_envs/jaspy3.11/mf3-23.11.0-0/envs/jaspy3.11-mf3-23.11.0-0-v20240815/lib/python3.11/site-packages/cfplot/cfplot.py", line 9583, in add_cyclic
field, lons = cartopy_util.add_cyclic_point(field, lons)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/apps/jasmin/jaspy/miniforge_envs/jaspy3.11/mf3-23.11.0-0/envs/jaspy3.11-mf3-23.11.0-0-v20240815/lib/python3.11/site-packages/cartopy/util.py", line 69, in add_cyclic_point
raise ValueError('The coordinate must be 1-dimensional.')
ValueError: The coordinate must be 1-dimensional.
`
Relevant data
The attached tar file contains polar_test_2d_coord_data.py which attempts to plot a stipple over data on a curvilinear grid (and fails). polar_test_1d_coord_data.py attempts to do the same, but after regridding the data to a standard lon-lat grid (ie 1d coordinate arrays). This works.
The proposed fix is stipple_fix.py adn regrid_fix.py which only makes minor changes to stipple() - to avoid applying cyclic corrections to the longitude coordinates for a 2d longitude array, but also re-writes regrid() to allow the regridding of data on a curvilinear grid (disclosure: I asked co-pilot to write this for me!) - this seems to work!
- Lenguaje dominante
- Python
- Estrellas
- 21
- Forks
- 11
- Merge medio
- 2 h 59 min
- PR fusionados (30 d)
- 11
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NCAS-CMS/cf-plot
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
dependencies infrastructure installation testing
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
docs enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
Todos los issues de NCAS-CMS/cf-plot
Issues similares
-
MarkdownDocSerializer.post_process escapes '\<' to '\<', rendering literal '<' in CommonMarkAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
docling-project/docling-core#1067 ·
Los mantenedores suelen responder en 3 días
-
correction metadata
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
acl-org/acl-anthology#11101 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[BUG] crewai tool create/install/login exit 0 when they failPosiblemente ocupada @Kiko0301 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
vllm-project/compressed-tensors#1033 ·
Los mantenedores suelen responder en 3 días
-
chore kaizen ui-rewrite
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
IBM/mcp-context-forge#7681 ·
Los mantenedores suelen responder en 2 días