@@ -188,10 +188,10 @@ There are four main sections in the script:
188188>> that holds all the necessary
189189>> information needed to run the diagnostic script such as the location of input
190190>> data and various settings. We will next parse this `` cfg`` variable
191- >> in the `` main`` function and extract information as needed
191+ >> in the `` main`` function and extract information as needed
192192>> to do our analyses (e.g. in line 69 ).
193193>> 3 . The `` main`` function is called near the very end on line 107 . So, it is mentioned
194- >> twice in our code - once where it is called by the top- level Python script and
194+ >> twice in our code - once where it is called by the top- level Python script and
195195>> second where it is defined.
196196> {: .solution}
197197{: .challenge}
@@ -220,7 +220,7 @@ The ESMValTool documentation page provides an overview of what is in this file,
220220> then run the recipe `` recipe_python.yml`` :
221221>
222222> ~~~ bash
223- > esmvaltool run recipe_example.yml
223+ > esmvaltool run examples / recipe_example.yml
224224> ~~~
225225>
226226> 1 . Find one example of the file `` settings.yml`` in the `` run`` directory?
@@ -251,7 +251,7 @@ ESMValTool provides many functions such as ``select_metadata`` (line 72),
251251`` sorted_metadata`` (line 76 ), and `` group_metadata`` (line 80 ). As you can see
252252in line 8 , these functions are imported from `` esmvaltool.diag_scripts.shared``
253253that means these are shared across several diagnostics scripts. A list of
254- available functions and their description can be found in
254+ available functions and their description can be found in
255255[The ESMValTool Diagnostic API reference][shared].
256256
257257
@@ -324,9 +324,9 @@ available functions and their description can be found in
324324
325325# # Diagnostic computation
326326
327- After grouping and selecting data, we can read individual attributes (such as filename)
328- of each item. Here we have grouped the input data by `` variables``
329- so we loop over the variables (line 89 - 93 ). Following this, is a call to the
327+ After grouping and selecting data, we can read individual attributes (such as filename)
328+ of each item. Here we have grouped the input data by `` variables``
329+ so we loop over the variables (line 89 - 93 ). Following this, is a call to the
330330function `` compute_diagnostic`` (line 94 ). Let' s have a look at the
331331definition of this function in line 43 where the actual analysis on the data is done.
332332
@@ -335,7 +335,7 @@ Here, ``compute_diagnostic`` uses
335335[Iris](https:// scitools- iris.readthedocs.io/ en/ latest/ index.html) to read data
336336from a netCDF file and performs an operation `` squeeze`` to remove any dimensions
337337of length one. We can adapt this function to add our own analysis. As an
338- example, here we calculate the bias using the average of the data using Iris cubes.
338+ example, here we calculate the bias using the average of the data using Iris cubes.
339339
340340~~~ python
341341def compute_diagnostic (filename ):
@@ -390,7 +390,7 @@ def compute_diagnostic(filename):
390390
391391> # # Reading data using the netCDF4 package
392392>
393- > Yet another option to read the NetCDF file data is to use
393+ > Yet another option to read the NetCDF file data is to use
394394> the [netCDF- 4 Python interface][netCDF] to the netCDF C library.
395395>
396396>> # # Answer
@@ -442,7 +442,7 @@ there:
442442```
443443
444444This way, we can pass arguments such as the type of
445- plot `` pcolormesh`` and the colormap `` cmap:Reds`` from the recipe to the
445+ plot `` pcolormesh`` and the colormap `` cmap:Reds`` from the recipe to the
446446`` quickplot`` function in the diagnostic.
447447
448448> # # Passing arguments from the recipe to the diagnostic
@@ -476,25 +476,25 @@ plot ``pcolormesh`` and the colormap ``cmap:Reds`` from the recipe to the
476476
477477In our example, the function `` save_data`` in line 57 is used to save the Iris
478478cube. The saved files can be found under the `` work`` directory in a `` .nc`` format .
479- There is also the function `` save_figure`` in line 63 to save the plots under the
480- `` plot`` directory in a `` .png`` format (or preferred format specified in your
479+ There is also the function `` save_figure`` in line 63 to save the plots under the
480+ `` plot`` directory in a `` .png`` format (or preferred format specified in your
481481configuration settings). Again, you may choose your own method
482- of saving the output.
482+ of saving the output.
483483
484484# ## Recording the provenance
485485
486486When developing a diagnostic script, it is good practice to record
487487provenance. To do so, we use the function `` get_provenance_record`` (line 99 ).
488488Let us have a look at the definition of this function in line 21 where we
489489describe the diagnostic data and plot. Using the dictionary `` record`` , it is
490- possible to add custom provenance to our diagnostics output.
490+ possible to add custom provenance to our diagnostics output.
491491Provenance is stored in the * W3C PROV XML *
492492format and also in an * SVG * file under the `` work`` and `` plot`` directory. For
493493more information, see [recording provenance][provenance].
494494
495495# # Congratulations!
496496
497- You now know the basic diagnostic script structure and some available tools for putting
498- together your own diagnostics. Have a look at existing recipes and diagnostics in the
497+ You now know the basic diagnostic script structure and some available tools for putting
498+ together your own diagnostics. Have a look at existing recipes and diagnostics in the
499499repository for more examples of functions you can use in your diagnostics!
500500{% include links.md % }
0 commit comments