Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Xarray in 45 min #240

Merged
merged 4 commits into from
Feb 19, 2024
Merged
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
4 changes: 2 additions & 2 deletions advanced/accessors/01_accessor_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"\n",
"Perhaps you find yourself running similar code for multiple xarray objects or across related projects. By packing your code into an extension, it makes it easy to repeat the same operation while reducing the likelihood of [human introduced] errors.\n",
"\n",
"Here we wrap the reorganization of InSAR ice velocity data illustrated in [this tutorial](https://tutorial.xarray.dev/data_cleaning/ice_velocity.html?highlight=ice_velocity) into a custom Xarray extension that makes it easy to re-apply each time you begin working with a new InSAR velocity dataset. Please see the linked tutorial for details on the data, applications, and each step in this process."
"Here we wrap the reorganization of InSAR ice velocity data illustrated in [this tutorial](https://tutorial.xarray.dev/intermediate/data_cleaning/05.3_ice_velocity.html) into a custom Xarray extension that makes it easy to re-apply each time you begin working with a new InSAR velocity dataset. Please see the linked tutorial for details on the data, applications, and each step in this process."
]
},
{
Expand Down Expand Up @@ -425,5 +425,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
3 changes: 0 additions & 3 deletions advanced/map_blocks/simple_map_blocks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
"tags": []
},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"\n",
"# A gentle introduction\n",
"\n",
"`map_blocks` is inspired by the `dask.array` function of the same name and lets\n",
Expand Down
2 changes: 0 additions & 2 deletions fundamentals/01.1_creating_data_structures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"id": "17d7dc20-40bc-4597-84f1-6284f5ebec99",
"metadata": {},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"# Creating Data Structures"
]
},
Expand Down
2 changes: 0 additions & 2 deletions fundamentals/01_datastructures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"# Xarray's Data structures\n",
"\n",
"In this lesson, we cover the basics of Xarray data structures. Our\n",
Expand Down
2 changes: 0 additions & 2 deletions fundamentals/02.2_manipulating_dimensions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"# Manipulating Dimensions (Data Resolution)\n",
"\n",
"Sometimes we need to change the resolution of our data. We might need to look at inferred values between dimension (grid) spaces\n",
Expand Down
2 changes: 0 additions & 2 deletions fundamentals/02.3_aligning_data_objects.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"# Computing with Multiple Objects\n",
"\n",
"Learning goals:\n",
Expand Down
3 changes: 0 additions & 3 deletions fundamentals/03.4_weighted.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
"tags": []
},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"\n",
"# Weighted Reductions\n",
"\n",
"Xarray supports [weighted reductions](https://docs.xarray.dev/en/stable/user-guide/computation.html#weighted-array-reductions).\n",
Expand Down
2 changes: 0 additions & 2 deletions fundamentals/04.1_basic_plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"toc": true
},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"# Basic Visualization\n",
"\n",
"At the end of this lesson you will learn:\n",
Expand Down
2 changes: 0 additions & 2 deletions fundamentals/04.2_faceting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"id": "029c8020-86b5-4755-8df4-5bcdc9718a67",
"metadata": {},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"# Faceting\n",
"\n",
"Faceting is the art of presenting \"small multiples\" of the data. It is an\n",
Expand Down
2 changes: 0 additions & 2 deletions fundamentals/04.3_geographic_plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"id": "ed242a29-6be7-4574-84c1-f87095b07dec",
"metadata": {},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"# Geography with Cartopy\n",
"\n",
"Since xarray's default plotting functionality builds on matplotlib, we can\n",
Expand Down
2 changes: 0 additions & 2 deletions fundamentals/05_intro_to_dask.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"# Introduction to Dask\n",
"\n",
"In this lesson, we discuss cover the basics of Dask. Our learning goals are as\n",
Expand Down
3 changes: 0 additions & 3 deletions intermediate/hvplot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"id": "68b31548-7f97-4e1b-912a-e026746dd5bf",
"metadata": {},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"\n",
"# Interactive plots using hvplot\n",
"\n",
"Xarray's builtin plotting functionality wraps matplotlib.\n",
Expand Down
2 changes: 0 additions & 2 deletions intermediate/xarray_and_dask.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"# Parallel computing with Dask\n",
"\n",
"This notebook demonstrates one of Xarray's most powerful features: the ability\n",
Expand Down
42 changes: 20 additions & 22 deletions intermediate/xarray_ecosystem.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png\" align=\"right\" width=\"30%\">\n",
"\n",
"# A Tour of Xarray Customizations\n",
"\n",
"Xarray is easily extensible.\n",
Expand Down Expand Up @@ -510,7 +508,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Note: It is preferred to use `.pint.quantify()` to convert xarray data to use pint rather than explicitly creating a `pint.Quantity` array and placing it inside the xarray object, because pint-xarray will handle various subtleties involving dask etc."
"```{note}\n",
"It is preferred to use `.pint.quantify()` to convert xarray data to use pint rather than explicitly creating a `pint.Quantity` array and placing it inside the xarray object, because pint-xarray will handle various subtleties involving dask etc.\n",
"```"
]
},
{
Expand Down Expand Up @@ -609,34 +609,39 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**Exercise:** Write a function which will raise an error if supplied with data in the wrong units."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"```{exercise}\n",
":label: wrong-unit\n",
"Write a function which will raise a `pint.DimensionalityError` if supplied with Xarray DataArray with the wrong units.\n",
"```\n",
"\n",
"````{solution} wrong-unit\n",
":class: dropdown\n",
"\n",
"```python\n",
"from pint import DimensionalityError\n",
"\n",
"\n",
"def special_science_function(distance):\n",
" if distance.pint.units != \"miles\":\n",
" raise DimensionalityError(\n",
" \"this function will only give the correct answer if the input is in units of miles\"\n",
" )"
" )\n",
"```\n",
"\n",
"````"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Exercise:** Try this on some of your data!\n",
"```{exercise}\n",
"Try this on some of your data!\n",
"\n",
"After you have imported pint-xarray (and maybe cf-xarray) as above, start with something like\n",
"\n",
"`ds = xr.open_dataset(my_data).pint.quantify()`"
"`ds = xr.open_dataset(my_data).pint.quantify()`\n",
"```"
]
},
{
Expand All @@ -659,13 +664,6 @@
"source": [
"There are many other libraries in the wider xarray ecosystem. For a list of a few packages we particularly like for geoscience work [see here](https://tutorial.xarray.dev/overview/xarray-in-45-min.html#other-cool-packages), and for a [more exhaustive list see here](https://docs.xarray.dev/en/stable/ecosystem.html)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
2 changes: 1 addition & 1 deletion overview/get-started.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img src="https://docs.xarray.dev/en/stable/_static/dataset-diagram-logo.png" align="right" width="30%">
<img src="https://docs.xarray.dev/en/stable/_static/Xarray_Logo_RGB_Final.svg" align="right" width="30%">

(get-started)=

Expand Down
Loading
Loading