ENVIRON859 - Advanced Geospatial Analysis
and create your personal Jupyter environment.This should bring you to your personal Jupyter environment, where you can write and execute your own Python code. When you close your browser, this environment stays active and you can return to your work in progress by going back to the link above.
You'll see in your Jupyter environment some menus and a list of .ipynb
documents.
Note: Some Jupyter containers are now defaulting to "Jupyter Lab", which is slightly different than "Jupyter Notebooks". To make sure you have Jupyter Notebooks running, look at the web address: if it ends in
/lab
, then just delete the/lab
and the page will reload to Jupyter notebooks, where the web address ends in/tree
.
The Jupyter notebooks we'll use for today's lesson reside on a remote GitHub repository. GitHub is another valuable tool in the Data Analytics world that we don't have time to dig into right now. However, we will use it to 'clone' the files we need to our Jupyter machine.
To do this we need to run a shell command, which is done in new a Jupyter notebook linked not with the Python kernel, but with the "Bash" linux kernel.
New
menu dropdown and choose, Bash
. git clone https://github.com/DataDevils/WaterFlow-Python.git
►|
button. As this runs you'll see status messages that the 'WaterFlow-Python' is being downloaded. untitled.ipynb
in your Jupyter environment.WaterFlow-Python
. No time to go into great detail, but your Jupyter environment is a touch like a file system in that it lists the files in your workspace and allows you to open and manage them. What's important to us right now is that this Jupyter environment where you can create Jupyter Notebooks.
For us, here, today, a Jupyter notebook is where we'll write and execute our Python code.
Jupyter notebooks can do more, a lot more, than just run Python code, but again, that's not our focus here. So we'll distill it down to this:
The documents you see with the .ipynb
extension are all Jupyter notebooks. The extension is actually short for iPython notebook, as Jupyter evolved from interactive Python, or iPython for short.
There's much more to these notebooks, more than we can cover in a day, let alone a few minutes, so we'll learn what we need as we go. Plenty of more comprehensive introduction to the Jupyter environment and Jupyter notebooks are on line. Some examples:
01-WaterFlow-Terse.ipynb
document to open it. Note that it opens in a new browser tab and that the page opened has a mix of formatted text, Python code, and the results of the Python code.Quick start: Impacts of Falls Lake on streamflow...
in it. You see that converts to raw markdown format, which is how we can add rich text to our notebooks. ►|
button to "execute" the contents, which converts the raw markdown back to formatted text. Alternatively, you could click ctrl
-enter
to run the code. ►|
button). This runs the code in the box and shows the result just below. Kernel
>Restart & Clear Output
. This resets the document, clearing all output, which is fine since we can just re-run our code!Cells
>Run All
, which zips through all our code. File
>Save and checkpoint
(or click ctrl
-s
, or just click the save icon). File
>Close and Halt
. Note that if you just close the page displaying the document, it does not halt the kernel. It's best practice to halt the page when you are not editing it for a while. Ok! We're ready to get started! If you've opened this document as a Jupyter notebook, you can save it and then "Close and Halt" it.