Skip to content

Commit 875e3a1

Browse files
committed
episode update
1 parent 6f4e6c7 commit 875e3a1

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

_episodes/11-esmvalcoreapi.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "ESMValCore API in a Jupyter notebook"
2+
title: "What is ESMValCore API and using it in a Jupyter notebook"
33
teaching: 20
44
exercises: 30
55
compatibility: ESMValTool, ESMValCore v2.11.0
@@ -17,22 +17,55 @@ keypoints:
1717
- "Use `datasets_to_recipe` helper to start making recipes"
1818
---
1919

20-
In this episode we will introduce the ESMValCore API in a jupyter notebook. This is reformatted
20+
In this episode we will introduce the ESMValCore API in a jupyter notebook. ESMValTool acts as a
21+
wrapper and collection of recipes and diagnostics and CMORisers for observations that is built on
22+
top of ESMValCore which has the core functionality. This episode is reformatted
2123
from material from this [blog post][easy-ipcc-blog]{:target="_blank"}
2224
by Peter Kalverla. There's also material from the
2325
[example notebooks][docs-notebooks]{:target="_blank"} and the
2426
[API reference documentation][api-reference]{:target="_blank"}.
2527

2628
## Start JupyterLab
2729
A [jupyter notebook](https://jupyter.org/){:target="_blank"} is an interactive document where
28-
you can run code.
30+
you can run code. If using a HPC server they may provide a service which can start up an interactive job
31+
with Jupyter running for you which is convenient for this exercise, for example,
32+
[ARE](https://opus.nci.org.au/spaces/Help/pages/162431120/ARE+User+Guide) at NCI's Gadi in Australia or
33+
[Jupyterhub@DKRZ](https://docs.dkrz.de/doc/software%26services/jupyterhub/index.html).
2934
You will need to use a python environment with ESMValTool and ESMValCore installed.
3035

36+
## Configuration in the notebook
37+
38+
We can look at the default user configuration file, by default found in `~/.esmvaltool/config-user.yml`
39+
by calling a `CFG` object as a dictionary structure. This gives us the ability to edit the settings.
40+
The tool can automatically download the climate data files required to run a recipe for you.
41+
You can check your download directory and output directory where your recipe runs will be saved.
42+
This `CFG` object is from the `config` module in the ESMValCore API, for more details see [here][api-config].
43+
44+
> Call the `CFG` object in a Jupyter notebook and inspect the values.
45+
> > ## Solution
46+
> > ```python
47+
> > from esmvalcore.config import CFG
48+
> > # call CFG object like this
49+
> > CFG
50+
> > ```
51+
> {: .solution}
52+
> Check output directory and change
53+
> > ## Solution
54+
> >
55+
> > ```python
56+
> > print(CFG['output_dir'])
57+
> > # edit directory
58+
> > CFG['output_dir'] = '/scratch/$USERNAME/esmvaltool_outputs'
59+
> > ```
60+
> {: .solution}
61+
{: .challenge}
62+
3163
## Find Datasets with facets
3264
We have seen from running available recipes that ESMValTool is able to find data from facets that
3365
were given in the recipe. We can use this in a Notebook, including filling out the facets for
3466
data definition.
35-
To do this we will use the `Dataset` object from the API. Let's look at this example.
67+
To do this we will use the `Dataset` object from the API. Let's look at this example which you
68+
can copy to a Jupyter notebook.
3669
3770
```python
3871
from esmvalcore.dataset import Dataset

0 commit comments

Comments
 (0)