Skip to content

[postprocessing] plot_result_maps leaks all but the grensvlak figures #68

Description

@bdestombe

In plot_result_maps (postprocessing.py:189-271) plt.close(f) is called only inside the grensvlak loop. The model-grid (doorsnedelijnen), drain-elevation (oppervlaktewater), freshwater-head and concentration-at-surface figures are created, saved and then left open.

With the default matplotlib backend that is a steadily growing set of live figures for the rest of the process, and matplotlib warns once more than 20 are open. In 09pwnmodel2 the function is called once so the practical cost is small, but any loop over stress periods or scenarios accumulates them.

Fix: close every figure after _save, or wrap the body so each figure is closed in a finally.

Found while writing the test suite (the tests close figures in an autouse fixture, which is why this does not surface as a test failure).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions