Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 28842e744495811080ce537d0b6dab00 > files > 49

grads-2.0.a9-0.2.fc15.i686.rpm

<!--Copyright (C) 1988-2005 by the Institute of Global Environment and Society (IGES). See file COPYRIGHT for more information.--><style type="text/css">
<!--
body {
	background-color: #e0f0ff;
}
.style1 {color: #990000}
-->
</style>

<h1>Expressions</h1>

A GrADS expression consists of operators, operands, and
parentheses.  Parentheses are used to
control the order of operation.
<p>

Operators are:


<ul>
<code>+</code>&nbsp;&nbsp;&nbsp; Addition <br>
<code>-</code>&nbsp;&nbsp;&nbsp; Subtraction <br>
<code>*</code>&nbsp;&nbsp;&nbsp; Multiplication <br>
<code>/</code>&nbsp;&nbsp;&nbsp; Division</ul><p>

Operands are:


<dd><code><a href="variable.html">variable specifications</a>, <a href="functions.html">functions</a>, and constants</code>.
  <p>

Operations between two variables are done on equivalent grid points in each grid. 
Missing data values in either grid give a result of a missing
data value at that grid point.  Dividing by zero gives a result
of a missing data value at that grid point.<p>

Operations cannot be done between grids that have different
scaling in their varying dimensions -- i.e., grids that have
different rules for converting the varying dimensions from grid
space to world coordinate space.  This can only be encountered
when you are attempting operations between grids from different
files that have different scaling rules.
<p>

If one grid has more varying dimensions than the other, the grid
with fewer varying dimensions     is 'expanded' and the operation
is performed.
<p>Expression evaluation in GrADS is recursive, so that multiple expressions may be nested together. 
<p>(<span class="style1">GrADS version 2.0.a7+</span>) Variable specifications can include a dimension expression to set time as an <a href="offt.html">offset</a> from the variable's initial time. 

<p>

Some examples of expressions:

<ul>
<code>slp/100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code>(Convert sea level pressure units from hPa to mb)<br>
<code>z-z(t-1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code>(Height change over one time step)<br>
<code>z-z(offt=0)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code>(Height change since initial time)<br>
<code>t(lev=500)-t(lev=850)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code>(Temp difference between 500
and 850mb)<br>
<code>ave(z,t=1,t=5)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code>(Average of z over first 5 times in file) <br>
<code>sum(prec(offt+0),t=1,t=4)&nbsp;&nbsp;&nbsp;</code>(Accumulated precipitation -- sum of 2nd through 5th time steps in file) <br>
<code>z-ave(z,lon=0,lon=360,-b)&nbsp;&nbsp;&nbsp;</code>(Remove zonal mean)<br>
<code>tloop(aave(p,global))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code>(Time series of globally averaged precip)</ul>