Skip to content

Commit

Permalink
Fix typos in notebook exercises
Browse files Browse the repository at this point in the history
  • Loading branch information
danny-lloyd committed Jun 25, 2024
1 parent dc2c58a commit d8bb0da
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The course covers:
14. [Variable Scope](http://swcarpentry.github.io/python-novice-gapminder/17-scope.html)
15. [Programming Style](http://swcarpentry.github.io/python-novice-gapminder/18-style.html)

* [Exercises](https://github.com/ncasuk/ncas-isc/blob/main/python-intro/notebooks) and [Solutions](https://github.com/ncasuk/ncas-isc/blob/main/python-intro/solutions)
* [Exercises](https://github.com/ncasuk/ncas-isc/blob/main/python-intro/exercises) and [Solutions](https://github.com/ncasuk/ncas-isc/blob/main/python-intro/solutions)

## Python - Working with Data

Expand Down
14 changes: 7 additions & 7 deletions python-data/notebooks/ex01_numpy_arrays.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"source": [
"### Let's create a numpy array from a list.\n",
"\n",
"Create a with values 1 to 10 and assign it to the variable `x`"
"Create a range with values 1 to 10 and assign it to the variable `x`"
]
},
{
Expand Down Expand Up @@ -179,7 +179,7 @@
"Create an array from the list `[2, 3.2, 5.5, -6.4, -2.2, 2.4]` and assign it to the variable `a`\n",
"\n",
"- Do you know what `a[1]` will equal? Print to see.\n",
"- Try print `a[1:4]` to see what that equals."
"- Try printing `a[1:4]` to see what that equals."
]
},
{
Expand Down Expand Up @@ -261,7 +261,7 @@
"\n",
"### Let's interrogate an array to find out it's characteristics\n",
"\n",
"Create a 2-D array of shape (2, 4) containing two lists `range(4)` and `range(10, 14)`, assign it to the vairable `arr`\n",
"Create a 2-D array of shape (2, 4) containing two lists `range(4)` and `range(10, 14)`, assign it to the variable `arr`\n",
"\n",
"- Print the shape of the array\n",
"- Print the size of the array\n",
Expand Down Expand Up @@ -342,7 +342,7 @@
"\n",
"### Let's perform some array calculations\n",
"\n",
"Create a 2-D array of shape (2, 4) containing two lists `range(4)` and `range(10, 14)`, assign it to the vairable `a`\n",
"Create a 2-D array of shape (2, 4) containing two lists `range(4)` and `range(10, 14)`, assign it to the variable `a`\n",
"\n",
"Create an array from a list `[2, -1, 1, 0]` and assign it to the variable `b`\n",
"\n",
Expand Down Expand Up @@ -385,7 +385,7 @@
"\n",
"Create an array of values 0 to 9 and assign it to the variable `arr`\n",
"\n",
"- Print two different way of expressing the condition where the array is less than 3.\n",
"- Print two different ways of expressing the condition where the array is less than 3.\n",
"- Create a numpy condition where `arr` is less than 3 OR greater than 8.\n",
"- Use the `where` function to create a new array where the value is `arr*5` if the above condition is `True` and `arr-5` where the condition is `False`"
]
Expand Down Expand Up @@ -418,7 +418,7 @@
"source": [
"### Let's implement a mathematical function that works on arrays.\n",
"\n",
"Write a function that takes a 2-D array of horizontal zonal (east-west) wind components (`u`, in m/s) and a 2-D array of horizontal meridional (north-south) wind componenets (`v`, in m/s)\n",
"Write a function that takes a 2-D array of horizontal zonal (east-west) wind components (`u`, in m/s) and a 2-D array of horizontal meridional (north-south) wind components (`v`, in m/s)\n",
"and returns an array of the magnitudes of the total wind.\n",
"Include a test for the overall magnitude: if it is less than 0.1 then set it equal to 0.1 (We might presume this particular domain has no non-zero winds and that only winds above 0.1 m/s constitute \"good\" data while those below are indistinguishable from the minimum due to noise)\n",
"\n",
Expand Down Expand Up @@ -534,7 +534,7 @@
"- Print the array to view its values.\n",
"- Print its missing value (i.e. `narr.fill_value`)\n",
"- Print an array that converts `narr` so that the missing values are represented by the missing value (i.e. `MA.filled`). Assign it to `farr`\n",
"- What is the type of the `farr`"
"- What is the type of `farr`?"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion python-data/notebooks/ex02_matplotlib.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
"source": [
"## 3. Plotting gridded data on a map\n",
"\n",
"In this section, we will use `cartopy` - a python module that supports maps and usage with `matplotlib`.\n",
"In this section, we will use `cartopy` - a Python module that supports maps and usage with `matplotlib`.\n",
"\n",
"First, let's grab some data from a NetCDF file and quickly plot it.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion python-data/notebooks/ex03_netcdf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Loop through and print Dataset `variables` names, this is the ID that act like the key to access the Variable."
"Loop through and print Dataset `variables` names, this is the ID that acts like the key to access the variable."
]
},
{
Expand Down
14 changes: 7 additions & 7 deletions python-data/solutions/ex01_numpy_arrays_solutions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"source": [
"### Let's create a numpy array from a list.\n",
"\n",
"Create a with values 1 to 10 and assign it to the variable `x`"
"Create a range with values 1 to 10 and assign it to the variable `x`"
]
},
{
Expand Down Expand Up @@ -291,7 +291,7 @@
"Create an array from the list `[2, 3.2, 5.5, -6.4, -2.2, 2.4]` and assign it to the variable `a`\n",
"\n",
"- Do you know what `a[1]` will equal? Print to see.\n",
"- Try print `a[1:4]` to see what that equals."
"- Try printing `a[1:4]` to see what that equals."
]
},
{
Expand Down Expand Up @@ -406,7 +406,7 @@
"\n",
"### Let's interrogate an array to find out it's characteristics\n",
"\n",
"Create a 2-D array of shape (2, 4) containing two lists `range(4)` and `range(10, 14)`, assign it to the vairable `arr`\n",
"Create a 2-D array of shape (2, 4) containing two lists `range(4)` and `range(10, 14)`, assign it to the variable `arr`\n",
"\n",
"- Print the shape of the array\n",
"- Print the size of the array\n",
Expand Down Expand Up @@ -533,7 +533,7 @@
"\n",
"### Let's perform some array calculations\n",
"\n",
"Create a 2-D array of shape (2, 4) containing two lists `range(4)` and `range(10, 14)`, assign it to the vairable `a`\n",
"Create a 2-D array of shape (2, 4) containing two lists `range(4)` and `range(10, 14)`, assign it to the variable `a`\n",
"\n",
"Create an array from a list `[2, -1, 1, 0]` and assign it to the variable `b`\n",
"\n",
Expand Down Expand Up @@ -602,7 +602,7 @@
"\n",
"Create an array of values 0 to 9 and assign it to the variable `arr`\n",
"\n",
"- Print two different way of expressing the condition where the array is less than 3.\n",
"- Print two different ways of expressing the condition where the array is less than 3.\n",
"- Create a numpy condition where `arr` is less than 3 OR greater than 8.\n",
"- Use the `where` function to create a new array where the value is `arr*5` if the above condition is `True` and `arr-5` where the condition is `False`"
]
Expand Down Expand Up @@ -652,7 +652,7 @@
"source": [
"### Let's implement a mathematical function that works on arrays.\n",
"\n",
"Write a function that takes a 2-D array of horizontal zonal (east-west) wind components (`u`, in m/s) and a 2-D array of horizontal meridional (north-south) wind componenets (`v`, in m/s)\n",
"Write a function that takes a 2-D array of horizontal zonal (east-west) wind components (`u`, in m/s) and a 2-D array of horizontal meridional (north-south) wind components (`v`, in m/s)\n",
"and returns an array of the magnitudes of the total wind.\n",
"Include a test for the overall magnitude: if it is less than 0.1 then set it equal to 0.1 (We might presume this particular domain has no non-zero winds and that only winds above 0.1 m/s constitute \"good\" data while those below are indistinguishable from the minimum due to noise)\n",
"\n",
Expand Down Expand Up @@ -807,7 +807,7 @@
"- Print the array to view its values.\n",
"- Print its missing value (i.e. `narr.fill_value`)\n",
"- Print an array that converts `narr` so that the missing values are represented by the missing value (i.e. `MA.filled`). Assign it to `farr`\n",
"- What is the type of the `farr`"
"- What is the type of `farr`?"
]
},
{
Expand Down
18 changes: 9 additions & 9 deletions python-data/solutions/ex02_matplotlib_solutions.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion python-data/solutions/ex03_netcdf_solutions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Loop through and print Dataset `variables` names, this is the ID that act like the key to access the Variable."
"Loop through and print Dataset `variables` names, this is the ID that acts like the key to access the variable."
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions python-intro/exercises/ex16_writing_functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
"id": "8a892f7c-c239-4789-a7e1-85273e3b18ca",
"metadata": {},
"source": [
"Why is the result of the following None? Can you fix it?\n",
"Why is the result of the following `None`? Can you fix it?\n",
"```\n",
"def print_time(hour, minute, second):\n",
" time_string = str(hour) + ':' + str(minute) + ':' + str(second)\n",
Expand Down Expand Up @@ -319,15 +319,15 @@
"id": "109d940a-3794-4998-bb51-f7b070b81ccf",
"metadata": {},
"source": [
"## 4. Let's write a function to use Pytahgoras' Theorem, like in exercise 2."
"## 4. Let's write a function to use Pythagoras' Theorem, like in exercise 2."
]
},
{
"cell_type": "markdown",
"id": "321170b7-0af5-4c77-84a6-39571b8f72af",
"metadata": {},
"source": [
"Define a function `calc_hypo` that takes two arguments, `a` and `b`. Inside the function, define a variable `hypo` equal to the length of the hypotonuse and return the value."
"Define a function `calc_hypo` that takes two arguments, `a` and `b`. Inside the function, define a variable `hypo` equal to the length of the hypotenuse and return the value."
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions python-intro/solutions/ex16_writing_functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
"id": "8a892f7c-c239-4789-a7e1-85273e3b18ca",
"metadata": {},
"source": [
"Why is the result of the following None? Can you fix it?\n",
"Why is the result of the following `None`? Can you fix it?\n",
"```\n",
"def print_time(hour, minute, second):\n",
" time_string = str(hour) + ':' + str(minute) + ':' + str(second)\n",
Expand Down Expand Up @@ -408,15 +408,15 @@
"id": "109d940a-3794-4998-bb51-f7b070b81ccf",
"metadata": {},
"source": [
"## 4. Let's write a function to use Pytahgoras' Theorem, like in exercise 2."
"## 4. Let's write a function to use Pythagoras' Theorem, like in exercise 2."
]
},
{
"cell_type": "markdown",
"id": "321170b7-0af5-4c77-84a6-39571b8f72af",
"metadata": {},
"source": [
"Define a function `calc_hypo` that takes two arguments, `a` and `b`. Inside the function, define a variable `hypo` equal to the length of the hypotonuse and return the value."
"Define a function `calc_hypo` that takes two arguments, `a` and `b`. Inside the function, define a variable `hypo` equal to the length of the hypotenuse and return the value."
]
},
{
Expand Down

0 comments on commit d8bb0da

Please sign in to comment.