Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > dcaf9bd555d1ce386641f56c6523d3ed > files > 254

grads-2.0.2-1.fc18.i686.rpm

<!--Copyright (C) 1988-2005 by the Institute of Global Environment and Society (IGES). See file COPYRIGHT for more information.-->

<html>
<head>
<title>GrADS Function: gr2stn</title>
<style type="text/css">
<!--
.style1 {color: #990000}
-->
</style>
</head>
<body text="#000000" bgcolor="e0f0ff">

<h2><b>gr2stn()</b></h2><p> 

<p>
This function is a grid-to-station interpolator. It creates "station"
data result by sampling a gridded data set and
interpolating to a given location. That location may be provided by
specifying a longitude and a latitude, or by providing a station
expression.
<h3>Syntax</h3>
<ul>
<code>gr2stn(<i>grid_expr, stn_expr,</i> &lt;-n&gt;)</code><br>
&nbsp;&nbsp;&nbsp;or<br>
<code>gr2stn(<i>grid_expr, lon, lat</i>, &lt;-n&gt;)</code><br>
</ul>

<p>
where:
<ul>
<code><i>grid_expr</i></code> is a GrADS expression
that gives a grid result. The interpolation will be done on this
data. The 
<code><i>grid_expr</i></code>may be a 2-D grid that varies in X and Y, or a 1-D grid that varies in Z or T. 
<p> 
  <code><i>stn_expr</i></code> is a GrADS
  expression that gives a station data result. The interpolation will be
  done to the station <i>locations</i>, the station data values are not used. </p>
<p><code><i>lon,lat</i></code> may be used instead of <code><i>stn_expr</i></code> to specify the location to which the
  gridded data will be interpolated (see Usage Note #3.)</p>
<p><span class="style1">(Version 2.0.a6 or later)</span> The <code>-n</code> option was added to return the nearest neighbor to the station location
instead of the bi-linear interpolation of the four surrounding grid points.</p>
<p>&nbsp;</p>
</ul>

<H3>Usage Notes</H3>
<ol><li>The result of the function is station data. </li>
  <li>If <code><i>grid_expr</i></code> is a 2-D grid that varies in X and Y, then <code><i>stn_expr</i></code> should also be a 2-D expression that has multiple stations in the lat/lon domain. The result will be a station data set, with values interpolated from <code><i>grid_expr</i></code> to the station locations.</li>
  <li>If <code><i>grid_expr</i></code> is a 1-D grid, then only Z or T can be the varying dimension. In this case, <code><i>stn_expr</i></code> should  be an expression that has a single location, such as &quot;temp(stid=kdca)&quot;. Alternatively, you may  provide  exact longitude and latitude values.</li>
  <li>By default, the interpolation is done
    bi-linearly within the grid space. No weighting is done to account for
    real-world coordinate systems. If any of the four grid points around the station location are missing, the result will also be missing. </li>
  <li>As of version 2.0.a6, the -n option may be used to return the nearest grid point value instead of the bi-linearly interpolated value.</li>
  <li>See the section of the User's Guide on <a
href="usingstationdata.html#xsection">Arbitrary Cross Sections</a> for more
    information on applications of <code>gr2stn</code>. </li>
</ol>
<h3>Examples</h3>
<ol>
<li>To examine the difference between an analysis (ie, gridded data) and
the original observations, one could:<br>
<br>
  <dd><code>d t.3-gr2stn(t.1,t.3)</code>
  <p>

where file 1 is gridded data, and file 3 is station data. The result would
display as differences at the station locations. 

<li>If one wanted to display the difference calculated in Example 1 as a
contour field, one can use the <a
href="gradfuncoacres.html"><code>oacres</code></a> function to do a quick
analysis of the station values:<br>
<br>
<dd><code>d oacres(t.1,t.3-gr2stn(t.1,t.3)) </code>
</ol>
</body>
</html>