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
16 changes: 9 additions & 7 deletions 2 Basic xarray - subsetting data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"xarray builds on top of numpy, and stores it's data internally as numpy arrays. It supports many numpy operations, so it is possible to find out the shape of the underlying data, and use numpy style indexing"
"xarray builds on top of numpy, and stores its data internally as numpy arrays. It supports many numpy operations, so it is possible to find out the shape of the underlying data, and use numpy style indexing"
]
},
{
Expand Down Expand Up @@ -139,14 +139,14 @@
}
],
"source": [
"tas[0,:]"
"tas[0,...]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"By selecting just the first time index it has created a DataArray with no time dimension, but time is still a coordinate not associated with any variable, as indicated by no longer having `*` beside it. The index selection above is equivalent to using `isel` like so"
"By selecting just the first time index it has created a DataArray with no time dimension, but time is still a coordinate not associated with any variable, as indicated by no longer having `*` beside it. It now only has one value: the value of the first time index. The index selection above is equivalent to using `isel` like so"
]
},
{
Expand Down Expand Up @@ -201,7 +201,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The power of xarray comes with the close association of data with coordinates. So it is possible to use the equivalent `.sel` operator but with coordinate values. For example, to select an area that includes the Indian Ocean and Australia use `slice` to indicate the range of latitude and longitude values required and pass as key/value pairs to `sel`"
"The power of xarray comes with the close association of data with coordinates. So it is possible to use the equivalent `.sel` operator but with coordinate values. For example, to select an area that includes the Indian Ocean and Australia use `slice` to indicate the range of latitude and longitude values required and pass as key/value pairs to `sel`. `slice` will include coordinate values inferior **or equal** to the upper bound, not like `range` in basic Python that excludes the upper bound."
]
},
{
Expand Down Expand Up @@ -335,6 +335,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Note when using `sel` to select only 1 time index, the resulting array still has a time dimension of length 1. Depending on what you want to do with the array afterwards, it might be better to still have the time dimension or not. \n",
"\n",
"It is also possible to use `slice` for the `time` dimension. To select Mar to November of 1871:"
]
},
Expand Down Expand Up @@ -448,9 +450,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:analysis3-19.07]",
"display_name": "Python 3",
"language": "python",
"name": "conda-env-analysis3-19.07-py"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -462,7 +464,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
"version": "3.7.2"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion 4 Basic xarray - calculating metrics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Can now calculate the anomaly from the 30 year climatology simply by subtracting it from the original data. xarray checks which named coordinates match between the two data sets, and *broadcasts* the `tas_clim` data along the missing `time` dimension automatically."
"We can now calculate the anomaly from the 30 year climatology simply by subtracting it from the original data. xarray checks which named coordinates match between the two data sets, and *broadcasts* the `tas_clim` data along the missing `time` dimension automatically."
]
},
{
Expand Down
38 changes: 19 additions & 19 deletions 5 Basic xarray - grouping and resampling in time.ipynb

Large diffs are not rendered by default.