find the location of the max value over a lat-long domain
Charles Seman
Charles.Seman at NOAA.GOV
Wed Nov 4 17:37:03 EST 2009
Roger,
Here's a copy of part of an email reply posted to the Listserv by
Jennifer Adams (COLA) from Aug 2002 (which was saved to a local file for
reference):
---
Try this little bit of script code -- modify to suit your
data. This example draws a mark where the maximum of a
global variable called "air" is located in the xy plane.
'set warn off'
'd maxloc(max(air,lon=0,lon=360),lat=-90,lat=90)'
ygrd = subwrd(result,4)
'd maxloc(max(air,lat=-90,lat=90),lon=0,lon=360)'
xgrd = subwrd(result,4)
'set x 'xgrd
lonval = subwrd(result,4)
'set y 'ygrd
latval = subwrd(result,4)
'q w2xy 'lonval' 'latval
xpos = subwrd(result,3)
ypos = subwrd(result,6)
'draw mark 1 'xpos' 'ypos' .2'
---
Hope it helps,
Chuck
Roger Shi wrote:
> Hi,
>
> I am having problems to find the location of the max value over a
> lat-long domain. GrADS only provides the "maxloc" function which only
> loop through one dimension, e.g.
>
> maxloc(expr, dim1, dim2 <,tinc>)
>
> expr - any valid GrADS expression
> dim1 - the starting dimension expression
> dim2 - the ending dimension expression
> tinc - optional time increment
>
> Is there any way to loop through both x and y dimensions at the same
> time?
>
> Best regards,
> Roger Shi
--
Please note that Charles.Seman at noaa.gov should be considered my NOAA
email address, not cjs at gfdl.noaa.gov.
********************************************************************
Charles Seman Charles.Seman at noaa.gov
U.S. Department of Commerce / NOAA / OAR
Geophysical Fluid Dynamics Laboratory voice: (609) 452-6547
201 Forrestal Road fax: (609) 987-5063
Princeton, NJ 08540-6649 http://www.gfdl.noaa.gov/~cjs/
********************************************************************
"The contents of this message are mine personally and do not necessarily
reflect any position of the Government or NOAA."
More information about the gradsusr
mailing list