# [gradsusr] Get minimum and maximum value from a Time-Longitude plot

Tue Jan 10 16:23:12 EST 2017

```Hi, Lyndon —
The values in the “Min, Max” line are the actual extremes of data values in your grid, the “Cmin, cmax, cint” values are what Grads will use for default contour levels. You can use nested minloc(min())/maxloc(max()) functions to find the grid coordinate of the extremes. Here is an example that mixes world coordinates for X and grid coordinates for T (latitude should be fixed):

minlon=0
maxlon=5
mint=1
maxt=3

'set lon 'minlon' 'maxlon
'set t 'mint' 'maxt

'd minloc(min(tt,lon='minlon',lon='maxlon'),t='mint',t='maxt')'
yminloc=subwrd(result,4)

'd minloc(min(tt,t='mint',t='maxt'),lon='minlon',lon='maxlon')'
xminloc=subwrd(result,4)

'd maxloc(max(tt,lon='minlon',lon='maxlon'),t='mint',t='maxt')'
ymaxloc=subwrd(result,4)

'd maxloc(max(tt,t='mint',t='maxt'),lon='minlon',lon='maxlon')'
xmaxloc=subwrd(result,4)

say 'minloc is at x='xminloc' and t=‘yminloc
say 'maxloc is at x='xmaxloc' and t='ymaxloc

On Jan 9, 2017, at 10:00 PM, Lyndon Mark Olaguera <olagueralyndonmark429 at gmail.com<mailto:olagueralyndonmark429 at gmail.com>> wrote:

Dear Jennifer,

I tried your suggestion and got the following values:

Data Type = grid
Dimensions = 0 3
I Dimension = 33 to 35 Linear 80 2.5
J Dimension = 43 to 44 Linear 00Z01AUG1975 7200mn
Sizes = 3 2 6
Undef value = -9.99e+08
Undef count = 0  Valid count = 6
Min, Max = -10.8831 6.05715
Cmin, cmax, cint = -10 6 2

The Cmin and Cmax is actually what I was looking for. Is there a way to get their location from the 2D plot? The equivalent grid coordinates?

Many thanks for the help,

Lyndon Mark

On Tue, Jan 10, 2017 at 5:12 AM, Jennifer M Adams <jadams21 at gmu.edu<mailto:jadams21 at gmu.edu>> wrote:
The min and max values of any displayed grid will appear in the output when using ‘set gxout stat’ or ’set stat on'. —Jennifer

On Dec 26, 2016, at 8:55 PM, Lyndon Mark Olaguera <olagueralyndonmark429 at gmail.com<mailto:olagueralyndonmark429 at gmail.com>> wrote:

Hi Kathryn,

It does not work for. I also tried the max(variable,t=1,t=2) but this gives me a very small number.
I am attaching here the sample netcdf file and my script in plotting the time longitude plot.

'sdfopen filt_olr_anom_1975.nc<http://filt_olr_anom_1975.nc/>'
'set display color white'
'c'
'set lon 80 180'
'set gxout contour'
'set ccolor 1'
*'set cint 10'
'set t 43 53'
'set y 1'
'set yaxis 43 53'
'define tt=ave(bf,lat=12.5,lat=22.5)'
'd tt'

Link of the file:

I want to get the maximum value, say between lon 80 and lon 90, time  43 to time 44.

Many thanks in advance for the help,

Lyndz

On Tue, Dec 27, 2016 at 10:51 AM, Lyndon Mark Olaguera <olagueralyndonmark429 at gmail.com<mailto:olagueralyndonmark429 at gmail.com>> wrote:
Hi Kathryn,

It does not work for. I also tried the max(variable,t=1,t=2) but this gives me a very small number.
I am attaching here the sample netcdf file and my script in plotting the time longitude plot.

'sdfopen filt_olr_anom_'year'.nc'
'set display color white'
'c'
'set lon 80 180'
'set gxout contour'
'set ccolor 1'
*'set cint 10'
'set t 43 53'
'set y 1'
'set yaxis 43 53'
'define tt=ave(bf,lat=12.5,lat=22.5)'
'd tt'

Many thanks for the help,

Lyndz

On Tue, Dec 27, 2016 at 1:00 AM, Kathryn Sellwood - NOAA Affiliate <kathryn.sellwood at noaa.gov<mailto:kathryn.sellwood at noaa.gov>> wrote:
"set lon lonval"  "d maxval(variable, t=1,t=2)

On Mon, Dec 26, 2016 at 1:14 AM, Lyndon Mark Olaguera <olagueralyndonmark429 at gmail.com<mailto:olagueralyndonmark429 at gmail.com>> wrote:
Dear all,

Is there an easy way to estimate the minimum value and maximum value from a time-longitude plot (minimum and maximum value per longitude and time).
I am using grads 2.1.0.oga.1. I tried to use the amin() function but in the grads window, it gives an error: unknown command amin().

Many thanks,

Lyndz

_______________________________________________

_______________________________________________

_______________________________________________

--
Center for Ocean-Land-Atmosphere Studies (COLA)
George Mason University

_______________________________________________

_______________________________________________

--