Analyzing ELM Output in Jupyter Lab - FASSt-simulation/fasst_simulation_tools GitHub Wiki

Running Jupyter-Lab and Analyzing ELM Output

Step 1. Start communication with Jupyter-Lab environment

  • In a terminal window run the following code:
docker run -p 8888:8888 -v elmdata:/home/jovyan/inputdata -v elmoutput:/home/jovyan/output fasstsimulation/fasst_simulation_tools:elmlab_3.3.2

The different parts of this code are broken down by color below Jupyter comms code breakdown

  • Running this command will start a JupyterLab Docker environment and the terminal window will look like this: Screen Shot 2022-09-22 at 4 33 52 PM

  • To access the JupyterLab environment just copy and paste the URL that starts with "http:// 127.0.0.1:8888/lab? token=..." from the terminal window into your browser and hit enter. Note that each time you start a JupyterLab environment, a unique URL will be generated. Screen Shot 2022-09-22 at 4 34 53 PM

  • You should then see a Jupyter-Lab environment in your browser: Screen Shot 2022-09-22 at 4 37 44 PM


Step 2. Run Jupyter notebook scripts to look at ELM output

  • After your notebook environment starts in your browser, you can open and run different notebook scripts. You can find example scripts on the "scripts" folder on the left of the screen, e.g. Screen Shot 2022-09-22 at 4 39 40 PM

  • In the script folder, find the built-in notebook "plot_ELM_variable.ipynb". You may need to expand the sidebar menu using your cursor so that you can read the full names of the notebooks listed. You can double click on the notebook script to open it in the viewer on the right. You will see a document open in the workspace that says "An example of reading in and plotting one variable from ELM output" and features the NGEE Arctic logo.

  • At this screen shown below there are a few details worth pointing out a few details to help you navigate this tool. These are highlighted using colored arrows in the screenshot below

  1. Run Button (green arrow): Hitting this run button will activate the portion of the document currently selected by the blue sidebar. If the portion of the document is a code box, the code will be run
  2. Blue sidebar (blue arrow): This sidebar shows your current place in the document and it will move downward each time you hit "run"
  3. Running code dot (pink arrow): this dot shows up when code is currently being run. If you hit the run button and it seems like nothing happened, check to see if this dot is still present. If so, give your computer a minute to think. The dot disappears when it is done.
  4. Code box (orange arrow): The text in this box is python code. Anything with "#" is commented out, ie that text does not "do" anything but provides notes and context for organizing the code. In the active code portions of the text, different text colors are used to differentiate different parts of the code (function types, different kinds of input, etc). JupyterNotebookArrows
  • From here, you can follow the tutorial in the python lab notebook as it takes you through finding model output, choosing a variable from the list of all available, and graphing the model output from the transient period

  • Have fun exploring these graphs and don't forget to ask any questions you make have on the Slack Channel!

  • You can save a csv file of a particular variable by using the to_dataframe.to_csv() method in python - assuming your variable is contained in an array called vardata, you can use vardata.to_dataframe().to_csv("output_filename.csv")

Step 3. Shutting down Jupyter-Lab and freeing up your terminal

  • When you are finished, click on the File menu in the Jupyter-Lab environment and choose "Shut down." This will stop the web-based environment and free up the terminal window where you started it in Step 1.

Return to Home