-
Notifications
You must be signed in to change notification settings - Fork 3
Analyzing ELM Output in Jupyter Lab
- In a terminal window run the following code:
docker run -p 8888:8888 -v elmdata:/home/jovyan/inputdata -v elmoutput:/home/jovyan/output serbinsh/ngeearctic_elm_containers:elmlab_3.3.2
The different parts of this code are broken down by color below
-
Running this command will start a JupyterLab Docker environment and the terminal window will look like this:
-
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.
-
You should then see a Jupyter-Lab environment in your browser:
-
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.
-
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
- 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
- Blue sidebar (blue arrow): This sidebar shows your current place in the document and it will move down each time you hit "run"
- Running code dot (pink arrow): this dot shows up when the 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.
- 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).
-
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 calledvardata
, you can usevardata.to_dataframe().to_csv("output_filename.csv")
- 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.