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

Seeing MemoryError: std::bad_alloc errors in contour plots #1052

Open
xylar opened this issue Jan 17, 2025 · 0 comments
Open

Seeing MemoryError: std::bad_alloc errors in contour plots #1052

xylar opened this issue Jan 17, 2025 · 0 comments
Labels

Comments

@xylar
Copy link
Collaborator

xylar commented Jan 17, 2025

From time to time in testing, I have seen errors like:

analysis task climatologyMapSeaIceSnowDepthNH_plotON_arctic_extended failed during run
Traceback (most recent call last):
  File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Analysis/add_OSNAP_TSclimtransects/mpas_analysis/shared/analysis_task.py", line 322, in run
    self.run_task()
    ~~~~~~~~~~~~~^^
  File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Analysis/add_OSNAP_TSclimtransects/mpas_analysis/shared/plot/plot_climatology_map_subtask.py", line 487, in run_task
    self._plot_projection(remappedModelClimatology,
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
                          remappedRefClimatology,
                          ^^^^^^^^^^^^^^^^^^^^^^^
                          componentName, componentSubdirectory)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Analysis/add_OSNAP_TSclimtransects/mpas_analysis/shared/plot/plot_climatology_map_subtask.py", line 636, in _plot_projection
    plot_projection_comparison(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^
        config,
        ^^^^^^^
    ...<17 lines>...
        vertical=vertical,
        ^^^^^^^^^^^^^^^^^^
        extend=self.extend)
        ^^^^^^^^^^^^^^^^^^^
  File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Analysis/add_OSNAP_TSclimtransects/mpas_analysis/shared/plot/climatology_map.py", line 691, in plot_projection_comparison
    plot_panel(ax, modelTitle, modelArray, **dictModelRef)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Analysis/add_OSNAP_TSclimtransects/mpas_analysis/shared/plot/climatology_map.py", line 596, in plot_panel
    plotHandle = ax.contourf(xCenter, yCenter, array, cmap=colormap,
                             norm=norm, levels=levels, extend=extend)
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_dev/lib/python3.13/site-packages/cartopy/mpl/geoaxes.py", line 306, in wrapper
    return func(self, *args, **kwargs)
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_dev/lib/python3.13/site-packages/cartopy/mpl/geoaxes.py", line 350, in wrapper
    return func(self, *args, **kwargs)
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_dev/lib/python3.13/site-packages/cartopy/mpl/geoaxes.py", line 1646, in contourf
    result = super().contourf(*args, **kwargs)
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_dev/lib/python3.13/site-packages/matplotlib/__init__.py", line 1521, in inner
    return func(
        ax,
        *map(cbook.sanitize_sequence, args),
        **{k: cbook.sanitize_sequence(v) for k, v in kwargs.items()})
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_dev/lib/python3.13/site-packages/matplotlib/axes/_axes.py", line 6760, in contourf
    contours = mcontour.QuadContourSet(self, *args, **kwargs)
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_dev/lib/python3.13/site-packages/matplotlib/contour.py", line 765, in __init__
    self._paths = self._make_paths_from_contour_generator()
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_dev/lib/python3.13/site-packages/matplotlib/contour.py", line 938, in _make_paths_from_contour_generator
    for vs, cs in vertices_and_codes]
                  ^^^^^^^^^^^^^^^^^^
MemoryError: std::bad_alloc

This is with matplotlib 3.10.0 and cartopy 0.24.0.

@xylar xylar added the bug label Jan 17, 2025
@xylar xylar mentioned this issue Jan 17, 2025
3 tasks
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