Skip to content

Commit c9bb8b5

Browse files
authored
Update tutorials (#2776)
* Tutorials: fix incorrect link & clarify * Replace references to `rose date` with `isodatetime` * Docs: automatically include hyperlinks for use in every page * GH Actions: disable docs slides build test as it doesn't work currently * Tutorials: fix mistake
1 parent 4314894 commit c9bb8b5

18 files changed

+69
-113
lines changed

.github/workflows/test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ jobs:
263263
run: |
264264
make -C sphinx/ html SPHINXOPTS='-Wn'
265265
266-
- name: build (slides)
267-
run: |
268-
make -C sphinx/ slides SPHINXOPTS='-Wn'
266+
# - name: build (slides)
267+
# run: |
268+
# make -C sphinx/ slides SPHINXOPTS='-Wn'
269269

270270
- name: build (linkcheck)
271271
run: |

pytest.ini

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ addopts =
1010
# these tests do IO, don't run them under sphinx-build rather than pytest:
1111
--ignore=metomi/rose/config.py
1212
--ignore=metomi/rose/macro.py
13+
--ignore=sphinx/conf.py
1314
testpaths =
1415
metomi/
1516
sphinx/

sphinx/api/built-in/rose_prune.rst

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.. include:: ../../hyperlinks.rst
2-
:start-line: 1
3-
41
.. _builtin.rose_prune:
52

63
``rose_prune``

sphinx/api/configuration/metadata.rst

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.. include:: ../../hyperlinks.rst
2-
:start-line: 1
3-
41
.. _floating point: https://docs.python.org/3/library/stdtypes.html#typesnumeric
52
.. _cast: https://docs.python.org/3/library/ast.html#ast.literal_eval
63
.. _Python in operator: https://docs.python.org/3/reference/expressions.html#membership-test-operations
@@ -687,15 +684,15 @@ The metadata options for a configuration fall into four categories:
687684

688685
.. _trigger-file-creation:
689686

690-
It is possible to use metadata triggers to trigger file creation,
687+
It is possible to use metadata triggers to trigger file creation,
691688
switching on/off as required.
692689

693-
For example, with the following :rose:file:`rose-app.conf` and
690+
For example, with the following :rose:file:`rose-app.conf` and
694691
:rose:file:`rose-meta.conf` files, file creation is triggered when
695-
setting ``trigger=file:foo`` to ``.true.``.
692+
setting ``trigger=file:foo`` to ``.true.``.
696693

697694

698-
:rose:file:`rose-app.conf` file:
695+
:rose:file:`rose-app.conf` file:
699696

700697
.. code-block:: rose
701698
@@ -708,7 +705,7 @@ The metadata options for a configuration fall into four categories:
708705
[namelist:foo]
709706
switch=.false.
710707
711-
:rose:file:`rose-meta.conf` file:
708+
:rose:file:`rose-meta.conf` file:
712709

713710
.. code-block:: rose
714711

sphinx/api/configuration/rose-configuration-format.rst

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.. include:: ../../hyperlinks.rst
2-
:start-line: 1
3-
41
.. _Rose Configuration Format:
52

63
Rose Configuration Format

sphinx/api/configuration/suite.rst

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.. include:: ../../hyperlinks.rst
2-
:start-line: 1
3-
41
.. _Rose Suites:
52

63
Suite Configuration

sphinx/conf.py

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
'python': ('https://docs.python.org/', None),
8484
}
8585

86+
rst_epilog = open('hyperlinks.rst', 'r').read()
87+
8688
# Slide (hieroglyph) settings.
8789
slide_theme = 'single-level'
8890
slide_link_to_html = True

sphinx/getting-started.rst

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. include:: hyperlinks.rst
2-
:start-line: 1
3-
4-
51
Getting Started
62
===============
73

@@ -29,7 +25,7 @@ configuration file ``~/.metomi/rose.conf``:
2925

3026
``[external]geditor``
3127
The external text editor used by GUIs
32-
``[external]editor``
28+
``[external]editor``
3329
The external text editor used by CLI commands
3430

3531
For emacs and most text editors, you can do something like:

sphinx/glossary.rst

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.. include:: hyperlinks.rst
2-
:start-line: 1
3-
41
Glossary
52
========
63

