create array of max value in vertical for multi-dimensional array

From: Chris Herbster <herbstec_at_nyahnyahspammersnyahnyah>
Date: Mon Jan 09 2012 - 22:14:37 MST

Hi folks,

I may have tried the wrong search terms while looking for this in the
archives, but perhaps I can get a quick solution to my quest.

I would like to obtain the max value at each horizontal point in a
multi-dimensional array for each time.

The array is x(time,level,lat,lon) and I am looking for the max value
for a given time (set with an index value) for each lat/lon location.
Obviously when I use the max function on the array I get a scalar
result. I'd like the scalar result for each location in the horizontal.

I want to obtain a 2D array out of a 4D array, but I have a loop (on jj)
that sets the time element to a specific index. I tried:

maxZ(:,:) = max (x (jj,0:29,:,:)
     where jj is a loop over the 24 hours, the second index is Z, the
range I want the max value out of, and the last two are the lat and long
index values.

That gave an error about maxZ not existing. Is the fix as simple as
creating the array with the correct dimensions?

Of course when I tried to do this without an index placeholder then maxZ
is a scalar and I can't plot that on a map.

I'm almost certain there is a way to do this without having nested loops
on the x and y variables.

Thanks for the help!

Chris Herbster

-- 
  Dr. Christopher G. Herbster
  Associate Professor
  Director of Science and Technology
  for the ERAU Weather Center
  Applied Aviation Sciences
  Embry-Riddle Aeronautical Univ.
  600 S. Clyde Morris Blvd.
  Daytona Beach, FL 32114-3900
  386.226.6444 Office
  386.226.6446 Weather Center
  http://wx.erau.edu/
Schedule at:  http://wx.erau.edu/faculty/herbster/Schedules/
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jan 9 22:14:53 2012

This archive was generated by hypermail 2.1.8 : Wed Jan 18 2012 - 09:21:55 MST