Re: plot phase of max value

From: Brammer, Alan P <abrammer_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 19 2014 - 09:07:58 MDT

This is the way I have tackled the same issue.
1. Find maxima over 0th dimension.
2. Loop over 0th dimension, matching up maxima with time index.

Below is my very simple function I use to return the 2d array of time indices of when the maxima occur.
Could probably be cleaned up to be more flexible but it worked for my desires.

;Returns 2d array of indices of last occurrence of maxima over the leftmost dimension.
;Requires load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

undef(“maxind_3d”)
function maxind_3d( x[*][*][*]:numeric )
local dims, loc_max, max_i, i
begin
dims = dimsizes(x)

loc_max = dim_max_n(x, 0) ; Find maxima for each location
max_i = new( (/ dims(1), dims(2) /) , integer)

do i=0,dims(0)-1
  max_i = where( (x(i,:,:).eq. loc_max) , i, max_i ) ;; Find time index when maxima occurs
end do

copy_VarCoords(x(0,:,:), max_i)

return(max_i)
end

Alan.

##############################
Alan Brammer,
PhD Student,

Department of Atmospheric and Environmental Sciences,
University at Albany, State University of New York, Albany, NY, 12222
abrammer@albany.edu
##############################

On Mar 18, 2014, at 9:52 AM, Sebastian Milinski <smilinski@geomar.de> wrote:

> Dear all,
>
> I want to visualize the phase of the maximum of a variable. The data is sea surface temperature ([time | 12] x [lat | 260] x [lon | 1240]).
> For example, if the maximum temperature in one location occurs in July, the value for this lat/lon should be 7 (in another location 3 for March and so on). Finally, I want to create a contour plot of this field with a color coding for each of the twelve months.
>
> I would be grateful for any hint on how to realize this.
>
> Regards,
> Sebastian
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 19 09:08:20 2014

This archive was generated by hypermail 2.1.8 : Fri Mar 21 2014 - 15:49:21 MDT