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
89 changes: 38 additions & 51 deletions intermediate/datastructures-intermediate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@
"metadata": {},
"outputs": [],
"source": [
"# pull out \"air\" dataarray with dictionary syntax\n",
"# pull out \"air\" DataArray with dict-like syntax\n",
"ds[\"air\"]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can save some typing by using the \"attribute\" or \"dot\" notation. This won't\n",
"You can save some typing by using the \"dict-like\" or \"attribute-like\" syntax. This won't\n",
"work for variable names that clash with a built-in method name (like `mean` for\n",
"example).\n"
]
Expand All @@ -134,7 +134,7 @@
"metadata": {},
"outputs": [],
"source": [
"# pull out dataarray using dot notation\n",
"# pull out DataArray using attribute-like syntax notation\n",
"ds.air"
]
},
Expand Down Expand Up @@ -341,20 +341,6 @@
"<img src=\"https://docs.xarray.dev/en/stable/_images/dataset-diagram.png\" align=\"center\" width=\"50%\">"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercise\n",
"\n",
"In this exercise the air dataset has been deconstructed into a dictionary of NumPy arrays. Please\n",
"\n",
"- Build a Dataset from scratch from this dictionary of NumPy arrays.\n",
"\n",
"\n",
"Hint: You will want to start by building DataArrays, then combining them into a Dataset.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -372,10 +358,42 @@
" }\n",
"\n",
"\n",
"data = air_as_dictionary()\n",
"data = air_as_dictionary()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercise"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"::::{admonition} Exercise\n",
":class: tip\n",
"\n",
"In this exercise the air dataset has been deconstructed into a dictionary of NumPy arrays. Please\n",
"\n",
"- Build a Dataset from scratch from this dictionary of NumPy arrays.\n",
"\n",
":::{admonition} Hint\n",
":class: dropdown\n",
"\n",
"Hint: You will want to start by building DataArrays. You can start with something like `xr.DataArray(data=data['air-temp']...`\n",
"\n",
":::\n",
"\n",
"# Your code here"
":::{admonition} Solution\n",
":class: dropdown\n",
"\n",
"```python\n",
"xr.DataArray(data=data['air-temp'], coords={'time':data['time'], 'lat':data['lat'], 'lon':data['lon']}).to_dataset(name='air_temp')\n",
"```\n",
":::\n",
"::::"
]
},
{
Expand Down Expand Up @@ -596,7 +614,7 @@
"\n",
"Dataset of non-alignable data.\n",
"\n",
"For this exercise we will be using the `\"precipitation\"` example data. This data has two parts observed rainfall (`observed`), and predicted rainfall, on a different lat-lon grid. The next cell calls a function that will give you two different Datasets. Try to combine them using the tools we've discussed thus far and observe what goes wrong.\n"
"For this exercise we will be using the `\"precipitation\"` example data. This data has two groups, observed precipitation (`observed`), and model precipitation, on a different lat-lon grid. The next cell calls a function that will give you two different Datasets. Try to combine them using the tools we've discussed thus far and observe what goes wrong.\n"
]
},
{
Expand All @@ -610,43 +628,12 @@
"observed = xr.Dataset(tree[\"reanalysis\"])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For more see the [user guide](https://docs.xarray.dev/en/stable/plotting.html), the [gallery](https://docs.xarray.dev/en/stable/examples/visualization_gallery.html), and [the tutorial material](https://tutorial.xarray.dev/fundamentals/04.0_plotting.html)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
2 changes: 0 additions & 2 deletions workshops/scipy2026/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
"\n",
"## Welcome to the Xarray SciPy 2026 Tutorial! \n",
"\n",
"> 🚧👷‍♀️🏗️ This page is under construction. Please check back later.\n",
"\n",
"<img src=\"https://images.squarespace-cdn.com/content/v1/69223993a619b0382ba1b905/9ef1aa1c-4fab-404d-818c-17edcb653166/Horizontal.png?format=1500w\" align=\"right\" width=\"20%\">\n",
"\n",
"**Everything is an Xarray Dataset**\n",
Expand Down
Loading