<div dir="ltr">Take out the single quotes around the word areal in the line<div>say 'areal'</div><div><br></div><div>Jeff Duda</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 2, 2014 at 9:26 AM, Roberto Mera <span dir="ltr"><<a href="mailto:RMera@ucsusa.org" target="_blank">RMera@ucsusa.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">All,<br>
<br>
<u></u><u></u></span></p>
<p class="MsoNormal"><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:<u></u><u></u></span></p>
<p class="MsoNormal"><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<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Roberto Mera<u></u><u></u></p>
<p class="MsoNormal">Kendall Science Fellow in Climate Attribution<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Union of Concerned Scientists<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">1825 K St. NW Suite 800<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Washington, DC 20006<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">202-331-5447 (o)<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<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><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Jeff Duda<br>Graduate research assistant<br>University of Oklahoma School of Meteorology<br>Center for Analysis and Prediction of Storms<br>
</div>