Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appendix/template.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We also suggest checking out Jupyter Book's [brief demonstration](https://jupyterbook.org/content/metadata.html#jupyter-cell-tags) on adding cell tags to your cells in Jupyter Notebook, Lab, or manually. Using these cell tags can allow you to [customize](https://jupyterbook.org/interactive/hiding.html) how your code content is displayed and even [demonstrate errors](https://jupyterbook.org/content/execute.html#dealing-with-code-that-raises-errors) without altogether crashing our loyal army of machines!"
"We also suggest checking out Jupyter Book's [brief demonstration](https://jupyterbook.org/v1/content/metadata.html#add-metadata-to-notebooks) on adding cell tags to your cells in Jupyter Notebook, Lab, or manually. Using these cell tags can allow you to [customize](https://jupyterbook.org/v1/interactive/hiding.html) how your code content is displayed and even [demonstrate errors](https://jupyterbook.org/v1/content/execute.html#dealing-with-code-that-raises-errors) without altogether crashing our loyal army of machines!"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions core/cartopy.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Cartopy

This section contains tutorials on plotting maps with [Cartopy](https://scitools.org.uk/cartopy/docs/latest/) {cite:p}`Cartopy`; it is cross-referenced with tutorials on [Xarray](xarray) and [Matplotlib](matplotlib).
This section contains tutorials on plotting maps with [Cartopy](https://cartopy.readthedocs.io) {cite:p}`Cartopy`; it is cross-referenced with tutorials on [Xarray](xarray.md) and [Matplotlib](matplotlib.md).

---

From the [Cartopy website](https://scitools.org.uk/cartopy/docs/latest):
From the [Cartopy website](https://cartopy.readthedocs.io):

> Cartopy is a Python package designed for geospatial data processing in order to
> produce maps and other geospatial data analyses.
>
> Cartopy makes use of the powerful PROJ.4, NumPy and Shapely libraries and includes a programmatic interface
> built on top of Matplotlib for the creation of publication quality maps.
>
> Key features of Cartopy are its object-oriented [projection definitions](https://scitools.org.uk/cartopy/docs/latest/reference/crs.html#list-of-projections),
> Key features of Cartopy are its object-oriented [projection definitions](https://cartopy.readthedocs.io/stable/reference/crs.html#list-of-projections),
> and its ability to transform points, lines, vectors, polygons and images between those projections.

Before working through the Cartopy notebooks in this section of Pythia Foundations, you should first have a basic knowledge of [Matplotlib](matplotlib).
Before working through the Cartopy notebooks in this section of Pythia Foundations, you should first have a basic knowledge of [Matplotlib](matplotlib.md).

In addition, please note that the geographic-features library used by Cartopy makes use of shapefiles directly served by [Natural Earth](https://www.naturalearthdata.com/).
14 changes: 7 additions & 7 deletions core/cartopy/cartopy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"source": [
"## Prerequisites\n",
"\n",
"| Concepts | Importance | Notes |\n",
"| --- | --- | --- |\n",
"| [Matplotlib](../matplotlib) | Necessary | {cite:t}`Hunter:2007` |\n",
"| Concepts | Importance | Notes |\n",
"| ------------------------------ | ---------- | --------------------- |\n",
"| [Matplotlib](../matplotlib.md) | Necessary | {cite:t}`Hunter:2007` |\n",
"\n",
"- **Time to learn**: 30 minutes"
]
Expand Down Expand Up @@ -183,7 +183,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We can add these features to our subplot via the `add_feature` method; this method allows the definition of attributes using arguments, similar to Matplotlib's `plot` method. A list of the various Natural Earth shapefiles can be found at https://scitools.org.uk/cartopy/docs/latest/matplotlib/feature_interface.html. In this example, we add borders and U. S. state lines to our subplot:"
"We can add these features to our subplot via the `add_feature` method; this method allows the definition of attributes using arguments, similar to Matplotlib's `plot` method. A list of the various Natural Earth shapefiles can be found at https://cartopy.readthedocs.io/stable/matplotlib/feature_interface.html. In this example, we add borders and U. S. state lines to our subplot:"
]
},
{
Expand Down Expand Up @@ -225,7 +225,7 @@
"source": [
"<div class=\"admonition alert alert-info\">\n",
" <p class=\"admonition-title\" style=\"font-weight:bold\">Info</p>\n",
" You can find a list of supported projections in Cartopy, with examples, at <a href=\"https://scitools.org.uk/cartopy/docs/latest/reference/crs.html\">https://scitools.org.uk/cartopy/docs/latest/reference/crs.html</a>\n",
" You can find a list of supported projections in Cartopy, with examples, at <a href=\"https://cartopy.readthedocs.io/stable/reference/crs.html#list-of-projections\">https://cartopy.readthedocs.io/stable/reference/crs.html#list-of-projections</a>\n",
"</div>"
]
},
Expand Down Expand Up @@ -720,8 +720,8 @@
"source": [
"## Additional Resources\n",
"\n",
"1. [Cartopy Documentation](https://scitools.org.uk/cartopy/docs/latest/)\n",
"2. [Full list of projections in Cartopy](https://scitools.org.uk/cartopy/docs/latest/reference/crs.html) \n",
"1. [Cartopy Documentation](https://cartopy.readthedocs.io/)\n",
"2. [Full list of projections in Cartopy](https://cartopy.readthedocs.io/stable/reference/crs.html) \n",
"3. [Maps with Cartopy (Ryan Abernathey)](https://rabernat.github.io/research_computing_2018/maps-with-cartopy.html)\n",
"4. [Map Projections (GeoCAT)](https://geocat-examples.readthedocs.io/en/latest/gallery/index.html#map-projections)\n",
"5. [NCAR xdev Cartopy Tutorial Video](https://www.youtube.com/watch?v=ivmd3RluMiw)\n"
Expand Down
7 changes: 2 additions & 5 deletions core/data-formats/netcdf-cf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"# NetCDF and CF: The Basics\n",
"\n",
"![NetCDF Logo](https://www.unidata.ucar.edu/images/logos/netcdf-400x400.png \"NetCDF Logo\")\n",
"![NetCDF Logo](https://archive.unidata.ucar.edu/images/logos/netcdf-400x400.png \"NetCDF Logo\")\n",
"\n",
"---"
]
Expand All @@ -33,7 +33,7 @@
"| Concepts | Importance | Notes |\n",
"| --- | --- | --- |\n",
"| [Numpy Basics](../numpy/numpy-basics) | Necessary | |\n",
"| [Datetime](../datetime) | Necessary | |\n",
"| [Datetime](../datetime.md) | Necessary | |\n",
"\n",
"- **Time to learn**: 50 minutes"
]
Expand Down Expand Up @@ -72,7 +72,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<a name=\"gridded\"></a>\n",
"## Gridded Data"
]
},
Expand Down Expand Up @@ -744,7 +743,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<a name=\"obs\"></a>\n",
"## Observational Data\n",
"\n",
"Thus far, we have only worked with data arranged on grids. One common type of data, called \"in-situ\" or \"observational\" data, is usually arranged in other ways. The CF conventions for this type of data are called *Conventions for DSG (Discrete Sampling Geometries)*.\n",
Expand Down Expand Up @@ -974,7 +972,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<a name=\"references\"></a>\n",
"## Resources and References\n",
"\n",
"- [CF Conventions doc (1.7)](http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/cf-conventions.html)\n",
Expand Down
2 changes: 1 addition & 1 deletion core/datetime.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ When this chapter is fully built out, it will include a comprehensive guide to d
- [Numpy `datetime64`](https://numpy.org/doc/stable/reference/arrays.datetime.html) (for efficient vectorized date and time operations)
- [cftime library](https://unidata.github.io/cftime/) (for dealing with dates and times in non-standard calendars)

These tutorials will be cross-referenced with other tutorials on time-related topics, such as dealing with timeseries data in [Pandas](pandas) and [Xarray](xarray).
These tutorials will be cross-referenced with other tutorials on time-related topics, such as dealing with timeseries data in [Pandas](pandas.md) and [Xarray](xarray.md).
17 changes: 10 additions & 7 deletions core/datetime/datetime.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"- `datetime` **module** has a `datetime` **class**\n",
"- `datetime` **module** has a `time` **class**\n",
"- `datetime` **module** has a `date` **class**\n",
"- `time` **module** has a `time` function, which returns (almost always) [Unix time](#What-is-Unix-Time?)\n",
"- `time` **module** has a `time` function, which returns (almost always) [Unix time](#what-is-unix-time)\n",
"- `datetime` **class** has a `date` method, which returns a `date` object\n",
"- `datetime` **class** has a `time` method, which returns a `time` object\n",
"\n",
Expand Down Expand Up @@ -141,7 +141,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The variable `now` holds the current time in seconds since January 1, 1970 00:00 UTC. For more information on this important, but seemingly esoteric time format, see the section on this page called \"[What is Unix Time](#What-is-Unix-Time?)\". In addition, if you are not familiar with UTC, there is a section on this page called \"[What is UTC](#What-is-UTC?)\"."
"The variable `now` holds the current time in seconds since January 1, 1970 00:00 UTC. For more information on this important, but seemingly esoteric time format, see the section on this page called \"[What is Unix Time?](#what-is-unix-time)\". In addition, if you are not familiar with UTC, there is a section on this page called \"[What is UTC?](#what-is-utc)\"."
]
},
{
Expand All @@ -150,7 +150,7 @@
"source": [
"### `time` module\n",
"\n",
"The `time` module is well-suited for measuring [Unix time](#What-is-Unix-Time?). For example, when you are calculating how long it takes a Python function to run, you can employ the `time()` function, which can be found in the `time` module, to obtain Unix time before and after the function completes. You can then take the difference of those two times to determine how long the function was running. (Measuring the runtime of a block of code this way is known as \"benchmarking\".)"
"The `time` module is well-suited for measuring [Unix time](#what-is-unix-time). For example, when you are calculating how long it takes a Python function to run, you can employ the `time()` function, which can be found in the `time` module, to obtain Unix time before and after the function completes. You can then take the difference of those two times to determine how long the function was running. (Measuring the runtime of a block of code this way is known as \"benchmarking\".)"
]
},
{
Expand Down Expand Up @@ -180,9 +180,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"(what-is-unix-time)=\n",
"### What is Unix Time?\n",
"\n",
"Unix time is an example of system time, which is how a computer tracks the passage of time. Computers do not inherently know human representations of time; as such, they store time as a large binary number, indicating a number of time units after a set date and time. This is much easier for a computer to keep track of. In the case of Unix time, the time unit is seconds, and the set date and time is the epoch. Therefore, Unix time is the number of seconds since the epoch. The epoch is defined as January 1, 1970 00:00 [UTC](#What-is-UTC?). This is quite confusing for humans, but again, computers store time in a way that makes sense for them. It is represented \"under the hood\" as a [floating point number](https://en.wikipedia.org/wiki/Floating_point) which is how computers represent real (ℝ) numbers."
"Unix time is an example of system time, which is how a computer tracks the passage of time. Computers do not inherently know human representations of time; as such, they store time as a large binary number, indicating a number of time units after a set date and time. This is much easier for a computer to keep track of. In the case of Unix time, the time unit is seconds, and the set date and time is the epoch. Therefore, Unix time is the number of seconds since the epoch. The epoch is defined as January 1, 1970 00:00 [UTC](#what-is-utc). This is quite confusing for humans, but again, computers store time in a way that makes sense for them. It is represented \"under the hood\" as a [floating point number](https://en.wikipedia.org/wiki/Floating_point) which is how computers represent real (ℝ) numbers."
]
},
{
Expand All @@ -191,7 +192,7 @@
"source": [
"### `datetime` module\n",
"\n",
"The `datetime` module handles time with the Gregorian calendar (the calendar we, as humans, are familiar with); it is independent of Unix time. The `datetime` module uses an [object-oriented](#Thirty-second-introduction-to-Object-Oriented-programming) approach; it contains the `date`, `time`, `datetime`, `timedelta`, and `tzinfo` classes.\n",
"The `datetime` module handles time with the Gregorian calendar (the calendar we, as humans, are familiar with); it is independent of Unix time. The `datetime` module uses an object-oriented approach; it contains the `date`, `time`, `datetime`, `timedelta`, and `tzinfo` classes.\n",
"\n",
"- `date` class represents the day, month, and year\n",
"- `time` class represents the time of day\n",
Expand Down Expand Up @@ -322,6 +323,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"(days-since-strike)=\n",
"#### See how many days have elapsed since the strike:\n",
"\n",
"This example shows how to find the number of days since an event; in this case, the lightning strike described earlier:"
Expand Down Expand Up @@ -357,7 +359,7 @@
"\n",
"This convenient language feature is known as [operator overloading](https://en.wikipedia.org/wiki/Operator_overloading), and is another example of Python offering built-in functionality to make programming easier. (In some other languages, such as Java, you would have to call a method to perform such operations, which significantly obfuscates the code.) \n",
"\n",
"In addition, you can use these arithmetic operators with two datetime objects, as shown above with [lightning-strike data](#See-how-many-days-have-elapsed-since-the-strike:), to create `timedelta` objects. Let's examine all these features in the following code block."
"In addition, you can use these arithmetic operators with two datetime objects, as shown above with [lightning-strike data](#days-since-strike), to create `timedelta` objects. Let's examine all these features in the following code block."
]
},
{
Expand Down Expand Up @@ -397,6 +399,7 @@
"\n",
"Time zones can be a source of confusion and frustration in geoscientific data and in computer programming in general. Core date and time libraries in various programming languages, including Python, inevitably have design flaws, relating to time zones, date and time formatting, and other inherently complex issues. Third-party libraries are often created to fix the limitations of the core libraries, but this approach is frequently unsuccessful. To avoid time-zone-related issues, it is best to handle data in UTC; if data cannot be handled in UTC, efforts should be made to consistently use the same time zone for all data. However, this is not always possible; events such as severe weather are expected to be reported in a local time zone, which is not always consistent.\n",
"\n",
"(what-is-utc)=\n",
"### What is UTC?\n",
"\n",
"\"[UTC](https://en.wikipedia.org/wiki/Coordinated_Universal_Time)\" is a combination of the French and English abbreviations for Coordinated Universal Time. It is, in practice, equivalent to Greenwich Mean Time (GMT), the time zone at 0 degrees longitude. (The prime meridian, 0 degrees longitude, runs through Greenwich, a district of London, England.) In geoscientific data, times are often in UTC, although you should always verify that this is actually true to avoid time zone issues.\n",
Expand Down Expand Up @@ -501,7 +504,7 @@
"source": [
"## Summary\n",
"\n",
"The Python Standard Library contains several modules for dealing with date and time data. We saw how we can avoid some name ambiguities by aliasing the module names; this can be done with import statements like `import datetime as dt` and `import time as tm`. The `tm.time()` method just returns the current [Unix time](#What-is-Unix-Time?) in seconds -- which can be useful for measuring elapsed time, but not all that useful for working with geophysical data.\n",
"The Python Standard Library contains several modules for dealing with date and time data. We saw how we can avoid some name ambiguities by aliasing the module names; this can be done with import statements like `import datetime as dt` and `import time as tm`. The `tm.time()` method just returns the current [Unix time](#what-is-unix-time) in seconds -- which can be useful for measuring elapsed time, but not all that useful for working with geophysical data.\n",
"\n",
"The `datetime` module contains various classes for storing, converting, comparing, and formatting date and time data on the Gregorian calendar. We saw how we can parse data files with date and time strings into `dt.datetime` objects using the `dt.datetime.strptime()` method. We also saw how to perform arithmetic using date and time data; this uses the `dt.timedelta` class to represent intervals of time.\n",
"\n",
Expand Down
8 changes: 4 additions & 4 deletions core/numpy/intermediate-numpy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"source": [
"## Prerequisites\n",
"\n",
"| Concepts | Importance | Notes |\n",
"| --- | --- | --- |\n",
"| [NumPy Basics](numpy-basics) | Necessary | {cite:t}`harris2020array` |\n",
"| Concepts | Importance | Notes |\n",
"| ------------------------------- | ---------- | ------------------------- |\n",
"| [NumPy Basics](numpy-basics) | Necessary | {cite:t}`harris2020array` |\n",
"\n",
"* **Time to learn**: 20 minutes\n",
"---"
Expand All @@ -40,7 +40,7 @@
"metadata": {},
"source": [
"## Imports\n",
"We will be including [Matplotlib](../matplotlib) to illustrate some of our examples, but you don't need knowledge of it to complete this notebook."
"We will be including [Matplotlib](../matplotlib.md) to illustrate some of our examples, but you don't need knowledge of it to complete this notebook."
]
},
{
Expand Down
Loading