[gradsusr] Help with area average script to calculate height for specific location
Roberto Mera
RMera at ucsusa.org
Wed Apr 2 10:58:56 EDT 2014
Thanks! That worked perfectly!
From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Jeff Duda
Sent: Wednesday, April 02, 2014 10:32 AM
To: GrADS Users Forum
Subject: Re: [gradsusr] Help with area average script to calculate height for specific location
Take out the single quotes around the word areal in the line
say 'areal'
Jeff Duda
On Wed, Apr 2, 2014 at 9:26 AM, Roberto Mera <RMera at ucsusa.org<mailto:RMera at ucsusa.org>> wrote:
All,
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:
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.
I'm basically calculating the grid point spatially associated with a specific station.
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.
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
Here is the script (some of the material is likely obsolete as I got the code from an earlier project):
function main(arg)
file = subwrd(arg,1)
size = subwrd(arg,2)
color = subwrd(arg,3)
record = read(file)
record = sublin(record,2)
i = 0
counter = record
while(i < counter)
record = read(file)
record = sublin(record,2)
ilat0 = subwrd(record,2)
ilon0 = subwrd(record,1)
ilon1 = subwrd(record,3)
ilat1 = subwrd(record,4)
*say ilon0 ilat0 ilon1 ilat1
linia(ilat0,ilon0,ilon1,ilat1,size,color)
i = i + 1
endwhile
return
function linia(lon0,lat0,lon1,lat1,size,color)
* Draws a line limited by two circles in _color
'set line 'color
'q w2gr 'lon0' 'lat0
* 'q w2xy 'lon0' 'lat0
x0=subwrd(result,3)
y0=subwrd(result,6)
xlo=x0-0.0540406
xhi=x0+0.0540406
ylo=y0-0.0540406
yhi=y0+0.0540406
* say x0' 'y0' 'lon0' 'lat0
* say xlo' 'xhi' 'ylo' 'yhi
'areal=aave(ht,x='xlo',x='xhi',y='ylo',y='yhi')'
'd areal'
areal=subwrd(result,6)
say 'areal'
*'q w2xy 'lon1' 'lat1
*x1=subwrd(result,3)
*y1=subwrd(result,6)
*'draw line 'x0' 'y0' 'x1' 'y1
* 'draw mark 3 'x0' 'y0' 'size''
*'draw mark 3 'x1' 'y1' .07'
return
Roberto Mera
Kendall Science Fellow in Climate Attribution
Union of Concerned Scientists
1825 K St. NW Suite 800
Washington, DC 20006
202-331-5447 (o)
_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>
http://gradsusr.org/mailman/listinfo/gradsusr
--
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140402/b2d01fae/attachment-0001.html
More information about the gradsusr
mailing list