This file is indexed.

/usr/share/doc/grads/html/offt.html is in grads 2:2.0.1-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!--Copyright (C) 1988-2005 by the Institute of Global Environment and Society (IGES). See file COPYRIGHT for more information.-->

<html>
<head>
<title>Expression Evaluation Using "offt" Dimension Override</title>
<link href="../../assets/NewIGES.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #990000}
body {
	background-color: #e0f0ff;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></head>
<body
 text="#000000">


<h2>Expression Evaluation Using "offt" Dimension Override</h2>
<h4>
<a href="#intro">Motivation</a><br>
<a href="#syntax">Syntax</a><br>
  <a href="#tfixed">A Diagonal Slice</a><br>
  <a href="#tvarying">A Time-Varying Diagonal Slice</a><br>
  <a href="#func">Applying a Function Over a Time-Varying Diagonal Slice</a><br>

  <br>
</h4>
<hr>

<h3><a name="intro"></a>Motivation</h3>
<p>The time axis in the GrADS environment is a simple, linear, one-dimensional object, defined by its start time, a time increment, and its length. The ensemble axis in the GrADS environment is also a linear, one-dimensional object, but it can become complicated when the metadata for individual ensemble members is time axis related. Such is the case when individual ensemble members have a start time and a length that is different from the defined time axis. For these kinds of data sets, the notion of &quot;initial time&quot; takes on a subtlety: clarifying the difference between the first time step in the defined time axis, and the first time step for an individual member. </p>
<h3><a name="syntax"></a>Syntax</h3>
<p>Beginning with version 2.0.a7, GrADS has a new interface for making the clarification between absolute time axis indices and indices that are offsets from an ensemble member's initial time. It has been implemented in the expression syntax as part of a <a href="variable.html#names">complete variable declaration</a>, which has three components: </p>
<ul>
  <p><code>abbrev.file#(dimexpr,dimexpr,...)</code>&nbsp;&nbsp;&nbsp; where: </p>

  <ul>
    <code>abbrev&nbsp;&nbsp;&nbsp;</code>is the abbreviation for the variable as
    specified in the
    data descriptor file
    <br />
    <code>file#&nbsp;&nbsp;&nbsp;&nbsp;</code>is the file number that contains
      this variable.  If <code>file#</code> is absent, GrADS assumes the default file number. <br />
      <code>dimexpr&nbsp;&nbsp;</code>is a dimension expression that locally
      modifies the current dimension environment.
</ul>
</ul>
<p>The new interface allows a <code>dimexpr</code> that specifies an offset
from the variable's initial time (which may be different for each ensemble member). The syntax is &quot;<code>offt</code>&quot; followed by &quot;<code>=/+/-</code>&quot; followed by an offset value. </p>
<p>The  &quot;<code>offt</code>&quot; dimension override is currently supported only for variables associated with a data file -- it will not work with defined variables or for dimension expressions given as arguments to functions such as <code><a href="gradfuncave.html">ave</a></code> or <code><a href="gradfuncsum.html">sum</a></code>. </p>
<h3><a name="tfixed"></a>A Diagonal Slice </h3>
<p>For the purposes of explaining how to use expressions that employ the &quot;<code>offt</code>&quot; dimension override, we use a lag ensemble data set that contains 10 members. Each member is a 96-hour forecast, with output every 6 hours, and initialized at 12-hour intervals. The figure below illustrates the coverage of all 10 members in the Time-Ensemble domain; the rainbow colored boxes represent indivual time steps in each member. 
<p>Suppose you want to extract the 12-hour precipitation forecast from each ensemble member -- this is the third time step from the initial time of each forecast, which would be a diagonal slice through the domain, highlighted in the figure below with a solid black outline:
<p><img src="offt_diag.png" alt="edemo1">

<p>The first step is to set the time dimension to a fixed value by using 'set time' or 'set t' and set the ensemble dimension to include all the desired members:<br>
<code>&nbsp;&nbsp;&nbsp;'set t 1'<br>
&nbsp;&nbsp;&nbsp;'set e 1 10'</code>
<p>Next, determine the offset value that will give you the time index you desire. In this example, we want the third time step, which is an offset of two from the initial time, so our offset value is 2. (If you want the first time step of each member, the offset value would be zero.) Now display the variable, using parentheses attached to the variable name to override the time dimension value,  specifying &quot;<code>offt=</code>&quot; with the offset value:<br>
<code>&nbsp;&nbsp;&nbsp;'d p(offt=2)'</code>
<p> GrADS will retrieve the third valid time step from each ensemble member (GrADS knows the start time of each member because that information is provided in the EDEF entry of the data descriptor file). GrADS then aligns all the retrieved values into a single column and returns a result grid with a fixed T  and a varying E dimension:
<p><img src="offt_1D_t1.png" alt="offt_t1">
<p>Note that the original valid time of the precipitation value from each member is not  retained ... the new valid time associated with this result is taken from the current dimension environment. In this example, the new valid time is first time step in the data set, since the time dimension had been fixed with the <code>'set t 1'</code> command.
<p>
<h3><a name="tvarying"></a>A Time-Varying Diagonal Slice</h3>
<p>Now we expand our data request to include more than one time step. Suppose you want to extract the precipitation values over  the first 24 hours of each ensemble member -- you need the second, third, fourth, and fifth time step from each forecast. This request would be a time-varying diagonal slice through the domain, highlighted in the figure below with a solid black outline:
<p><img src="offtv_diag.png" alt="offtv_diag">
<p>This is accomplished by using the <code><a href="gradfunctloop.html">tloop</a></code> function with an expression that contains the   &quot;<code>offt</code>&quot; dimension override. Begin by setting time to be a varying dimension in the dimension environment. The ensemble dimension is also set to include all desired members: <br>
<code> &nbsp;&nbsp;&nbsp;'set t 1 4'<br>
 &nbsp;&nbsp;&nbsp;'set e 1 10'</code>
<p>The <code><a href="gradfunctloop.html">tloop</a></code> function will evaluate the expression at fixed times, then reconstruct the time series to obtain a final result that is time varying.
At each step, when <code><a href="gradfunctloop.html">tloop</a></code> is evaluating the expression at a fixed time, it will override the time dimension value with a time offset value instead. The tricky part is creating the   &quot;<code>offt</code>&quot; dimension override expression, which must be relative to the T index of the dimension environment. In our example, want the second, third, fourth, and fifth time steps which correspond to offset values of 1, 2, 3, and 4. Thus, our offset values are equivalent to the T index values of our set dimension environment, so the final expression will be: <br>
<code> &nbsp;&nbsp;&nbsp;'d tloop(p(offt+0))'</code>
<p>The dimension override expression, in this case   &quot;<code>offt+0</code>&quot;, is a kind of formula for calculating the offset value using the current t value of the dimension environment. In this case, when t=1, the offset value will be t+0 or 1; when t=2, the offset value will be t+0 or 2; etc. This will achieve the desired result -- as <code><a href="gradfunctloop.html">tloop</a></code> builds the time-varying result, it steps through the desired offset values, retrieving the second, third, fourth, and fifth timesteps of each ensemble member, and stacking them in an aligned grid:
<p><img src="offtv_1D.png" alt="offtv_1d">

<p>Note that if the dimension override expression contained   &quot;<code>offt=0</code>&quot;, then this would indicate a straightforward assignment of the time offset value that does not depend on the current dimension environment. When using <code><a href="gradfunctloop.html">tloop</a></code> to retrieve a time-varying diagonal slice, the   &quot;<code>offt</code>&quot; dimension override must be a relative expression (i.e. &quot;+/-value&quot;) instead of an assignment expression (i.e. &quot;=value&quot;), otherwise GrADS will retrieve the same offset value for each time step -- this would not be the desired result. 
<h3><a name="func" id="func"></a>Applying a Function Over a Time-Varying Diagonal Slice</h3>
<p>Now we take our time-varying example one step further. Suppose you want to calculate the accumulated precipitation  over  the first 24 hours of each ensemble member -- you need to add the second, third, fourth, and fifth time step from each forecast, which would require summing over the time-varying diagonal slice discussed in the previous section. One way to do this is to create a defined variable that contains the time-varying aligned grid with <code><a href="gradfunctloop.html">tloop</a></code> (as described above), then <code><a href="gradfuncsum.html">sum</a></code> over that defined variable:<br>
  <code>&nbsp;&nbsp;&nbsp;'set t 1 4'<br>
&nbsp;&nbsp;&nbsp;'set e 1 10'</code><br>
<code>&nbsp;&nbsp;&nbsp;'define pnew = tloop(p(offt+0))'<br>
&nbsp;&nbsp;&nbsp;'set t 1'<br>
&nbsp;&nbsp;&nbsp;'d sum(pnew,t=1,t=4)'</code><br>
<p>A more elegant and economical way to achieve the same result is to let the  <code><a href="gradfuncsum.html">sum</a></code> function do the work that the <code><a href="gradfunctloop.html">tloop</a></code> function would do -- <code><a href="gradfuncsum.html">sum</a></code> loops over each time evaluating the expression at a fixed time and returns the sum of all values: <br>
  <code>&nbsp;&nbsp;&nbsp;'set t 1'<br>
&nbsp;&nbsp;&nbsp;'set e 1 10'</code><code><br>
&nbsp;&nbsp;&nbsp;'d sum(p(offt+0),t=1,t=4)'</code>
<p>Remember that the  &quot;<code>offt</code>&quot; dimension override is  supported only for variables associated with a data file -- it will not work with defined variables or for dimension expressions given as arguments to functions such as <code><a href="gradfuncave.html">ave</a></code> or <code><a href="gradfuncsum.html">sum</a></code>. The following expression will return an error message:<br>
<code>&nbsp;&nbsp;&nbsp;'d sum(p,offt=1,offt=4)' <span class="style1">&lt;=== THIS IS INCORRECT</span></code>
<p>
<p>

<p>

</body>
</html>