Skip to content

Commit 24574b5

Browse files
authored
Merge pull request DOI-USGS#182 from ldecicco-USGS/main
Add instructions for opening and using JupyterLab
2 parents 3098f05 + a78073b commit 24574b5

6 files changed

Lines changed: 65 additions & 1 deletion

File tree

installation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Move the the downloaded zip file (`python-for-hydrology-main.zip`) to the select
4646

4747
# Test the class environment
4848

49-
After successful installation of the class environment and downloading the class repository navigate to the `installation` directory in class repository.
49+
After successful installation of the class environment and downloading the class repository navigate to the `installation` directory in class repository. In Windows, this is done in Miniforge Prompt.
5050

5151
```shell
5252
cd python-for-hydrology/installation

notebooks/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Jupyter Lab
2+
3+
Jupyter Lab will be used to view and interact with Python Notebooks.
4+
5+
## Starting Jupyter
6+
7+
### Windows
8+
9+
1. Open Miniforge Prompt. Startup steps (2-4) are done within Miniforge.
10+
11+
2. Navigate to the notebooks folder:
12+
13+
For example:
14+
15+
```shell
16+
cd python-for-hydrology/notebooks/part0_python_intro
17+
```
18+
19+
3. Activate the pyclass environment (this assumes the installation steps were already performed).
20+
21+
```shell
22+
conda activate pyclass
23+
```
24+
25+
4. Launch JupyterLab with the command:
26+
27+
```shell
28+
jupyter lab
29+
```
30+
31+
A browser should open up:
32+
33+
<img src="images/jupyter_launch.png" alt="Launch Jupyter" width="300"/>
34+
35+
Choose Python 3 (ipykernal)
36+
37+
5. Choose one of the .ipynb files
38+
39+
## Using Jupyter
40+
41+
* Individual code blocks can be run with "Shift + Enter".
42+
43+
* You can pick a spot in the notebook and run all
44+
the code up until that point. To do that, place your
45+
cursor in the place you want the code to run to. Go
46+
to the Run menu and choose "Run all above selected cell".
47+
48+
<img src="images/run_to.png" alt="Run to a code block" width="300"/>
49+
50+
* Text notes can be added by adding a cell and choosing "Markdown":
51+
52+
<img src="images/take_notes.png" alt="Take notes" width="200"/>
53+
54+
* Code cells that have been run will have a number in the [ ]:
55+
56+
<img src="images/was_run.png" alt="Take notes" width="300"/>
57+
58+
* Export the notebook to a Python script:
59+
60+
File -> Save and Export Notebook As -> Executable Script
61+
62+
63+
64+
118 KB
Loading

notebooks/images/run_to.png

134 KB
Loading

notebooks/images/take_notes.png

71.5 KB
Loading

notebooks/images/was_run.png

92.9 KB
Loading

0 commit comments

Comments
 (0)