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

Add note for installation of missing packages in xarray lecture #304

Merged
merged 3 commits into from
Nov 4, 2024
Merged
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
14 changes: 8 additions & 6 deletions content/xarray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ Xarray is a powerful Python library that introduces labelled multidimensional ar

We will first download a dataset similar to the example above to illustrate the advantages of Xarray. We will cover how to transform your own data into an Xarray Dataset later in this lecture.

.. Note::

If you have set up your ``python-for-scicomp`` environment yesterday or earlier, you need to install the packages ``netcdf4`` and ``pythia_datasets`` manually. You can do this by running the following command in your (JupyterLab) terminal: ::

conda install netcdf4 pythia-datasets -c conda-forge

Let us open a python shell and download a public dataset: ::

>>> from pythia_datasets import DATASETS
Expand Down Expand Up @@ -328,7 +334,7 @@ Creating your own Xarray Dataset is quite simple. We can create a Dataset from s

# Put everything together to create the Dataset
ds = xr.Dataset(
{
data_vars = {
"pressure": (["time", "location"], pressure_data),
"humidity": (["time", "location"], humidity_data)
},
Expand All @@ -338,10 +344,6 @@ Creating your own Xarray Dataset is quite simple. We can create a Dataset from s
},
attrs={
"description": "Weather data",
"units": {
"pressure": "hPa",
"humidity": "%"
},
"creation_date": "2023-01-01",
"author": "Data Scientist"
}
Expand Down Expand Up @@ -403,7 +405,7 @@ Exercises 2
stock_prices = np.random.normal(loc=[100, 1500, 200], scale=[10, 50, 20], size=(10, 3))
trading_volumes = np.random.randint(1000, 10000, size=(10, 3))
ds = xr.Dataset(
{
data_vars = {
"stock_price": (["time", "company"], stock_prices),
"trading_volume": (["time", "company"], trading_volumes),
},
Expand Down
Loading