British-Oceanographic-Data-Centre / COAsT

A Coastal Ocean Assessment Tool built as an extendable python framework for nemo models
https://british-oceanographic-data-centre.github.io/COAsT/
MIT License
24 stars 11 forks source link

Run cartopy plot function on notebooks during github workflow #666

Open soutobias opened 9 months ago

soutobias commented 9 months ago

Is there an existing request for this?

Desired Feature

The notebook polar_plotting.ipynb contains a cell responsible for plotting maps in polar projection. Unfortunately, when running the markdown-general.yml workflow, this notebook encounters an issue. Although the workflow appears to execute successfully, an error can be observed in the log:

[NbConvertApp] ERROR | Kernel died while waiting for execute reply.
...
nbclient.exceptions.DeadKernelError: Kernel died

This problem occurs within the notebook_to_md.sh script on the following line:

jupyter nbconvert --to notebook --execute example_scripts/notebook_tutorials/runnable_notebooks/${directory}/*.ipynb --allow-errors --output-dir example_scripts/notebook_tutorials/runnable_notebooks/executed/${directory}/

It's worth noting that the --allow-errors option prevents workflow failure due to errors in the notebook. However, because the notebooks are executed alphabetically, any notebooks following polar_plotting.ipynb won't run if an error occurs in this notebook.

Attempts to address the issue include:

  1. Adding --log-level=DEBUG --ExecutePreprocessor.timeout=600 to the nbconvert command to visualize notebook outputs and extend the cell execution time.

  2. Manually installing jupyter, notebook, and ipykernel within the markdown-general.yml file:

    pip install upgrade pip
    pip uninstall -y ipykernel
    pip install ipykernel
    pip install notebook nbconvert jupyter jupyter-server jupyter_client jupyter_core

Despite these efforts, a solution hasn't been found. As a workaround, the plotting section of the notebooks has been commented out, and a configuration gallery for polar plotting has been created. Images of the maps are manually added to the Markdown documentation.

Justification


User Workflow


Anything else?