This article will show you how to work with a Jupyter Notebook within EarthAI.
Jupyter Notebooks are documents that combine executable code with accompanying text, images, and interactive visualizations. Notebooks are a native component to EarthAI. This article will demonstrate the basics of working with notebooks within the EarthAI platform. Although this example makes use of EarthAI's proprietary software, the mechanics of working with Jupyter Notebooks presented here are applicable to notebooks outside of the platform.
After launching an EarthAI Notebook server, you can create a new notebook as demonstrated in this article by clicking Go To Launcher on the welcome screen and clicking EarthAI Environment on the launch screen. A new notebook will open up in the main work area as shown below. Cells have two main types with the default type being a Code cell. Cells of type Markdown will be discussed below.
In the first cell of the notebook, you can import the EarthAI library by typing the following.
from earthai.init import *
To run the first cell, click on the cell and then you can either hit Shift+Enter on your keyboard or click the play button at the top of the notebook (outlined in orange below).
To run all of the cells in a notebook at once you can click Run in the top menu and select Run All Cells. There are other options in the Run menu that you can play around with.
To add a new cell to your notebook, select the plus sign button (outlined in orange below) at the top of the notebook.
To delete a cell, right click on a cell and select Delete Cells or go to Edit in the top menu and select Delete Cells.
If you’ve made a mistake in one of your cells or it's taking a while to run and you want to stop it, you can select the square button (outlined in orange below) at the top of the notebook, which will interrupt the kernel and stop the execution of the cell. If you want to shut down the notebook completely, you can select Kernel in the top menu and select Shutdown Kernel. By doing this, you will lose any cached results in the notebook.
To save your notebook, select the floppy disk save icon (outlined in orange below) at the top of the notebook.
Text, including web links, can be added to Jupyter notebooks using Markdown cells. Any new cell added will be code by default. You can change the cell type by clicking on the cell, clicking the dropdown at top of the notebook (outlined in orange below), and selecting a different cell type option. If you are familiar with Markdown generally Markdown cells handle the functionality of Markdown language including bolding, italicizing, lists, headers, etc.
To close a notebook, you can click the red X (outlined in orange below) next to the notebook name. Closing the notebook will not shut down the kernel though, you will need to right click on notebook in the file browser and select Shut Down Kernel or select Kernel -> Shut Down Kernel in the top menu before closing the notebook. Shutting down the kernel will free up memory on your server but will also remove any cached variables in your notebook.
Additional Resources
Below are some additional online resources for those who would like to learn more about the underlying technology that supports EarthAI. These are not required reading to be able to start working in the platform. One quick note is that JupyterLab is a broader environment that includes Jupyter Notebooks.
Comments
0 comments
Please sign in to leave a comment.