diff --git a/01-conda.html b/01-conda.html index b2fe089..44b7397 100644 --- a/01-conda.html +++ b/01-conda.html @@ -409,14 +409,14 @@

Objectives

task.

For reading, writing and analysing data stored in the netCDF file format, atmosphere and ocean scientists will typically do most of their -work with either the xarray or iris libraries. These libraries -are built on top of more generic data science libraries like numpy and -matplotlib, to make the types of analysis we do faster and more -efficient. To learn more about the PyAOS “stack” shown in the diagram -below (i.e. the collection of libraries that are typically used for data -analysis and visualisation in the atmosphere and ocean sciences), check -out the overview of the PyAOS -stack at the PyAOS community site.

+work with either the xarray or iris libraries. These +libraries are built on top of more generic data science libraries like +numpy and matplotlib, to make the types of analysis we do faster and +more efficient. To learn more about the PyAOS “stack” shown in the +diagram below (i.e. the collection of libraries that are typically used +for data analysis and visualisation in the atmosphere and ocean +sciences), check out the overview of the PyAOS stack at +the PyAOS community site.

PyAOS stack

Python distributions for data science


Now that we’ve identified the Python libraries we might want to use, @@ -430,17 +430,18 @@

Objectives

most popular data science libraries and their dependencies pre-installed, and some also come with a package manager to assist with installing additional libraries that weren’t pre-installed. Today the -most popular distribution for data science is Anaconda, which comes +most popular distribution for data science is Anaconda, which comes with a package (and environment) manager called conda.

Introducing conda

-

According to the latest -documentation, Anaconda comes with over 250 of the most widely used -data science libraries (and their dependencies) pre-installed. In -addition, there are several thousand more libraries available via the -conda install command, which can be executed using the Bash -Shell or Anaconda Prompt (Windows only). It is also possible to install -packages using the Anaconda Navigator graphical user interface.

+

According to the latest documentation, +Anaconda comes with over 300 of the most widely used data science +libraries (and their dependencies) pre-installed. In addition, there are +several thousand more libraries available via the Anaconda Public +Repository, which can be installed by running the +conda install command the Bash Shell or Anaconda Prompt +(Windows only). It is also possible to install packages using the +Anaconda Navigator graphical user interface.

@@ -477,8 +478,8 @@

Miniconda

If you don’t want to install the entire Anaconda distribution, you -can install Miniconda instead. It -essentially comes with conda and nothing else.

+can install Miniconda +instead. It essentially comes with conda and nothing else.

@@ -489,18 +490,16 @@

MinicondaAnaconda Cloud website, where the community can contribute conda installation packages. This is critical because many of our libraries have a small user base, which -means they’ll never make it into the top few thousand data science -libraries supported by Anaconda.

+means they’ll never make it into the Anaconda Public Repository.

You can search Anaconda Cloud to find the command needed to install the package. For instance, here is the search result for the iris package:

Iris search on Anaconda Cloud

As you can see, there are often multiple versions of the same package -up on Anaconda Cloud. To try and address this duplication problem, conda-forge has been launched, -which aims to be a central repository that contains just a single -(working) version of each package on Anaconda Cloud. You can therefore -expand the selection of packages available via -conda install beyond the chosen few thousand by adding the -conda-forge channel:

+up on Anaconda Cloud. To try and address this duplication problem, conda-forge has been launched, which +aims to be a central repository that contains just a single (working) +version of each package on Anaconda Cloud. You can therefore expand the +selection of packages available via conda install beyond +the chosen few thousand by adding the conda-forge channel:

BASH

@@ -514,7 +513,7 @@

BASH


For these particular lessons we will use xarray, but all the same tasks could be performed with iris. We’ll also -install dask +install dask (xarray uses this for parallel processing), netCDF4 (xarray requires this to read netCDF files), cartopy (to help with geographic plot projections), cmocean (for @@ -553,7 +552,7 @@

Creating separate environmentsIf you’ve got multiple data science projects on the go, installing all your packages in the same conda environment can get a little messy. (By default they are installed in the root/base environment.) It’s -therefore common practice to create +therefore common practice to create separate conda environments for the various projects you’re working on.

For instance, we could create an environment called @@ -615,28 +614,13 @@

BASH
$ conda env create -f pyaos-lesson.yml

-

For ease of sharing the YAML file, it can be uploaded to your account -at the Anaconda Cloud website,

-
-

BASH -

-
$ conda env upload -f pyaos-lesson.yml
-
-

so that others can re-create the environment by simply refering to -your Anaconda username:

-
-

BASH -

-
$ conda env create damienirving/pyaos-lesson
-$ conda activate pyaos-lesson
-

The ease with which others can recreate your environment (on any operating system) is a huge breakthough for reproducible research.

To delete the environment:

-
+

BASH

-
$ conda env remove -n pyaos-lesson
+
$ conda env remove -n pyaos-lesson
@@ -658,10 +642,10 @@

BASHThe >>> prompt indicates that you are now talking to the Python interpreter.

A more powerful alternative to the default Python interpreter is -IPython (Interactive Python). The online -documentation outlines all the special features that come with -IPython, but as an example, it lets you execute bash shell commands -without having to exit the IPython interpreter:

+IPython (Interactive Python). The online documentation outlines +all the special features that come with IPython, but as an example, it +lets you execute bash shell commands without having to exit the IPython +interpreter:

$ ipython
 Python 3.7.1 (default, Dec 14 2018, 13:28:58)
 Type 'copyright', 'credits' or 'license' for more information
@@ -695,11 +679,11 @@ 

BASHdata-carpentry directory using the Bash Shell:

-
+

BASH

-
$ cd ~/Desktop/data-carpentry
-$ jupyter notebook &
+
$ cd ~/Desktop/data-carpentry
+$ jupyter notebook &

(The & allows you to come back and use the bash shell without closing your notebook first.)

@@ -714,9 +698,8 @@

BASHJupyterLab

-

The Jupyter team have recently launched JupyterLab -which combines the Jupyter Notebook with many of the features common to -an IDE.

+

If you like Jupyter Notebooks you might want to try JupyterLab, which combines +the Jupyter Notebook with many of the features common to an IDE.

@@ -748,10 +731,9 @@

Show me the solution

-

The setup -menu at the top of the page contains drop-down boxes explaining how -to install the Python libraries using the Bash Shell or Anaconda -Navigator.

+

The software +installation instructions explain how to install the Python +libraries using the Bash Shell or Anaconda Navigator.

@@ -776,13 +758,13 @@

Launch a Jupyer Notebook

Once your notebook is open, import xarray, catropy, matplotlib and numpy using the following Python commands:

-
+

PYTHON

-
import xarray as xr
-import cartopy.crs as ccrs
-import matplotlib.pyplot as plt
-import numpy as np
+
import xarray as xr
+import cartopy.crs as ccrs
+import matplotlib.pyplot as plt
+import numpy as np

(Hint: Hold down the shift and return keys to execute a code cell in a Jupyter Notebook.)

diff --git a/02-visualisation.html b/02-visualisation.html index 5a72227..349953d 100644 --- a/02-visualisation.html +++ b/02-visualisation.html @@ -626,8 +626,7 @@

PYTHON