`gclose` shows no view when `gopen` is called with `file` set
@sadielbartholomew is already working on this.
Since May 14, 2024.
- Dominant language
- Python
- Stars
- 21
- Forks
- 11
- Avg merge
- 7h 11m
- Merged PRs (30d)
- 1
Description
The gclose parameter view fails to behave correctly, notably to produce a graphical display window showing the relevant plot when defaulting or set to True or equivalent, only in the case that a gopen call with a set file file name has been provided (a parameter-free gopen() exhibits correct view behaviour). As the below example shows, this affects future calls to gclose, even when another gopen is called between.
Minimal reproducer
Running the below short script shows no graphical window display with the plots, when it should produce two separately from both calls to gopen because the default is view=True and (to double check) when setting that manually nothing changes. Note though that when we remove the file="delme.png" specification to the first gopen call, both plots then are displayed. (Either way, the plots are still saved correctly, just not displayed to the user, as requested from the view parameter.)
PATH_TO_DATASETS = "~/git-repos/cf-plot/cfplot_data"
# Use this import order to avoid seg fault RE ESMF/matplotlib interfacing
import cfplot as cfp
import cf
# Using docs 'Example 1 - basic cylindrical projection' to illustrate issue
cfp.gopen(file="delme.png") # without file=<name> set, viewing works
f=cf.read(f"{PATH_TO_DATASETS}/tas_A1.nc")[0]
cfp.con(f.subspace(time=15))
cfp.gclose()
cfp.gopen() # even if file=<name> set is not set here, view fails still
f=cf.read(f"{PATH_TO_DATASETS}/tas_A1.nc")[0]
cfp.con(f.subspace(time=15))
cfp.gclose(view=True) # try re-stating the default, still viewing won't work
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.