sphinx/hyperlinks.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
.. This document contains hyperlink references to be used throughout the
44
documentation.
55
6-
To use hyperlinks defined in this file add the following code at the top of
7-
the file::
8-
9-
.. include:: path/to/thisfile.rst
10-
:start-line: 1
6+
They are automatically included for use in every page (via conf.py)
117
128
.. _Cylc: https://cylc.github.io/
139
.. _Cylc Flow: https://github.com/cylc/cylc-flow
1410
.. _Cylc Rose: https://github.com/cylc/cylc-rose
1511
.. _Cylc User Guide: https://cylc.github.io/cylc-doc/stable/html/user-guide/index.html
1612
.. _Cylc Workflow Design Guide: https://cylc.github.io/cylc-doc/stable/html/workflow-design-guide/index.html
13+
.. _isodatetime: https://github.com/metomi/isodatetime
1714

1815
.. _EmPy: https://pypi.org/project/empy/
1916
.. _extglob pattern matching: https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html#Pattern-Matching

sphinx/index.rst

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.. include:: hyperlinks.rst
2-
:start-line: 1
3-
41
.. ifnotslides::
52

63
.. raw:: html

sphinx/installation.rst

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. include:: hyperlinks.rst
2-
:start-line: 1
3-
4-
51
Installation
62
============
73

@@ -121,27 +117,27 @@ Check the following:
121117
1. You can access the Rosie Subversion repository without being prompted
122118
for a username and a password. This may require configuring Subversion
123119
to cache your authentication information with a keyring.
124-
120+
125121
*(See Subversion Book > Advanced Topics > Network Model > Client
126122
Credentials for a discussion on how to do this.)*
127123

128124
2. The Rosie web service is up and running and you can access the Rosie
129125
web service from your computer. E.g. if the Rosie web service is
130126
hosted at ``https://somehost.on.the.internet/rosie/x``, you can check
131127
that you have access by typing the following on the command line::
132-
128+
133129
curl -I https://somehost.on.the.internet/rosie/x
134-
130+
135131
It should return a HTTP code 200. If you are prompted for a username
136132
and a password, you may need to have access to a keyring to cache
137133
the authentication information.
138134

139135
3. You can access the Rosie web service using the Rosie client. E.g.
140136
using the above configuration for the prefix ``x``, type the
141137
following on the command line::
142-
138+
143139
rosie hello --prefix=x
144-
140+
145141
It should return a greeting, e.g. ``Hello user``.
146142

147143

sphinx/tutorial/rose/applications.rst

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.. include:: ../../hyperlinks.rst
2-
:start-line: 1
3-
41

52
.. _tutorial-rose-applications:
63

@@ -136,7 +133,8 @@ An application can be run using the :ref:`command-rose-app-run` command:
136133
.. ifslides::
137134

138135
.. rubric:: In this practical we will convert the ``forecast`` task from the
139-
:ref:`weather-forecasting workflow <tutorial-datetime-cycling-practical>`
136+
weather-forecasting workflow in the
137+
:ref:`Cylc tutorials <tutorial-cylc-runtime-forecasting-workflow>`
140138
into a Rose application.
141139

142140
Next section: :ref:`tutorial-rose-metadata`
@@ -147,8 +145,11 @@ An application can be run using the :ref:`command-rose-app-run` command:
147145
.. practical::
148146

149147
.. rubric:: In this practical we will convert the ``forecast`` task from the
150-
:ref:`weather-forecasting workflow <tutorial-datetime-cycling-practical>`
151-
into a standalone Rose application.
148+
weather-forecasting workflow in the
149+
:ref:`Cylc tutorials <tutorial-cylc-runtime-forecasting-workflow>`
150+
into a standalone Rose application. By the end you will be able to run
151+
the application standalone (running it as a task in the workflow will
152+
come later).
152153

153154
Create a directory on your filesystem called ``rose-tutorial``::
154155

@@ -166,8 +167,7 @@ An application can be run using the :ref:`command-rose-app-run` command:
166167
#. **Provide the required resources in the** ``application-tutorial``
167168
**application.**
168169

