[gradsusr] Grabbing Max and Min Values from Array

L.B. bcbass2989 at gmail.com
Fri Aug 30 12:03:32 EDT 2019


Hello,

I am having trouble trying to figure out how to grab the max and min values
from an array that I read in. For instance, I have a text file that gets
created that includes the timestep, latitude and longitude values
(space-delimited) like so:

0 23.50 291.36
1 24.17 290.55
2 24.81 289.80
3 25.24 288.96
4 25.55 287.92
5 25.84 286.89
6 26.06 285.87
7 26.14 284.98
8 26.28 283.90
9 26.53 283.00

I read this file in with GrADS using the following code and create an array
for latitude and longitude based off the tstep:

istat = 0
while (istat != 2)
  data = read('file.txt')
  istat = sublin(data,1)
  if (istat = 2);break;endif

  line = sublin(data,2)
  tstep = subwrd(line,1)
  lat.tstep = subwrd(line,2)
  lon.tstep = subwrd(line,3)
endwhile
rc = close('file.txt')

So, what I want to do is grab the max/min latitude and longitude values so
that I can create a domain that nicely encloses the data I have to plot. Is
this possible to do within GrADS? I didn't have any luck playing with the
max() function.

Thanks!

*-------*
William (L.B.) LaForce IV
Meteorologist
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20190830/ef95ddbc/attachment.html>


More information about the gradsusr mailing list