<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks! That worked perfectly!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> gradsusr-bounces@gradsusr.org [mailto:gradsusr-bounces@gradsusr.org]
<b>On Behalf Of </b>Jeff Duda<br>
<b>Sent:</b> Wednesday, April 02, 2014 10:32 AM<br>
<b>To:</b> GrADS Users Forum<br>
<b>Subject:</b> Re: [gradsusr] Help with area average script to calculate height for specific location<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Take out the single quotes around the word areal in the line<o:p></o:p></p>
<div>
<p class="MsoNormal">say 'areal'<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Jeff Duda<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Apr 2, 2014 at 9:26 AM, Roberto Mera <<a href="mailto:RMera@ucsusa.org" target="_blank">RMera@ucsusa.org</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">All,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">I sent this around last night but it was probably too early/late for most people to see it so I thought I would
send it again:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><br>
I have a script that allows me to process a text file of latitude longitudes (stations) and I'm trying to output area averages of a particular file based on the points generated from the text file.<br>
<br>
I'm basically calculating the grid point spatially associated with a specific station.
<br>
<br>
So far it works to give me the x1, x2, y1, y2 but I can't make it loop over all the points for area average of the gridded file.<br>
<br>
My version of grads: Config: v2.0.a9.oga.1 little-endian readline printim grib2 netcdf hdf4-sds hdf5 opendap-grids,stn athena geotiff shapefile<br>
<br>
Here is the script (some of the material is likely obsolete as I got the code from an earlier project):<br>
<br>
function main(arg)<br>
<br>
file = subwrd(arg,1)<br>
size = subwrd(arg,2)<br>
color = subwrd(arg,3)<br>
<br>
record = read(file)<br>
<br>
record = sublin(record,2)<br>
<br>
i = 0<br>
<br>
counter = record<br>
<br>
while(i < counter)<br>
<br>
record = read(file)<br>
<br>
record = sublin(record,2)<br>
<br>
ilat0 = subwrd(record,2)<br>
ilon0 = subwrd(record,1)<br>
ilon1 = subwrd(record,3)<br>
ilat1 = subwrd(record,4)<br>
<br>
<br>
*say ilon0 ilat0 ilon1 ilat1<br>
<br>
linia(ilat0,ilon0,ilon1,ilat1,size,color)<br>
<br>
i = i + 1<br>
<br>
endwhile<br>
<br>
return<br>
<br>
function linia(lon0,lat0,lon1,lat1,size,color)<br>
* Draws a line limited by two circles in _color<br>
'set line 'color<br>
'q w2gr 'lon0' 'lat0<br>
* 'q w2xy 'lon0' 'lat0<br>
x0=subwrd(result,3)<br>
y0=subwrd(result,6)<br>
xlo=x0-0.0540406<br>
xhi=x0+0.0540406<br>
ylo=y0-0.0540406<br>
yhi=y0+0.0540406<br>
* say x0' 'y0' 'lon0' 'lat0<br>
* say xlo' 'xhi' 'ylo' 'yhi <br>
'areal=aave(ht,x='xlo',x='xhi',y='ylo',y='yhi')'<br>
'd areal'<br>
areal=subwrd(result,6)<br>
say 'areal'<br>
*'q w2xy 'lon1' 'lat1<br>
*x1=subwrd(result,3)<br>
*y1=subwrd(result,6)<br>
*'draw line 'x0' 'y0' 'x1' 'y1<br>
* 'draw mark 3 'x0' 'y0' 'size''<br>
*'draw mark 3 'x1' 'y1' .07'<br>
return</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Roberto Mera<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Kendall Science Fellow in Climate Attribution<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Union of Concerned Scientists<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">1825 K St. NW Suite 800<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Washington, DC 20006<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">202-331-5447 (o)<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <br>
Jeff Duda<br>
Graduate research assistant<br>
University of Oklahoma School of Meteorology<br>
Center for Analysis and Prediction of Storms<o:p></o:p></p>
</div>
</div>
</body>
</html>