169-
The application gets three resources from different places in the
170-
:ref:`weather-forecasting workflow <tutorial-datetime-cycling-practical>`:
170+
The application gets three resources from different places:
171171

172172
* The ``bin/forecast`` script.
173173
* The ``lib/python/util.py`` Python library.
@@ -227,17 +227,15 @@ An application can be run using the :ref:`command-rose-app-run` command:
227227
#. **Move environment variables defined in the** ``flow.cylc`` **file.**
228228

229229
In the ``[runtime][forecast][environment]`` section of the ``flow.cylc``
230-
file in the
231-
:ref:`weather-forecasting workflow <tutorial-datetime-cycling-practical>`
232-
we set a few environment variables:
230+
file in the weather-forecasting workflow we set a few environment variables:
233231

234232
* ``WIND_FILE_TEMPLATE``
235233
* ``WIND_CYCLES``
236234
* ``RAINFALL_FILE``
237235
* ``MAP_FILE``
238236
* ``MAP_TEMPLATE``
239237

240-
We will now move these into the application. This way, all of the
238+
We will now add these into the application. This way, all of the
241239
configuration specific to the application live within it.
242240

243241
Add the following lines to the :rose:conf:`rose-app.conf[env]` section:
@@ -263,8 +261,8 @@ An application can be run using the :ref:`command-rose-app-run` command:
263261
variables are pointing at files in the ``test-data`` directory.
264262

265263
To make this application work outside of the weather forecasting workflow
266-
we will also need to
267-
provide the ``DOMAIN`` and ``RESOLUTION`` environment variables defined
264+
we will also need to provide the ``DOMAIN`` and ``RESOLUTION``
265+
environment variables that were defined
268266
in the ``[runtime][root][environment]`` section of the ``flow.cylc``
269267
file as well as the ``CYLC_TASK_CYCLE_POINT`` environment variable
270268
provided by Cylc when it runs a task.

sphinx/tutorial/rose/furthertopics/date-time-manipulation.rst

+21-25
Original file line numberDiff line numberDiff line change
@@ -4,73 +4,69 @@ Date and Time Manipulation
44
==========================
55

66
:term:`Datetime cycling <datetime cycling>` suites inevitably involve
7-
performing some form of datetime arithmetic. In the
8-
:ref:`weather forecasting suite <tutorial-datetime-cycling-practical>` we wrote
9-
in the Cylc tutorial this arithmetic was done using the ``cylc cyclepoint``
10-
command. For example we calculated the cycle point three hours before the
7+
performing some form of datetime arithmetic. For example, in a Cylc task we
8+
can calculate the cycle point three hours before the
119
present cycle using::
1210

1311
cylc cyclepoint --offset-hours=-3
1412

15-
Rose provides the :ref:`command-rose-date` command which provides functionality
16-
beyond ``cylc cyclepoint`` as well as the :envvar:`ROSE_DATAC` environment
13+
The `isodatetime`_ command provides functionality
14+
beyond ``cylc cyclepoint``. Rose also provides the :envvar:`ROSE_DATAC` environment
1715
variable which provides an easy way to get the path of the ``share/cycle``
1816
directory.
1917

2018

21-
The ``rose date`` Command
22-
-------------------------
19+
The ``isodatetime`` Command
20+
---------------------------
2321

24-
The :ref:`command-rose-date` command provides functionality for:
22+
The ``isodatetime`` command provides functionality for:
2523

2624
* Parsing and formatting datetimes e.g:
2725

2826
.. code-block:: console
2927
30-
$ rose date '12-31-2000' --parse-format='%m-%d-%Y'
28+
$ isodatetime 12-31-2000 --parse-format='%m-%d-%Y'
3129
12-31-2000
32-
$ rose date '12-31-2000' --parse-format='%m-%d-%Y' --format='DD-MM-CCYY'
30+
$ isodatetime 12-31-2000 --parse-format='%m-%d-%Y' --format='DD-MM-CCYY'
3331
31-12-2000
3432
3533
* Adding offsets to datetimes e.g:
3634

3735
.. code-block:: console
3836
39-
$ rose date '2000-01-01T0000Z' --offset '+P1M'
40-
2000-02-01T0000Z
37+
$ isodatetime 2000-01-01T00:00Z --offset '+P1M'
38+
2000-02-01T00:00Z
4139
4240
* Calculating the duration between two datetimes e.g:
4341

