Skip to content

Commit 82057e6

Browse files
authored
Merge pull request #304 from gregordecristoforo/fix_#295
Add note for installation of missing packages in xarray lecture
2 parents 50b9541 + c3234ab commit 82057e6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

content/xarray.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ 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 command in your (JupyterLab) terminal: ::
51+
52+
conda install netcdf4 pythia-datasets -c conda-forge
53+
4854
Let us open a python shell and download a public dataset: ::
4955
5056
>>> from pythia_datasets import DATASETS
@@ -328,7 +334,7 @@ Creating your own Xarray Dataset is quite simple. We can create a Dataset from s
328334

329335
# Put everything together to create the Dataset
330336
ds = xr.Dataset(
331-
{
337+
data_vars = {
332338
"pressure": (["time", "location"], pressure_data),
333339
"humidity": (["time", "location"], humidity_data)
334340
},
@@ -338,10 +344,6 @@ Creating your own Xarray Dataset is quite simple. We can create a Dataset from s
338344
},
339345
attrs={
340346
"description": "Weather data",
341-
"units": {
342-
"pressure": "hPa",
343-
"humidity": "%"
344-
},
345347
"creation_date": "2023-01-01",
346348
"author": "Data Scientist"
347349
}
@@ -403,7 +405,7 @@ Exercises 2
403405
stock_prices = np.random.normal(loc=[100, 1500, 200], scale=[10, 50, 20], size=(10, 3))
404406
trading_volumes = np.random.randint(1000, 10000, size=(10, 3))
405407
ds = xr.Dataset(
406-
{
408+
data_vars = {
407409
"stock_price": (["time", "company"], stock_prices),
408410
"trading_volume": (["time", "company"], trading_volumes),
409411
},

0 commit comments

Comments
 (0)