;+ ; ; @file_comments ; Determine the min and the max of a mask array ; ; @categories ; Plotting ; ; @param TAB {in}{required} ; The array whose we determine the min and the max ; ; @param MASK {in}{required} ; The mask array ; ; @keyword MININ {type=scalar} ; If it is not defined, it takes the value of VRAIMIN ; ; @keyword MAXIN {type=scalar} ; If it is not defined, it takes the value of VRAIMAX ; ; @keyword ZEROMIDDLE ; Force the middle of the colorbar to be equal ; to 0 (force max=max(abs([min,max])) and min=-max) ; ; @keyword _EXTRA ; Used to pass keywords ; ; @keyword USETRI ; To force using triangulation. ; ; @param VRAIMIN {out} ; The min of the array ; ; @param VRAIMAX {out} ; The max of the array ; ; @uses ; Common.pro ; ; @restrictions ; Look if the field is constant on the sea ; ; @history ; Sebastien Masson (smasson\@lodyc.jussieu.fr) ; 11/12/98 ; ; @version ; $Id$ ; ; @todo seb: manque les param glam et gphi ; ;- ; PRO determineminmax, tab, mask, vraimin, vraimax, glam, gphi, MAXIN = maxin, MININ = minin, INTERVALLE = intervalle, USETRI = usetri, ZEROMIDDLE = zeromiddle, _EXTRA = ex ; compile_opt idl2, strictarrsubs ; @common ; ; Type of the vertical grid: if vargrid EQ 'W' then nz = nzw ELSE nz = nzt ; liste des points mer if (size(mask))[0] EQ 3 then mer = mask[*, *, 0] $ ELSE mer = mask ; If key_irregular eq 1, we mask also points which are not in the geographic ; domain defined by lon1,lon2,lat1,lat2 if keyword_set(key_irregular) AND n_elements(glam) NE 0 AND n_elements(gphi) NE 0 then begin dom = where(glam LT lon1 OR glam GT lon2 OR gphi LT lat1 OR gphi GT lat2) if dom[0] NE -1 then mer[dom] = 0 endif ; mer = where(mer eq 1) ; if mer[0] eq -1 then begin ras = report('Il n''y a que de la terre sur le dessin!') vraimax = 0 vraimin = 0 maxin = vraimax+1 minin = vraimin-1 usetri = 0 return endif ; ma and mi : max and min on ocean points vraimax = max(tab[mer], min = vraimin, _extra = ex) sameminmax = testvar(var = minin) EQ testvar(var = maxin) if n_elements(maxin) EQ 0 OR sameminmax then maxin = vraimax if n_elements(minin) EQ 0 OR sameminmax then BEGIN if keyword_set(intervalle) then minin = floor(vraimin/intervalle)*intervalle $ ELSE minin = vraimin endif if vraimin eq vraimax then BEGIN IF size(vraimin, /type) EQ 1 THEN vraimin = fix(vraimin) question = ['Warning: constant filed, same value everywhere : ' + strtrim(vraimin, 2) +'!', 'Shall we make the plot?'] answer = report(question, /default_no, /question) if answer then begin maxin = vraimax+1 minin = vraimin-1 endif ELSE tab = -1 ENDIF IF keyword_set(zeromiddle) THEN BEGIN maxin = max(abs([minin, maxin])) minin = -maxin ENDIF return end