Skip to content

Commit 94e45fe

Browse files
authored
Suggest users prefer CYLC_TASK_SHARE_CYCLE_DIR to ROSE_DATAC (#2782)
1 parent 98d449a commit 94e45fe

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

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

+24-13
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ present cycle using::
1111
cylc cyclepoint --offset-hours=-3
1212

1313
The `isodatetime`_ command provides functionality
14-
beyond ``cylc cyclepoint``. Rose also provides the :envvar:`ROSE_DATAC` environment
15-
variable which provides an easy way to get the path of the ``share/cycle``
16-
directory.
14+
beyond ``cylc cyclepoint``. Cylc also provides the ``CYLC_TASK_SHARE_CYCLE_DIR``
15+
environment variable which provides an easy way to get the path of the
16+
``share/cycle/<point>`` directory.
1717

1818

1919
The ``isodatetime`` Command
@@ -72,6 +72,11 @@ which allows you to use the special ``ref`` argument:
7272
The ``ROSE_DATAC`` Environment Variable
7373
---------------------------------------
7474

75+
.. note::
76+
77+
From Cylc 8.5.0 the variable ``CYLC_TASK_SHARE_CYCLE_DIR`` should be preferred
78+
to ``ROSE_DATAC``.
79+
7580
There are two locations where task output is likely to be located:
7681

7782
The work directory
@@ -96,22 +101,28 @@ The share directory
96101
<run directory>/share/cycle/<cycle>
97102
98103
These are called the ``share/cycle`` directories.
99-
100-
The path to the root of the share directory is provided by the
101-
``CYLC_WORKFLOW_SHARE_DIR`` environment variable so the path to the cycle
102-
subdirectory would be::
104+
``CYLC_TASK_SHARE_CYCLE_DIR`` provides the path to::
103105

104106
"$CYLC_WORKFLOW_SHARE_DIR/cycle/$CYLC_TASK_CYCLE_POINT"
105107

106-
The :ref:`command-rose-task-env` command provides the environment variable
107-
:envvar:`ROSE_DATAC` which is a more convenient way to obtain the path of the
108-
``share/cycle`` directory.
109108

110109
To get the path to a previous (or a future) ``share/cycle`` directory we can
111-
provide an offset to :ref:`command-rose-task-env` e.g::
110+
provide an offset to isodatetime:
111+
112+
.. code-block:: bash
113+
114+
isodatetime "${CYLC_TASK_CYCLE_POINT} --offset -P1D
115+
116+
Which can be used to provide custom offset directory locations:
117+
118+
.. code-block:: bash
119+
120+
# Cylc task script
121+
CYCLE_POINT_MINUS_P1D=$(isodatetime "${CYLC_TASK_CYCLE_POINT} --offset -P1D)"
112122
113-
rose task-env --cycle-offset=PT1H
123+
TODAYS_DATA="${CYLC_WORKFLOW_SHARE_DIR}/cycle/${CYLC_TASK_CYCLE_POINT}/output.data"
124+
YESTERDAYS_DATA="${CYLC_WORKFLOW_SHARE_DIR}/cycle/${CYCLE_POINT_MINUS_P1D}/output.data"
114125
115-
The path is then made available as the ``ROSE_DATACPT1H`` environment variable.
126+
# Do something with "${YESTERDAYS_DATA}" and "${TODAYS_DATA}"
116127
117128
.. TODO - Write a short practical using ROSE_DATAC and isodatetime.

0 commit comments

Comments
 (0)