4442
.. code-block:: console
4543
46-
$ rose date '2000' '2001' # Note - 2000 was a leap year!
44+
$ isodatetime 2000 2001 # Note - 2000 was a leap year!
4745
P366D
4846
49-
See the :ref:`command-rose-date` command reference for more information.
47+
See the ``isodatetime --help`` command reference for more information.
5048

5149

52-
Using ``rose date`` In A Suite
53-
------------------------------
50+
Using ``isodatetime`` In A Suite
51+
--------------------------------
5452

55-
In datetime cycling suites :ref:`command-rose-date` can work with the
53+
In datetime cycling suites, ``isodatetime`` can work with the
5654
cyclepoint using the ``CYLC_TASK_CYCLE_POINT`` environment variable:
5755

5856
.. code-block:: cylc
5957
6058
[runtime]
6159
[[hello_america]]
62-
script = rose date $CYLC_TASK_CYCLE_POINT --format='MM-DD-CCYY'
60+
script = isodatetime $CYLC_TASK_CYCLE_POINT --format='MM-DD-CCYY'
6361
64-
Alternatively, if you are providing the standard Rose task environment using
65-
:ref:`command-rose-task-env` then :ref:`command-rose-date` can use the ``-c``
66-
option to pick up the cycle point:
62+
Alternatively, Cylc automatically sets the ``ISODATETIMEREF`` environment variable
63+
which allows you to use the special ``ref`` argument:
6764

6865
.. code-block:: cylc
6966
7067
[runtime]
7168
[[hello_america]]
72-
env-script = eval $(rose task-env)
73-
script = rose date -c --format='MM-DD-CCYY'
69+
script = isodatetime ref --format='MM-DD-CCYY'
7470
7571
7672
The ``ROSE_DATAC`` Environment Variable
@@ -118,4 +114,4 @@ provide an offset to :ref:`command-rose-task-env` e.g::
118114

119115
The path is then made available as the ``ROSE_DATACPT1H`` environment variable.
120116

121-
.. TODO - Write a short practical using ROSE_DATAC and rose-date.
117+
.. TODO - Write a short practical using ROSE_DATAC and isodatetime.

sphinx/tutorial/rose/furthertopics/optional-configurations.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ You should see the following:
131131

132132
.. code-block:: none
133133
134-
I'd like to order a chocolate icecream in a tub with nuts.
134+
I'd like to order a chocolate ice cream in a tub with nuts.
135135
136136
The ``chocolate`` configuration has overwritten the ``FLAVOUR`` environment
137137
variable from the ``fudge sundae`` configuration. This is because optional
@@ -142,7 +142,7 @@ To see how the optional configurations would be applied use the
142142
:ref:`command-rose-config` command providing the configuration files in the
143143
order they would be loaded::
144144

145-
rose config --file rose-app.conf --file opt/rose-app-fudge-sundae --file chocolate
145+
rose config --file rose-app.conf --file opt/rose-app-fudge-sundae.conf --file opt/rose-app-chocolate.conf
146146

147147
You should see:
148148

sphinx/tutorial/rose/rosie.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.. include:: ../../hyperlinks.rst
2-
:start-line: 1
3-
41
.. _tutorial-rosie:
52

63
Rosie
@@ -146,7 +143,7 @@ Rosie provides commands for managing suites, including:
146143
.. ifslides::
147144

148145
.. rubric:: In this practical we will add the
149-
:ref:`weather-forecasting suite <tutorial-datetime-cycling-practical>`
146+
weather-forecasting suite
150147
from the :ref:`previous practical <suites-practical>` to a rosie
151148
repository, make some changes, and commit them to the repository.
152149

@@ -156,7 +153,7 @@ Rosie provides commands for managing suites, including:
156153
.. practical::
157154

158155
.. rubric:: In this practical we will add the
159-
:ref:`weather-forecasting suite <tutorial-datetime-cycling-practical>`
156+
weather-forecasting suite
160157
from the :ref:`previous practical <suites-practical>` to a rosie
161158
repository, make some changes, and commit them to the repository.
162159

0 commit comments

Comments
 (0)