Skip to content

Commit 6cd3241

Browse files
Add note for installation of missing packages
1 parent 7070624 commit 6cd3241

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

content/xarray.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ Xarray is a powerful Python library that introduces labelled multidimensional ar
4545

4646
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.
4747

48+
.. Note::
49+
50+
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 commands in your (JupyterLab) terminal: ::
51+
52+
conda install netcdf4
53+
pip install pythia_datasets
54+
4855
Let us open a python shell and download a public dataset: ::
4956
5057
>>> from pythia_datasets import DATASETS
@@ -328,7 +335,7 @@ Creating your own Xarray Dataset is quite simple. We can create a Dataset from s
328335

329336
# Put everything together to create the Dataset
330337
ds = xr.Dataset(
331-
{
338+
data_vars = {
332339
"pressure": (["time", "location"], pressure_data),
333340
"humidity": (["time", "location"], humidity_data)
334341
},
@@ -338,10 +345,6 @@ Creating your own Xarray Dataset is quite simple. We can create a Dataset from s
338345
},
339346
attrs={
340347
"description": "Weather data",
341-
"units": {
342-
"pressure": "hPa",
343-
"humidity": "%"
344-
},
345348
"creation_date": "2023-01-01",
346349
"author": "Data Scientist"
347350
}
@@ -403,7 +406,7 @@ Exercises 2
403406
stock_prices = np.random.normal(loc=[100, 1500, 200], scale=[10, 50, 20], size=(10, 3))
404407
trading_volumes = np.random.randint(1000, 10000, size=(10, 3))
405408
ds = xr.Dataset(
406-
{
409+
data_vars = {
407410
"stock_price": (["time", "company"], stock_prices),
408411
"trading_volume": (["time", "company"], trading_volumes),
409412
},

0 commit comments

Comments
 (0)