Deltares / Deltares/imod-python

GridAnimation3D write should have a show argument

Open
#231 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
41
Forks
12
Avg merge
21h 8m
Merged PRs (30d)
1

Description

In GitLab by @betsyromero on Mar 8, 2022, 18:34

The problem seems to be that for example within a Jupyter notebook, showing the 3D plot somehow closes the video file or something.
This can be solved by not showing the plots, but that should be an option anyway!

Like this:

    def write(self, filename, framerate=24, show=False):
        """
        Write the animation to a video or gif.

        Resets the plotter when finished animating.

        Parameters
        ----------
        filename : str, pathlib.Path
            Filename to write the video to. Should be an .mp4 or .gif.
        framerate : int, optional
            Frames per second. Not honoured for gif.
        """
        if Path(filename).suffix.lower() == ".gif":
            self.plotter.open_gif(
                Path(filename).with_suffix(".gif").as_posix()
            )  # only lowercase gif and no Path allowed
        else:
            self.plotter.open_movie(filename, framerate=framerate)
        if show:
            self.plotter.show(auto_close=False, interactive=False)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the GridAnimation3D.write entry point and inspect how its plotter is shown while writing a video or GIF. Add the requested show option so notebook users can choose whether to display the plot, then verify both video-writing behavior and the no-show case in a Jupyter notebook.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
data-visualization
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.