[2] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
| 5 | ; NAME:determineminmax |
---|
| 6 | ; |
---|
| 7 | ; PURPOSE:determiner le min et le max d''un tableau masque |
---|
| 8 | ; |
---|
| 9 | ; CATEGORY: delestage de l''ecriture de plt, pltz, pltt |
---|
| 10 | ; |
---|
| 11 | ; CALLING SEQUENCE:determineminmax, tab, mask, vraimin, vraimax |
---|
| 12 | ; |
---|
| 13 | ; INPUTS: |
---|
| 14 | ; |
---|
| 15 | ; tab: le tableau dont il faut determiner le min et le max |
---|
| 16 | ; mask: le tableau de masque |
---|
| 17 | ; |
---|
| 18 | ; KEYWORD PARAMETERS: |
---|
| 19 | ; |
---|
| 20 | ; minin et maxin deux scalaire qui s''il ne sont pas definits |
---|
| 21 | ; prennent la valeur de vraimin et vraimax |
---|
| 22 | ; |
---|
| 23 | ; OUTPUTS: |
---|
| 24 | ; |
---|
| 25 | ; vraimin et vraimax: le min et le max du tableau |
---|
| 26 | ; |
---|
| 27 | ; COMMON BLOCKS: |
---|
| 28 | ; common.pro |
---|
| 29 | ; |
---|
| 30 | ; SIDE EFFECTS:degarde si le champ est constant sur la mer |
---|
| 31 | ; |
---|
| 32 | ; RESTRICTIONS: |
---|
| 33 | ; |
---|
| 34 | ; EXAMPLE: |
---|
| 35 | ; |
---|
| 36 | ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
| 37 | ; 11/12/98 |
---|
| 38 | ;- |
---|
| 39 | ;------------------------------------------------------------ |
---|
| 40 | ;------------------------------------------------------------ |
---|
| 41 | ;------------------------------------------------------------ |
---|
| 42 | PRO determineminmax, tab, mask, vraimin, vraimax, glam, gphi, MAXIN = maxin, MININ = minin, INTERVALLE = intervalle, _extra = ex |
---|
| 43 | @common |
---|
| 44 | ;----------------------------------------------------------------------------- |
---|
| 45 | ;----------------------------------------------------------------------------- |
---|
| 46 | ; type de grille verticale: |
---|
| 47 | if vargrid EQ 'W' then nz = nzw ELSE nz = nzt |
---|
| 48 | ; liste des points mer |
---|
| 49 | if (size(mask))[0] EQ 3 then BEGIN |
---|
| 50 | if (size(mask))[3] EQ jpk then mer=mask[*,*,niveau-1] $ |
---|
| 51 | ELSE mer=mask[*,*,nz-1] |
---|
| 52 | ENDIF ELSE mer=mask |
---|
| 53 | ; si key_irregular eq 1, on masque aussi les points qui ne rentrent |
---|
| 54 | ; pas ds le domaine geographique definit par lon1,lon2,lat1,lat2 |
---|
| 55 | if keyword_set(key_irregular) AND n_elements(glam) NE 0 AND n_elements(gphi) NE 0 then begin |
---|
| 56 | dom = where(glam LT lon1 OR glam GT lon2 OR gphi LT lat1 OR gphi GT lat2) |
---|
| 57 | if dom[0] NE -1 then mer[dom] = 0 |
---|
| 58 | endif |
---|
| 59 | ; |
---|
| 60 | mer=where(mer eq 1) |
---|
| 61 | ; |
---|
| 62 | if mer[0] eq -1 then begin |
---|
| 63 | ras = report('Il n''y a que de la terre sur le dessin!') |
---|
| 64 | tab = -1 |
---|
| 65 | endif |
---|
| 66 | ; ma et mi : max et min sur les points mer |
---|
| 67 | vraimax=max(tab(mer),min=vraimin, _extra = ex) |
---|
| 68 | sameminmax = testvar(var = minin) EQ testvar(var = maxin) |
---|
| 69 | if n_elements(maxin) EQ 0 OR sameminmax then maxin = vraimax |
---|
| 70 | if n_elements(minin) EQ 0 OR sameminmax then BEGIN |
---|
| 71 | if keyword_set(intervalle) then minin = floor(vraimin/intervalle)*intervalle $ |
---|
| 72 | ELSE minin = vraimin |
---|
| 73 | endif |
---|
| 74 | if vraimin eq vraimax then BEGIN |
---|
| 75 | question = 'ATTENTION le champ est CONSTANT! Faut-il quand meme le tracer?' |
---|
| 76 | answer = report(question, /default_no, /question) |
---|
| 77 | if answer then begin |
---|
| 78 | maxin=vraimax+1 |
---|
| 79 | minin=vraimin-1 |
---|
| 80 | endif ELSE tab = -1 |
---|
| 81 | endif |
---|
| 82 | return |
---|
| 83 | end |
---|