Changeset 223 for trunk/SRC


Ignore:
Timestamp:
03/14/07 18:13:39 (17 years ago)
Author:
pinsard
Message:

improvements of some *.pro

Location:
trunk/SRC
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Matrix/make_selection.pro

    r163 r223  
    11;+ 
    22; 
    3 ; file_comments  
     3; @file_comments 
    44; Convert an array of selected values to an index 
    5 ;        array that identifies the selected values in a list 
    6 ;        or data array.  
     5; array that identifies the selected values in a list or data array. 
    76; 
    8 ; categories tools 
    9 ;  
    10 ; @param NAMES {in}{required} A list or array of values to choose from  
     7; @categories 
     8; tools 
    119; 
    12 ; @param SELNAMES {in}{required} A list of selected values 
     10; @param NAMES {in}{required} 
     11; A list or array of values to choose from 
    1312; 
    14 ; @keyword ONLY_VALID Return only indexes of found values. Values not 
    15 ;            found are skipped. Default is to return 1 index value for 
    16 ;            each SELNAME, which is -1 if SELNAME is not contained in  
    17 ;            NAMES. If ONLY_VALID is set, the -1 values will be deleted, 
    18 ;            and a value of -1 indicates that no SELNAME has been found 
    19 ;            at all. 
     13; @param SELNAMES {in}{required} 
     14; A list of selected values 
    2015; 
    21 ; @keyword REQUIRED Normally, MAKE_SELECTION will return indexes for 
    22 ;            all values that are found, simply ignoring the selected 
    23 ;            values that are not in the NAMES array (although an error 
    24 ;            message is displayed). Set this keyword to return with 
    25 ;            -1 as soon as a selected value is not found. 
     16; @keyword ONLY_VALID 
     17; Return only indexes of found values. Values not 
     18; found are skipped. Default is to return 1 index value for 
     19; each SELNAME, which is -1 if SELNAME is not contained in 
     20; NAMES. If ONLY_VALID is set, the -1 values will be deleted, 
     21; and a value of -1 indicates that no SELNAME has been found 
     22; at all. 
    2623; 
    27 ; @keyword QUIET Suppress printing of the error message if a 
    28 ;            selected value is not found (the error condition will 
    29 ;            still be set). 
     24; @keyword REQUIRED 
     25; Normally, MAKE_SELECTION will return indexes for 
     26; all values that are found, simply ignoring the selected 
     27; values that are not in the NAMES array (although an error 
     28; message is displayed). Set this keyword to return with 
     29; -1 as soon as a selected value is not found. 
    3030; 
    31 ; @returns A (long) array with indexes to reference the selected values 
    32 ;        in the NAMES array. 
     31; @keyword QUIET 
     32; Suppress printing of the error message if a 
     33; selected value is not found (the error condition will 
     34; still be set). 
    3335; 
    34 ; @restrictions If the NAMES array contains multiple entries of the same value, 
    35 ;        only the index to the first entry will be returned. 
     36; @returns 
     37; A (long) array with indexes to reference the selected values 
     38; in the NAMES array. 
    3639; 
    37 ;        A selection can contain multiple instances of the same value. 
    38 ;        The index array will contain one entry per selected item 
    39 ;        (See example below) 
     40; @restrictions 
     41; If the NAMES array contains multiple entries of the same value, 
     42; only the index to the first entry will be returned. 
    4043; 
    41 ; @examples names = [ 'Alfred','Anton','Peter','John','Mary'] 
     44; A selection can contain multiple instances of the same value. 
     45; The index array will contain one entry per selected item 
     46; (See example below) 
     47; 
     48; @examples 
     49;           names = [ 'Alfred','Anton','Peter','John','Mary'] 
    4250;           index = MAKE_SELECTION(names,['Peter','Mary']) 
    4351;           print,index 
     
    5765;           ; prints  -1 
    5866; 
    59 ; @history mgs, 28 Aug 1998: VERSION 1.00 
    60 ;          mgs, 29 Aug 1998: - changed behavior and added ONLY_VALID keyword 
     67; @history 
     68; mgs, 28 Aug 1998: VERSION 1.00 
     69; mgs, 29 Aug 1998: - changed behavior and added ONLY_VALID keyword 
    6170; 
    62 ; @version $Id$ 
     71; @version 
     72; $Id$ 
    6373; 
    6474;- 
     
    8191  compile_opt idl2, strictarrsubs 
    8292; 
    83   
    84   
    85   
    86     ; return an index array with a number for each element in  
     93    ; return an index array with a number for each element in 
    8794    ; selnames that is found in names. 
    8895    ; Set the REQUIRED keyword to return -1 if one element is 
    89     ; not found, otherwise -1 will only be returned, if no  
     96    ; not found, otherwise -1 will only be returned, if no 
    9097    ; element is found. 
    91   
     98 
    9299    ; reset error state to 0 
    93100    message,/reset 
    94   
     101 
    95102    quiet = keyword_set(quiet) 
    96103    result = -1L 
    97   
     104 
    98105    for i=0,n_elements(selnames)-1 do begin 
    99106       test = where(names eq selnames[i]) 
    100        result = [ result, test[0] ]  
     107       result = [ result, test[0] ] 
    101108       if (test[0] lt 0) then begin 
    102109           if (keyword_set(ONLY_VALID) OR keyword_set(REQUIRED)) then $ 
     
    106113       endif 
    107114    endfor 
    108   
     115 
    109116    if (n_elements(result) gt 1) then result = result[1:*] 
    110117 
     
    114121        else result = -1L 
    115122    endif 
    116   
     123 
    117124    return,result 
    118   
     125 
    119126end 
  • trunk/SRC/Postscript/printps.pro

    r220 r223  
    1616; that any of the existing ps file). 
    1717; 
    18 ; @categories  
     18; @categories 
    1919; Postscripts 
    2020; 
     
    193193; postscript visualisation/archiving/printing 
    194194; 
    195 ; @categories  
     195; @categories 
    196196; Postscripts 
    197197; 
    198 ; @param psfilename {in}{optional}  
     198; @param psfilename {in}{optional} 
    199199; The name of the postscript file we want to 
    200200; visualize and/or print and/or archive. It can also refer 
     
    244244      nameps = file_search(psdir+'*.ps', /test_regular, /nosort) 
    245245      IF nameps[0] EQ '' THEN BEGIN 
    246         ras = report('no postsrcipt file (ending with .ps) found in : ' + psdir) 
     246        ras = report('no postscript file (ending with .ps) found in : ' + psdir) 
    247247        RETURN 
    248248      ENDIF 
  • trunk/SRC/ReadWrite/read_grads.pro

    r163 r223  
    77; from the grads control file even if there is multiple data files. 
    88; 
    9 ; @categories  
     9; @categories 
    1010; Reading 
    1111; 
     
    4444; an array 
    4545; 
    46 ; @uses  
     46; @uses 
    4747; common 
    4848; 
    49 ; @restriction 
     49; @restrictions 
    5050; define all the grid parameters (defined in common.pro) 
    5151; associated to the data. 
    5252; 
    53 ; @restrictions 
    5453; this function call the procedure scanfile that use the 
    5554; unix commands grep and sed 
     
    5958; IDL> plt, a 
    6059; 
    61 ; @history  
     60; @history 
    6261; Sebastien Masson (smasson\@lodyc.jussieu.fr) 
    6362; 
  • trunk/SRC/ToBeReviewed/CALCULS/determ2.pro

    r157 r223  
    11;+ 
    22; 
    3 ; file_comments 
    4 ; computes the determinant of n 2 by 2 arrays 
    5 ; Z2DS is an 2*2*n array 
     3; @file_comments 
     4; computes the determinant of n 2 by 2 arrays Z2DS is an 2*2*n array 
    65; 
    7 ; @categories  
     6; @categories 
    87; Without loop 
    9 ;  
     8; 
    109; @param A {in}{required} 
    1110; n element array 
     
    2423; Defined as z2ds[1, 1, *] = z1d11 
    2524; 
    26 ; @returns  
     25; @returns 
    2726; n elements array, the determinent of each 2*2 arrrays 
    2827; 
    2928; @examples 
    30 ; a=findgen(2,2,5) 
    31 ; print, determ2(a) 
    32 ; FOR i=0,4 DO print, determ(a[*,*,i]) ; IDL solution 
     29; IDL> a=findgen(2,2,5) 
     30; IDL> print, determ2(a) 
     31; IDL> FOR i=0,4 DO print, determ(a[*,*,i]) ; IDL solution 
    3332; 
    3433; @history 
    35 ;           S. Masson (smasson\@lodyc.jussieu.fr) 
    36 ;           July 11th, 2002 
     34; S. Masson (smasson\@lodyc.jussieu.fr) 
     35; July 11th, 2002 
    3736; 
    3837; @version 
  • trunk/SRC/ToBeReviewed/CALCULS/grossemoyenne.pro

    r163 r223  
    44;+ 
    55; 
    6 ; @file_comments   
     6; @file_comments 
    77; averages a 3- or 4-d time series field over a selected 
    88; geographical area or along the time axis. For one ore more 
     
    1616; @param DIREC {in}{required} 
    1717; 'x' 'y' 'z' 't' 'xy' 'xz' 'yz' 'xyz' 'xt' 'yt' 'zt' 
    18 ; 'xyt' 'xzt' 'yzt' or 'xyzt'  
    19 ; 
    20 ; @keyword BOXZOOM   
     18; 'xyt' 'xzt' 'yzt' or 'xyzt' 
     19; 
     20; @keyword BOXZOOM 
    2121; [xmin,xmax,ymin,ymax (,(zmin,)zmax)] to more details, see domdef 
    22 ; boxzoom can have 5 forms:  
    23 ; [vert2], [vert1, vert2],[lon1, lon2, lat1, lat2],   
     22; boxzoom can have 5 forms: 
     23; [vert2], [vert1, vert2],[lon1, lon2, lat1, lat2], 
    2424; [lon1, lon2, lat1, lat2, vert2],[lon1, lon2, lat1, lat2, vert1,vert2] 
    25 ;              
    26 ; @keyword NAN  
    27 ; not a number, we activate it if we want to average without considerate some masked values of TAB. 
    28 ; If masked values of TAB are values consecrated by IDL(!values.f_nan), wr just have to put NAN. 
    29 ; If masked values of TAB are valued a (a must be different of 1, corresponding to nan = 
    30 ; !values.f_nan and of 0, which desactivate nan). We have to put NAN=a.  
    31 ; Comment: In output, rsult points which are NAN will be valued a or !values.f_nan. 
    32 ;             
     25; 
     26; @keyword NAN 
     27; not a number, we activate it if we want to average without considerate some 
     28; masked values of TAB. 
     29; If masked values of TAB are values consecrated by IDL(!values.f_nan), we 
     30; just have to put NAN. 
     31; If masked values of TAB are valued a (a must be different of 1, 
     32; corresponding to nan = !values.f_nan and of 0, which desactivate nan). 
     33; We have to put NAN=a. 
     34; Comment: In output, rsult points which are NAN will be valued a or 
     35; !values.f_nan. 
     36; 
    3337; @keyword NODOMDEF 
    34 ; We activate it if we do not want to pass in domdef even if the keyword boxzoom  
    35 ; is present (like when grossemoyenne is called via checkfield) 
    36 ; 
    37 ; @keyword INTEGRATION  
     38; We activate it if we do not want to pass in domdef even if the keyword 
     39; boxzoom is present (like when grossemoyenne is called via checkfield) 
     40; 
     41; @keyword INTEGRATION 
    3842; To make an integral rather than an average 
    3943; 
    40 ; @keyword SPATIALFIRST  
     44; @keyword SPATIALFIRST 
    4145; when performing at the same time 
    4246; spatial and temporal mean, grossemoyenne is assuming 
     
    4852; SPATIALFIRST is activated automatically. 
    4953; 
    50 ; @keyword TEMPORALFIRST  
     54; @keyword TEMPORALFIRST 
    5155; to force to perform first temporal 
    52 ; mean even if nan is activated (see SPATIALFIRST 
    53 ; explanations...) 
    54 ; 
    55 ;  
    56 ; @keyword WDEPTH  
    57 ; to specify that the field is at W depth instead of T  
    58 ; depth (automatically activated if vargrid eq 'W')  
     56; mean even if nan is activated (see SPATIALFIRST explanations...) 
     57; 
     58; @keyword WDEPTH 
     59; to specify that the field is at W depth instead of T 
     60; depth (automatically activated if vargrid eq 'W') 
    5961; 
    6062; @uses 
    61 ; result:un tableau  
     63; result:un tableau 
    6264; common 
    6365; domdef 
    6466; 
    65 ; @restrictions Put values corresponding to land at 1.e20 
    66 ; 
    67 ; @history  
     67; @restrictions 
     68; Put values corresponding to land at 1.e20 
     69; 
     70; @history 
    6871; Jerome Vialard (jv\@lodyc.jussieu.fr) 
    6972;                       2/7/98 
    7073;                       Sebastien Masson (smasson\@lodyc.jussieu.fr) 
    71 ; adaptation array containing a temporal dimension  
     74; adaptation array containing a temporal dimension 
    7275;                       14/8/98 
    7376;                       15/1/98 
     
    118121  taille = size(tab) 
    119122  case 1 of 
    120     taille[0] eq 1 :return,  report('Le tableau n''a qu''une dimension, cas non traite!') 
    121     taille[0] eq 2 :return,  report('Le tableau n''a qu''deux dimension, cas non traite!') 
    122     taille[0] eq 3 :BEGIN  
     123    taille[0] eq 1 :return,  report('array has only one dimension, not implemented!') 
     124    taille[0] eq 2 :return,  report('array has only two dimensions, not implemented!') 
     125    taille[0] eq 3 :BEGIN 
    123126      dim = '3d' 
    124127      if dirx eq 0 and diry eq 0 and dirt eq 0 then return, tab 
    125128    END 
    126     taille[0] eq 4 :BEGIN  
     129    taille[0] eq 4 :BEGIN 
    127130      dim = '4d' 
    128131      if dirx eq 0 and diry eq 0 and dirz eq 0 and dirt eq 0 then return, tab 
    129132    END 
    130     else : return, report('Le tableau d entree doit etre a 3 ou 4 dimensions s''il ne contient pas de dim temporelle utiliser moyenne') 
     133    else : return, report('array must have 3 or 4 dimensions if there is not time dimension use moyenne') 
    131134  endcase 
    132135;------------------------------------------------------------ 
     
    134137; Redefinition of the domain ajusted at boxzoom (at 6 elements) 
    135138; This will allowed us to calculate only in the domain concerned by the average. 
    136 ; Domdef, followed by grid give us all arrays of the grid on the subdomain  
    137 ;------------------------------------------------------------ 
    138   if keyword_set(boxzoom) then BEGIN  
     139; Domdef, followed by grid give us all arrays of the grid on the subdomain 
     140;------------------------------------------------------------ 
     141  if keyword_set(boxzoom) then BEGIN 
    139142    Case 1 Of 
    140143      N_Elements(Boxzoom) Eq 1: bte = [lon1, lon2, lat1, lat2, 0., boxzoom[0]] 
     
    145148      Else: return, report('Wrong Definition of Boxzoom') 
    146149    endcase 
    147     if NOT keyword_set(nodomdef) then BEGIN  
     150    if NOT keyword_set(nodomdef) then BEGIN 
    148151      savedbox = 1b 
    149152      saveboxparam, 'boxparam4grmoyenne.dat' 
    150153      domdef, bte, GRIDTYPE = vargrid, _extra = ex 
    151     ENDIF  
    152   ENDIF  
     154    ENDIF 
     155  ENDIF 
    153156;--------------------------------------------------------------- 
    154157; attribution of the mask and of longitude and latitude arrays... 
     
    159162;------------------------------------------------------------ 
    160163  if dirt EQ 1 AND NOT keyword_set(spatialfirst) then begin 
    161     if dim EQ 3d then BEGIN  
     164    if dim EQ 3d then BEGIN 
    162165      case 1 of 
    163166        taille[1] eq jpi and taille[2] eq jpj and taille[3] eq jpt: $ 
     
    165168                    , firsty:firsty+ny-1, *] 
    166169        taille[1] EQ  nx and taille[2] eq  ny and taille[3] eq jpt:res = tab 
    167         else:BEGIN  
     170        else:BEGIN 
    168171          if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4grmoyenne.dat' 
    169172          return, report('Probleme d''adequation entre les tailles du domaine nx*ny*jpt '+strtrim(nx, 1)+'*'+strtrim(ny, 1)+'*'+strtrim(jpt, 1)+' et du tableau '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)+'*'+strtrim(taille[3], 1)) 
     
    179182          res = total(res, 3, nan = keyword_set(nan))/ (1 > divi) 
    180183          if notanum[0] NE -1 then res[temporary(notanum)] = !values.f_nan 
    181         ENDIF ELSE res = total(res, 3)/(1.*taille[3])  
     184        ENDIF ELSE res = total(res, 3)/(1.*taille[3]) 
    182185      ENDELSE 
    183186    ENDIF ELSE BEGIN 
     
    190193        taille[1] EQ  nx and taille[2] eq  ny and taille[3] eq jpk and taille[4] eq jpt: $ 
    191194          res = tab[*, *, firstz:lastz, *] 
    192         else:BEGIN  
     195        else:BEGIN 
    193196           if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4grmoyenne.dat' 
    194197          return, report('Probleme d''adequation entre les tailles du domaine nx*ny*nz*jpt ' $ 
     
    211214      ENDELSE 
    212215    ENDELSE 
    213     if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4grmoyenne.dat'     
     216    if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4grmoyenne.dat' 
    214217    return,  moyenne(temporary(res), direc, BOXZOOM = boxzoom, NAN = nan, INTEGRATION = integration, NODOMDEF = nodomdef, WDEPTH = wdepth, _extra = ex) 
    215218  ENDIF ELSE res = tab 
    216219  IF jpt EQ 1 THEN BEGIN 
    217     if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4grmoyenne.dat'     
     220    if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4grmoyenne.dat' 
    218221    return, moyenne(reform(res, /over), direc, BOXZOOM = boxzoom, NAN = nan, INTEGRATION = integration, NODOMDEF = nodomdef, WDEPTH = wdepth, _extra = ex) 
    219222  END 
     
    227230;   II.1) verification of the coherence of the array's size to average 
    228231; Verification of the coherence between the array's size and the domain defined by domdef 
    229 ; The input array must have either the total domain's size (jpi,jpj,jpt) or this  
    230 ; one of the reduced domain (nx,ny,jpt) 
     232; The input array must have either the total domain's size (jpi,jpj,jpt) or 
     233; this one of the reduced domain (nx,ny,jpt) 
    231234;--------------------------------------------------------------- 
    232235    case 1 of 
     
    235238                  , firsty:firsty+ny-1, *] 
    236239      taille[1] EQ  nx and taille[2] eq  ny and taille[3] eq jpt:res = tab 
    237       else:BEGIN  
     240      else:BEGIN 
    238241        if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4grmoyenne.dat' 
    239242        return, report('Probleme d''adequation entre les tailles du domaine nx*ny*jpt '+strtrim(nx, 1)+'*'+strtrim(ny, 1)+'*'+strtrim(jpt, 1)+' et du tableau '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)+'*'+strtrim(taille[3], 1)) 
    240243      enD 
    241244    endcase 
    242     if keyword_set(nan) NE 0 then BEGIN  
    243       if nan NE 1 then BEGIN    ; If nan is not !values.f_nan  
     245    if keyword_set(nan) NE 0 then BEGIN 
     246      if nan NE 1 then BEGIN    ; If nan is not !values.f_nan 
    244247; we put it at !values.f_nan 
    245248        if abs(nan) LT 1e6 then notanumber = where(res EQ nan) $ 
     
    249252    ENDIF 
    250253;--------------------------------------------------------------- 
    251 ; Comment : WE HAVE TO BE CAREFUL ABOUT CASES WHERE THE DIMENSION TO AVERAGE = 1,  
    252 ; AND MAKE SURE THAT IT EXIST. THAT IS WHY WE USE reform(...,nx,ny,...) WHICH CAN  
    253 ; LOOK USELESS AT THE BEGINNING 
    254 ;--------------------------------------------------------------- 
    255     if nx EQ 1 OR ny EQ 1 then BEGIN  
     254; Comment : WE HAVE TO BE CAREFUL ABOUT CASES WHERE THE DIMENSION TO 
     255; AVERAGE = 1, AND MAKE SURE THAT IT EXIST. THAT IS WHY WE USE 
     256; reform(...,nx,ny,...) WHICH CAN LOOK USELESS AT THE BEGINNING 
     257;--------------------------------------------------------------- 
     258    if nx EQ 1 OR ny EQ 1 then BEGIN 
    256259      res = reform(res, nx, ny, jpt, /over) 
    257260      e1 =  reform(e1, nx, ny, /over) 
     
    270273        echelle = (temporary(e))[*]#replicate(1, jpt) 
    271274        echelle = reform(echelle, nx, ny, jpt, /over) 
    272         if keyword_set(integration) then divi = 1 ELSE BEGIN  
     275        if keyword_set(integration) then divi = 1 ELSE BEGIN 
    273276          IF msknan[0] NE -1 THEN divi = total(echelle*msknan, 1) $ 
    274277          ELSE divi = total(echelle, 1) 
     
    287290        echelle = (temporary(e))[*]#replicate(1, jpt) 
    288291        echelle = reform(echelle, nx, ny, jpt, /over) 
    289         if keyword_set(integration) then divi = 1 ELSE BEGIN  
     292        if keyword_set(integration) then divi = 1 ELSE BEGIN 
    290293          IF msknan[0] NE -1 THEN divi = total(echelle*msknan, 2) $ 
    291294          ELSE divi = total(echelle, 2) 
    292         ENDELSE  
     295        ENDELSE 
    293296        res = total(temporary(res)*echelle, 2, nan = nan)/(divi > 1.) 
    294297        if msknan[0] NE -1 then begin 
     
    302305        echelle = (temporary(e1)*temporary(e2)*temporary(mask))[*]#replicate(1, jpt) 
    303306        echelle = reform(echelle, nx, ny, jpt, /over) 
    304         if keyword_set(integration) then divi = 1 ELSE BEGIN  
     307        if keyword_set(integration) then divi = 1 ELSE BEGIN 
    305308          IF msknan[0] NE -1 THEN divi = total(total(echelle*msknan, 1), 1) $ 
    306309          ELSE divi = total(total(echelle, 1), 1) 
     
    322325  if (dim eq '4d') then begin 
    323326;--------------------------------------------------------------- 
    324 ; III.1) Verification of the coherence of the array to average size  
    325 ; Verification of the coherence between the array's size and the domain  
    326 ; defind by domdef  
    327 ; The input array must have either the total domain size (jpi,jpj,jpk,jpt)  
     327; III.1) Verification of the coherence of the array to average size 
     328; Verification of the coherence between the array's size and the domain 
     329; defind by domdef 
     330; The input array must have either the total domain size (jpi,jpj,jpk,jpt) 
    328331; or this one of the reduced domain (nx,ny,ny,jpt) 
    329332;--------------------------------------------------------------- 
     
    336339      taille[1] EQ  nx and taille[2] eq  ny and taille[3] eq jpk and taille[4] eq jpt: $ 
    337340        res = tab[*, *, firstz:lastz, *] 
    338       else:BEGIN  
     341      else:BEGIN 
    339342        if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4grmoyenne.dat' 
    340343        return, report('Probleme d''adequation entre les tailles du domaine nx*ny*nz*jpt ' $ 
     
    346349    endcase 
    347350    if nx EQ 1 OR ny EQ 1 OR nz EQ 1 OR jpt EQ 1 then res = reform(res, nx, ny, nz, jpt, /over) 
    348     if keyword_set(nan) NE 0 then BEGIN  
    349       if nan NE 1 then BEGIN    ; if nan is not !values.f_nan  
     351    if keyword_set(nan) NE 0 then BEGIN 
     352      if nan NE 1 then BEGIN    ; if nan is not !values.f_nan 
    350353; we put it at !values.f_nan 
    351354        if abs(nan) LT 1e6 then notanumber = where(res EQ nan) $ 
     
    355358    ENDIF 
    356359;--------------------------------------------------------------- 
    357 ; Comment : WE HAVE TO BE CAREFUL ABOUT CASES WHERE THE DIMENSION TO AVERAGE = 1,  
    358 ; AND MAKE SURE THAT IT EXIST. THAT IS WHY WE USE reform(...,nx,ny,...) WHICH CAN  
    359 ; LOOK USELESS AT THE BEGINNING 
    360 ;--------------------------------------------------------------- 
    361     if nx EQ 1 OR ny EQ 1 OR nz EQ 1 then BEGIN  
     360; Comment : WE HAVE TO BE CAREFUL ABOUT CASES WHERE THE DIMENSION TO 
     361; AVERAGE = 1, AND MAKE SURE THAT IT EXIST. THAT IS WHY WE USE 
     362; reform(...,nx,ny,...) WHICH CAN LOOK USELESS AT THE BEGINNING 
     363;--------------------------------------------------------------- 
     364    if nx EQ 1 OR ny EQ 1 OR nz EQ 1 then BEGIN 
    362365      res = reform(res, nx, ny, nz, jpt, /over) 
    363366      mask =  reform(mask, nx, ny, nz, /over) 
     
    366369; the top of the ocean floor is 
    367370      IF vargrid EQ 'T' OR vargrid EQ 'W' THEN bottom = total(mask, 3) $ 
    368       ELSE bottom = total(tmask[firstx:lastx, firsty:lasty, firstz:lastz], 3)  
    369 ; we suppress columns with only ocean or land  
     371      ELSE bottom = total(tmask[firstx:lastx, firsty:lasty, firstz:lastz], 3) 
     372; we suppress columns with only ocean or land 
    370373      good = where(bottom NE 0 AND bottom NE nz) 
    371374; the bottom of the ocean in 3D index is: 
     
    386389        IF keyword_set(key_partialstep) AND bottom[0] NE -1 $ 
    387390          AND nx NE 1 THEN BEGIN 
    388           IF msknan[0] EQ -1 THEN BEGIN  
     391          IF msknan[0] EQ -1 THEN BEGIN 
    389392            msknan = replicate(1b, nx, ny, nz, jpt) 
    390393            nan = 1 
     
    395398          res[temporary(bottom)] = !values.f_nan 
    396399        ENDIF 
    397         if keyword_set(integration) then divi = 1 ELSE begin  
     400        if keyword_set(integration) then divi = 1 ELSE begin 
    398401          IF msknan[0] NE -1 THEN divi = total(echelle*msknan, 1) $ 
    399402          ELSE divi = total(echelle, 1) 
     
    415418        IF keyword_set(key_partialstep) AND bottom[0] NE -1 $ 
    416419          AND ny NE 1 THEN BEGIN 
    417           IF msknan[0] EQ -1 THEN BEGIN  
     420          IF msknan[0] EQ -1 THEN BEGIN 
    418421            msknan = replicate(1b, nx, ny, nz) 
    419422            nan = 1 
     
    424427          res[temporary(bottom)] = !values.f_nan 
    425428        ENDIF 
    426         if keyword_set(integration) then divi = 1 ELSE begin  
     429        if keyword_set(integration) then divi = 1 ELSE begin 
    427430          IF msknan[0] NE -1 THEN divi = total(echelle*msknan, 2) $ 
    428431          ELSE divi = total(echelle, 2) 
     
    446449        echelle = (temporary(e33)*temporary(mask))[*]#replicate(1, jpt) 
    447450        echelle = reform(echelle, nx, ny, nz, jpt, /over) 
    448         if keyword_set(integration) then divi = 1 ELSE begin  
     451        if keyword_set(integration) then divi = 1 ELSE begin 
    449452          IF msknan[0] NE -1 THEN divi = total(echelle*msknan, 3) $ 
    450453          ELSE divi = total(echelle, 3) 
     
    467470        IF keyword_set(key_partialstep) AND bottom[0] NE -1 $ 
    468471          AND nx*ny NE 1 THEN BEGIN 
    469           IF msknan[0] EQ -1 THEN BEGIN  
     472          IF msknan[0] EQ -1 THEN BEGIN 
    470473            msknan = replicate(1b, nx, ny, nz) 
    471474            nan = 1 
     
    476479          res[temporary(bottom)] = !values.f_nan 
    477480        ENDIF 
    478         if keyword_set(integration) then divi = 1 ELSE begin  
     481        if keyword_set(integration) then divi = 1 ELSE begin 
    479482          IF msknan[0] NE -1 THEN divi = total(total(echelle*msknan, 1), 1) $ 
    480483          ELSE divi = total(total(echelle, 1), 1) 
     
    497500        echelle = (temporary(e133[*])*temporary(mask[*]))#replicate(1, jpt) 
    498501        echelle = reform(echelle, nx, ny, nz, jpt, /over) 
    499         if keyword_set(integration) then divi = 1 ELSE begin  
     502        if keyword_set(integration) then divi = 1 ELSE begin 
    500503          IF msknan[0] NE -1 THEN divi = total(total(echelle*msknan, 1), 2) $ 
    501504          ELSE divi = total(total(echelle, 1), 2) 
     
    518521        echelle = (temporary(e233[*])*temporary(mask[*]))#replicate(1, jpt) 
    519522        echelle = reform(echelle, nx, ny, nz, jpt, /over) 
    520         if keyword_set(integration) then divi = 1 ELSE begin  
     523        if keyword_set(integration) then divi = 1 ELSE begin 
    521524          IF msknan[0] NE -1 THEN divi = total(total(echelle*msknan, 2), 2) $ 
    522525          ELSE divi = total(total(echelle, 2), 2) 
     
    539542        echelle = (temporary(e1233[*])*temporary(mask[*]))#replicate(1, jpt) 
    540543        echelle = reform(echelle, nx, ny, nz, jpt, /over) 
    541         if keyword_set(integration) then divi = 1 ELSE begin  
     544        if keyword_set(integration) then divi = 1 ELSE begin 
    542545          IF msknan[0] NE -1 THEN divi = total(total(total(echelle*msknan, 1), 1), 1) $ 
    543546          ELSE divi = total(total(total(echelle, 1), 1), 1) 
     
    562565    tdim = size(res, /n_dimensions) 
    563566    if keyword_set(integration) then res = total(res, tdim, nan = nan) $ 
    564     ELSE BEGIN  
    565       if keyword_set(nan) then BEGIN  
     567    ELSE BEGIN 
     568      if keyword_set(nan) then BEGIN 
    566569        testnan = testnan < 1 
    567570        testnan = total(temporary(testnan), tdim) 
     
    569572      ENDIF ELSE divi = jpt 
    570573      res = total(res, tdim, nan = nan)/(1 > divi) 
    571     ENDELSE  
     574    ENDELSE 
    572575  ENDIF 
    573576;------------------------------------------------------------ 
     
    580583  valmask = 1e+20 
    581584  terre = where(divi EQ 0) 
    582   IF terre[0] NE -1 THEN BEGIN  
     585  IF terre[0] NE -1 THEN BEGIN 
    583586    res[temporary(terre)] = 1e+20 
    584   ENDIF  
     587  ENDIF 
    585588;------------------------------------------------------------ 
    586589; IV.2) We replace, when nan equal 1, !values.f_nan by nan 
    587590;------------------------------------------------------------ 
    588   if keyword_set(nan) NE 0 then BEGIN  
     591  if keyword_set(nan) NE 0 then BEGIN 
    589592    puttonan = where(temporary(testnan) EQ 0) 
    590593    if puttonan[0] NE -1 then res[temporary(puttonan)] = !values.f_nan 
    591     if nan NE 1 then BEGIN  
     594    if nan NE 1 then BEGIN 
    592595      notanumber = where(finite(res) eq 0) 
    593596      if notanumber[0] NE -1 then res[temporary(notanumber)] = nan 
     
    599602  if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4grmoyenne.dat' 
    600603;------------------------------------------------------------ 
    601   if keyword_set(key_performance) THEN print, 'temps grossemoyenne', systime(1)-tempsun  
     604  if keyword_set(key_performance) THEN print, 'temps grossemoyenne', systime(1)-tempsun 
    602605  return, res 
    603606;------------------------------------------------------------ 
  • trunk/SRC/ToBeReviewed/CALCULS/moyenne.pro

    r163 r223  
    44;+ 
    55; 
    6 ; @file_comments   
     6; @file_comments 
    77; averages a 2- or 3-d field over a selected 
    88;           geographical area and along one ore more 
     
    1717; 'x' 'y' 'z' 'xy' 'xz' 'yz' or 'xyz' 
    1818; 
    19 ; @keyword BOXZOOM   
     19; @keyword BOXZOOM 
    2020; [xmin,xmax,ymin,ymax (,(zmin,)zmax)] to more details, see domdef 
    21 ; boxzoom can have 5 forms:  
     21; boxzoom can have 5 forms: 
    2222;  [vert2], 
    2323;  [vert1, vert2], 
    24 ;  [lon1, lon2, lat1, lat2],   
     24;  [lon1, lon2, lat1, lat2], 
    2525;  [lon1, lon2, lat1, lat2, vert2], 
    2626;  [lon1, lon2, lat1, lat2, vert1,vert2] 
    2727; 
    28 ; @keyword NAN  
     28; @keyword NAN 
    2929; not a number, we activate it if we want to average without considerate some masked values of TAB. 
    3030; If masked values of TAB are values consecrated by IDL(!values.f_nan), we just have to put NAN. 
    3131; If masked values of TAB are valued a (a must be different of 1, corresponding to nan = 
    32 ; !values.f_nan and of 0, which desactivate nan). We have to put NAN=a.  
     32; !values.f_nan and of 0, which desactivate nan). We have to put NAN=a. 
    3333; Comment: In output, result points which are NAN will be valued a or !values.f_nan. 
    34 ;             
     34; 
    3535; @keyword NODOMDEF 
    36 ; We activate it if we do not want to pass in domdef even if the keyword boxzoom  
     36; We activate it if we do not want to pass in domdef even if the keyword boxzoom 
    3737; is present (like when grossemoyenne is called via checkfield) 
    3838; 
    39 ; @keyword INTEGRATION  
     39; @keyword INTEGRATION 
    4040; To make an integral rather than an average 
    41 ;  
    42 ; @keyword WDEPTH  
    43 ; to specify that the field is at W depth instead of T  
    44 ; depth (automatically activated if vargrid eq 'W')  
    45 ;             
     41; 
     42; @keyword WDEPTH 
     43; to specify that the field is at W depth instead of T 
     44; depth (automatically activated if vargrid eq 'W') 
     45; 
    4646; @returns 
    47 ; An array  
     47; An array 
    4848; 
    4949; @uses 
     
    5151; domdef 
    5252; 
    53 ; @restrictions Put values corresponding to land at 1.e20 
     53; @restrictions 
     54; Put values corresponding to land at 1.e20 
    5455; 
    5556; @history 
     
    112113      if dirx eq 0 and diry eq 0 and dirz eq 0 then return, tab 
    113114    END 
    114     else : return, report('Le tableau d''entree doit etre a 2 ou 3 dimensions s''il contient une dim temporelle utiliser grossemoyenne') 
     115    else : return, report('Array must have 2 or 3 dimensions if there is a time dimension use grossemoyenne') 
    115116  endcase 
    116117;------------------------------------------------------------ 
     
    118119; Redefinition of the domain ajusted at boxzoom (at 6 elements) 
    119120; This will allowed us to calculate only in the domain concerned by the average. 
    120 ; Domdef, followed by grid give us all arrays of the grid on the subdomain  
    121 ;------------------------------------------------------------ 
    122   if keyword_set(boxzoom) then BEGIN  
     121; Domdef, followed by grid give us all arrays of the grid on the subdomain 
     122;------------------------------------------------------------ 
     123  if keyword_set(boxzoom) then BEGIN 
    123124    Case 1 Of 
    124125      N_Elements(Boxzoom) Eq 1:bte = [lon1, lon2, lat1, lat2, 0., boxzoom[0]] 
     
    127128      N_Elements(Boxzoom) Eq 5:bte = [Boxzoom[0:3], 0, Boxzoom[4]] 
    128129      N_Elements(Boxzoom) Eq 6:bte = Boxzoom 
    129       Else: return, report('Mauvaise Definition de Boxzoom') 
     130      Else: return, report('Bad definition of Boxzoom') 
    130131    endcase 
    131     if NOT keyword_set(nodomdef) then BEGIN  
     132    if NOT keyword_set(nodomdef) then BEGIN 
    132133      savedbox = 1b 
    133134      saveboxparam, 'boxparam4moyenne.dat' 
    134135      domdef, bte, GRIDTYPE = vargrid, _extra = ex 
    135     ENDIF  
    136   ENDIF  
     136    ENDIF 
     137  ENDIF 
    137138;--------------------------------------------------------------- 
    138139; attribution of the mask and of longitude and latitude arrays... 
     
    155156          jpk:res = tab[firstz:lastz] 
    156157          nz:res = tab 
    157           ELSE:BEGIN  
     158          ELSE:BEGIN 
    158159            if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4moyenne.dat' 
    159160            return, report('Probleme d''adequation entre les tailles du domaine et de la boxzoom.') 
    160161          END 
    161162        ENDCASE 
    162         if dirz EQ 1 then BEGIN  
    163           dim = '3d'  
     163        if dirz EQ 1 then BEGIN 
     164          dim = '3d' 
    164165          taille = size(reform(res, nx, ny, nz)) 
    165166        ENDIF ELSE BEGIN 
    166167          if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4moyenne.dat' 
    167168          return, res 
    168         ENDELSE  
     169        ENDELSE 
    169170      END 
    170171      ny EQ 1:BEGIN             ;vector following x 
     
    172173          jpi:res = tab[firstx:lastx] 
    173174          nx:res = tab 
    174           ELSE:BEGIN  
     175          ELSE:BEGIN 
    175176            if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4moyenne.dat' 
    176177            return, report('Probleme d''adequation entre les tailles du domaine et de la boxzoom.') 
    177178          END 
    178179        ENDCASE 
    179         if dirx EQ 1 then BEGIN  
    180           dim = '2d'  
     180        if dirx EQ 1 then BEGIN 
     181          dim = '2d' 
    181182          taille = size(reform(res, nx, ny)) 
    182         ENDIF ELSE BEGIN  
     183        ENDIF ELSE BEGIN 
    183184          if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4moyenne.dat' 
    184185          return, res 
     
    189190          jpj:res = tab[firsty:lasty] 
    190191          ny:res = tab 
    191           ELSE:BEGIN  
     192          ELSE:BEGIN 
    192193            if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4moyenne.dat' 
    193194            return, report('Probleme d''adequation entre les tailles du domaine et de la boxzoom.') 
     
    197198          dim = '2d' 
    198199          taille = size(reform(res, nx, ny)) 
    199         ENDIF ELSE BEGIN  
     200        ENDIF ELSE BEGIN 
    200201          if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4moyenne.dat' 
    201202          return, res 
    202         ENDELSE  
     203        ENDELSE 
    203204      END 
    204205    endcase 
     
    213214;   II.1) verification of the coherence of the array's size to average 
    214215; Verification of the coherence between the array's size and the domain defined by domdef 
    215 ; The input array must have either the total domain's size (jpi,jpj) or this  
     216; The input array must have either the total domain's size (jpi,jpj) or this 
    216217; one of the reduced domain (nx,ny) 
    217218;--------------------------------------------------------------- 
     
    220221        res = tab[firstx:lastx, firsty:lasty] 
    221222      taille[1] eq  nx and taille[2] eq  ny:res = tab 
    222       else:BEGIN  
     223      else:BEGIN 
    223224        if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4moyenne.dat' 
    224225        return, report('Probleme d''adequation entre les tailles du domaine nx*ny '+strtrim(nx, 1)+'*'+strtrim(ny, 1)+' et du tableau '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)) 
    225226      END 
    226227    ENDCASE 
    227     if keyword_set(nan) NE 0 then BEGIN  
    228       if nan NE 1 then BEGIN    ; If nan is not !values.f_nan  
     228    if keyword_set(nan) NE 0 then BEGIN 
     229      if nan NE 1 then BEGIN    ; If nan is not !values.f_nan 
    229230; we put it at !values.f_nan 
    230231        if abs(nan) LT 1e6 then notanumber = where(res EQ nan) $ 
     
    234235    ENDIF 
    235236;--------------------------------------------------------------- 
    236 ; Comment : WE HAVE TO BE CAREFUL ABOUT CASES WHERE THE DIMENSION TO AVERAGE = 1,  
    237 ; AND MAKE SURE THAT IT EXIST. THAT IS WHY WE USE reform(...,nx,ny,...) WHICH CAN  
     237; Comment : WE HAVE TO BE CAREFUL ABOUT CASES WHERE THE DIMENSION TO AVERAGE = 1, 
     238; AND MAKE SURE THAT IT EXIST. THAT IS WHY WE USE reform(...,nx,ny,...) WHICH CAN 
    238239; LOOK USELESS AT THE BEGINNING 
    239240;--------------------------------------------------------------- 
    240     if nx EQ 1 OR ny EQ 1 then BEGIN  
     241    if nx EQ 1 OR ny EQ 1 then BEGIN 
    241242      res = reform(res, nx, ny, /over) 
    242243      e1 =  reform(e1, nx, ny, /over) 
     
    254255        e = e1*mask 
    255256        if keyword_set(integration) then divi = 1 $ 
    256         else begin  
     257        else begin 
    257258          divi = e 
    258259          IF msknan[0] NE -1 THEN divi = temporary(divi)*msknan 
     
    272273        e = e2*mask 
    273274        if keyword_set(integration) then divi = 1 $ 
    274         else begin  
     275        else begin 
    275276          divi = e 
    276277          IF msknan[0] NE -1 THEN divi = temporary(divi)*msknan 
     
    288289      end 
    289290      (dirx eq 1) and (diry eq 1) : begin 
    290         if keyword_set(integration) then divi = 1 else BEGIN  
     291        if keyword_set(integration) then divi = 1 else BEGIN 
    291292          IF msknan[0] NE -1 THEN divi = total(e1*e2*mask*msknan) $ 
    292293          ELSE divi = total(e1*e2*mask) 
    293         ENDELSE  
     294        ENDELSE 
    294295        res = total(res*e1*e2*mask, nan = nan)/(divi > 1.) 
    295296        if msknan[0] NE -1 then begin 
     
    307308  if (dim eq '3d') then begin 
    308309;--------------------------------------------------------------- 
    309 ; III.1) Verification of the coherence of the array to average size  
    310 ; Verification of the coherence between the array's size and the domain  
    311 ; defind by domdef  
    312 ; The input array must have either the total domain size (jpi,jpj,jpk)  
     310; III.1) Verification of the coherence of the array to average size 
     311; Verification of the coherence between the array's size and the domain 
     312; defind by domdef 
     313; The input array must have either the total domain size (jpi,jpj,jpk) 
    313314; or this one of the reduced domain (nx,ny,ny) 
    314315;--------------------------------------------------------------- 
     
    321322      taille[1] EQ  nx and taille[2] eq  ny and taille[3] eq jpk : $ 
    322323        res = tab[*, *, firstz:lastz] 
    323       else:BEGIN  
     324      else:BEGIN 
    324325        if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4moyenne.dat' 
    325326        return, report('Probleme d''adequation entre les tailles du domaine nx*ny*nz '+strtrim(nx, 1)+'*'+strtrim(ny, 1)+'*'+strtrim(nz, 1)+' et du tableau '+strtrim(taille[1], 1)+'*'+strtrim(taille[2], 1)+'*'+strtrim(taille[3], 1)) 
    326327      END 
    327328    endcase 
    328     if keyword_set(nan) NE 0 then BEGIN  
    329       if nan NE 1 then BEGIN    ; if nan is not !values.f_nan  
     329    if keyword_set(nan) NE 0 then BEGIN 
     330      if nan NE 1 then BEGIN    ; if nan is not !values.f_nan 
    330331; we put it at !values.f_nan 
    331332        if abs(nan) LT 1e6 then notanumber = where(res EQ nan) $ 
     
    335336    ENDIF 
    336337;--------------------------------------------------------------- 
    337 ; Comment : WE HAVE TO BE CAREFUL ABOUT CASES WHERE THE DIMENSION TO AVERAGE = 1,  
    338 ; AND MAKE SURE THAT IT EXIST. THAT IS WHY WE USE reform(...,nx,ny,...) WHICH CAN  
     338; Comment : WE HAVE TO BE CAREFUL ABOUT CASES WHERE THE DIMENSION TO AVERAGE = 1, 
     339; AND MAKE SURE THAT IT EXIST. THAT IS WHY WE USE reform(...,nx,ny,...) WHICH CAN 
    339340; LOOK USELESS AT THE BEGINNING 
    340341;--------------------------------------------------------------- 
    341     if nx EQ 1 OR ny EQ 1 OR nz EQ 1 then BEGIN  
     342    if nx EQ 1 OR ny EQ 1 OR nz EQ 1 then BEGIN 
    342343      res = reform(res, nx, ny, nz, /over) 
    343344      e1 =  reform(e1, nx, ny, /over) 
     
    349350; the top of the ocean floor is 
    350351      IF vargrid EQ 'T' OR vargrid EQ 'W' THEN bottom = total(mask, 3) $ 
    351       ELSE bottom = total(tmask[firstx:lastx, firsty:lasty, firstz:lastz], 3)  
    352 ; we suppress columns with only ocean or land  
     352      ELSE bottom = total(tmask[firstx:lastx, firsty:lasty, firstz:lastz], 3) 
     353; we suppress columns with only ocean or land 
    353354      good = where(bottom NE 0 AND bottom NE nz) 
    354355; the bottom of the ocean in 3D index is: 
     
    367368        IF keyword_set(key_partialstep) AND bottom[0] NE -1 $ 
    368369          AND nx NE 1 THEN BEGIN 
    369           IF msknan[0] EQ -1 THEN BEGIN  
     370          IF msknan[0] EQ -1 THEN BEGIN 
    370371            msknan = replicate(1b, nx, ny, nz) 
    371372            nan = 1 
     
    395396        IF keyword_set(key_partialstep) AND bottom[0] NE -1 $ 
    396397          AND ny NE 1 THEN BEGIN 
    397           IF msknan[0] EQ -1 THEN BEGIN  
     398          IF msknan[0] EQ -1 THEN BEGIN 
    398399            msknan = replicate(1b, nx, ny, nz) 
    399400            nan = 1 
     
    447448        IF keyword_set(key_partialstep) AND bottom[0] NE -1 $ 
    448449          AND nx*ny NE 1 THEN BEGIN 
    449           IF msknan[0] EQ -1 THEN BEGIN  
     450          IF msknan[0] EQ -1 THEN BEGIN 
    450451            msknan = replicate(1b, nx, ny, nz) 
    451452            nan = 1 
     
    454455          res[bottom] = !values.f_nan 
    455456        ENDIF 
    456         if keyword_set(integration) then divi = 1 else BEGIN  
     457        if keyword_set(integration) then divi = 1 else BEGIN 
    457458          divi = e123*mask 
    458459          IF msknan[0] NE -1 THEN divi = temporary(divi)*msknan 
     
    478479          ELSE e133[bottom] = (e1*e3t_ps[firstx:lastx, firsty:lasty])[temporary(good)] 
    479480        ENDIF 
    480         if keyword_set(integration) then divi = 1 else BEGIN  
     481        if keyword_set(integration) then divi = 1 else BEGIN 
    481482          divi = e133*mask 
    482483          if msknan[0] NE -1 then divi = temporary(divi)*msknan 
     
    502503          ELSE e233[bottom] = (e2*e3t_ps[firstx:lastx, firsty:lasty])[temporary(good)] 
    503504        ENDIF 
    504         if keyword_set(integration) then divi = 1 else BEGIN  
     505        if keyword_set(integration) then divi = 1 else BEGIN 
    505506          divi = e233*mask 
    506507          if msknan[0] NE -1 then divi = temporary(divi)*msknan 
     
    526527          ELSE e1233[bottom] = (e1*e2*e3t_ps[firstx:lastx, firsty:lasty])[temporary(good)] 
    527528        ENDIF 
    528         if keyword_set(integration) then divi = 1 else BEGIN  
     529        if keyword_set(integration) then divi = 1 else BEGIN 
    529530          if msknan[0] NE -1 then divi = total(e1233*mask*msknan) $ 
    530531          ELSE divi = total(e1233*mask) 
     
    550551  IF terre[0] NE -1 THEN BEGIN 
    551552    res[terre] = 1e+20 
    552   ENDIF   
     553  ENDIF 
    553554;------------------------------------------------------------ 
    554555; IV.2) We replace, when nan equal 1, !values.f_nan by nan 
    555556;------------------------------------------------------------ 
    556   if keyword_set(nan) NE 0 then BEGIN  
     557  if keyword_set(nan) NE 0 then BEGIN 
    557558    puttonan = where(testnan EQ 0) 
    558559    if puttonan[0] NE -1 then res[puttonan] = !values.f_nan 
    559     if nan NE 1 then BEGIN  
     560    if nan NE 1 then BEGIN 
    560561      notanumber = where(finite(res) eq 0) 
    561562      if notanumber[0] NE -1 then res[notanumber] = nan 
     
    567568  if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4moyenne.dat' 
    568569;------------------------------------------------------------ 
    569   if keyword_set(key_performance) THEN print, 'temps moyenne', systime(1)-tempsun  
     570  if keyword_set(key_performance) THEN print, 'temps moyenne', systime(1)-tempsun 
    570571  return, res 
    571572;------------------------------------------------------------ 
  • trunk/SRC/ToBeReviewed/LECTURE/binary.pro

    r142 r223  
    22; @file_comments 
    33; Returns the binary representation of a number of any numerical type. 
    4 ;  
     4; 
    55; @param NUMBER {in}{required} 
    66; scalar or array of numbers (any numerical type) 
    7 ;  
    8 ; @Returns 
     7; 
     8; @returns 
    99; Byte array with binary representation of numbers. 
    10 ;  
    11 ; @Examples 
     10; 
     11; @examples 
    1212;   Binary representation of 11b: 
    1313;     IDL> print, binary(11b) 
     
    2626;     alpha   vms     0fda4149 68c0a221     49 41 da 0f 21 a2 c0 68 
    2727;     (Beginning with IDL 5.1, Alpha VMS uses IEEE representation as well.) 
    28 ;  
    29 ; @history: 
     28; 
     29; @history 
    3030;    19 Dec 1997  Originally a news posting by David Fanning. 
    3131;                       (Re: bits from bytes) 
  • trunk/SRC/ToBeReviewed/PLOTS/DESSINE/scontour.pro

    r163 r223  
    44;+ 
    55; 
    6 ; @File_comments 
     6; @file_comments 
    77; Same thing that contour but compatible with the whole environment (common.pro included) 
    88; 
    9 ; @categories  
     9; @categories 
    1010; Graphics 
    1111; 
    1212; @keyword NOREINITPLT 
    13 ; We active it if we do not want environment variables !p, !x, !y, !z  
     13; We active it if we do not want environment variables !p, !x, !y, !z 
    1414; to be reinitilalizated by the procedure reinitplt 
    15 ;  
     15; 
    1616; @keyword _EXTRA 
    1717; used to pass your keywords 
     
    2121; 
    2222; @examples 
    23 ;      IDL> z = dist(100)  
     23;      IDL> z = dist(100) 
    2424;      IDL> scontour, z, nlevels=10,small=[1,2,1],xstyle=1,ystyle=1 
    2525;      IDL> \@ps 
    2626; 
    27 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 
    28 ;                      10/10/1999 
    29 ;  
     27; @history 
     28; Sebastien Masson (smasson\@lodyc.jussieu.fr) 
     29; 10/10/1999 
     30; 
    3031; @version 
    3132; $Id$ 
     
    4041; 
    4142@common 
    42 ; 1) I reinitializate the graphic environment (variables !x, !y et !p):  
    43   if NOT keyword_set(NOREINITPLT) then reinitplt, _extra = ex  
    44 ; 2) i put the drawing on the screen like on the postcript  
     43; 1) I reinitializate the graphic environment (variables !x, !y et !p): 
     44  if NOT keyword_set(NOREINITPLT) then reinitplt, _extra = ex 
     45; 2) i put the drawing on the screen like on the postcript 
    4546; if ex contains norease and c_orientation keywords we force ex.noerase = 0 
    4647  IF chkstru(ex, 'overplot') EQ 0 THEN placedessin, 'autre', _extra = ex 
     
    5354    dummy = where(alltags EQ 'noerase', count1) 
    5455    dummy = where(alltags EQ 'c_orientation', count2) 
    55     IF count1*count2 NE 0 THEN BEGIN  
     56    IF count1*count2 NE 0 THEN BEGIN 
    5657      case n_params() OF 
    5758        1:contour, x, /nodata, _EXTRA = ex 
     
    6263      ex = get_extra(/overplot, _extra = ex) 
    6364      noerase_orientation = 1 
    64     ENDIF  
    65   ENDIF  
    66 ; 3) je fais mon joli dessin  
     65    ENDIF 
     66  ENDIF 
     67; 3) je fais mon joli dessin 
    6768  case n_params() OF 
    6869    1:contour, x, xstyle = 1, ystyle = 1, _EXTRA = ex 
     
    8182  ENDIF 
    8283; 4) End of drawing 
    83   terminedessin, _extra = ex  
     84  terminedessin, _extra = ex 
    8485 
    8586  return 
  • trunk/SRC/ToBeReviewed/PLOTS/DESSINE/splot.pro

    r163 r223  
    44;+ 
    55; 
    6 ; file_comments  
    7 ; Same thing that plot but compatible with the whole environment (common.pro included) 
     6; @file_comments 
     7; Same thing than plot but compatible with the whole environment (common.pro included) 
    88; 
    9 ; @categories  
     9; @categories 
    1010; Graphics 
    1111; 
    1212; @keyword NOREINITPLT 
    13 ; We active it if we do not want environment variables !p, !x, !y, !z  
     13; We active it if we do not want environment variables !p, !x, !y, !z 
    1414; to be reinitilalizated by the procedure reinitplt 
    15 ;  
     15; 
    1616; @keyword _EXTRA 
    1717; used to pass your keywords 
     
    2020; common.pro 
    2121; 
    22 ; @restrictions  
    23 ; If NOREINITPLT is not activated, all environment  
     22; @restrictions 
     23; If NOREINITPLT is not activated, all environment 
    2424; variables !p, !x, !y, !z are reinitializted by the procedure reinitplt 
    2525; 
     
    4040;------------------------------------------------------------ 
    4141;------------------------------------------------------------ 
    42 PRO splot,  x, y, NOREINITPLT = noreinitplt, _EXTRA = ex 
     42PRO splot, x, y, NOREINITPLT = noreinitplt, _EXTRA = ex 
    4343; 
    4444  compile_opt idl2, strictarrsubs 
    4545; 
    4646@common 
    47 ; 1) I reinitializate the graphic environment (les variables !x, !y et !p):  
    48    if NOT keyword_set(NOREINITPLT) then reinitplt, _extra = ex  
    49 ; 2) i put the drawing on the screen like on the postcript  
     47; 1) I reinitializate the graphic environment (les variables !x, !y et !p): 
     48   if NOT keyword_set(NOREINITPLT) then reinitplt, _extra = ex 
     49; 2) i put the drawing on the screen like on the postcript 
    5050   placedessin, 'autre', _extra = ex 
    5151; 3) Drawing 
    5252   if n_elements(y) EQ 0 then plot,  x, xstyle = 1, ystyle = 1, _EXTRA = ex $ 
    5353   ELSE plot,  x, y, xstyle = 1, ystyle = 1, _EXTRA = ex 
    54 ; 4) End of drawing  
    55    terminedessin, _extra=ex  
     54; 4) End of drawing 
     55   terminedessin, _extra=ex 
    5656; 
    5757   return 
  • trunk/SRC/ToBeReviewed/PLOTS/plotsym.pro

    r163 r223  
    33; @file_comments 
    44; function to make plotting symbols much easier. 
    5 ;  
     5; 
    66; @categories 
    77; Graphics 
    88; 
    9 ; @Keyword circle  
     9; @keyword circle 
    1010; circle symbol 
    11 ;  
    12 ; @Keyword TRIANGLE 
     11; 
     12; @keyword TRIANGLE 
    1313; triangle symbol 
    14 ;  
    15 ; @Keyword DIAMOND  
     14; 
     15; @keyword DIAMOND 
    1616; diamond symbol 
    17 ;  
    18 ; @Keyword BOX 
     17; 
     18; @keyword BOX 
    1919; box symbol 
    20 ;  
    21 ; @Keyword LINE 
     20; 
     21; @keyword LINE 
    2222; line symbol 
    23  ; 
    24 ; @Keyword SCALE 
     23; 
     24; @keyword SCALE 
    2525; scales the symbol 
    26 ;  
    27 ; @Keyword ANGLE 
     26; 
     27; @keyword ANGLE 
    2828; angle the symbol should be rotated 
    29 ;  
    30 ; @Keyword _EXTRA 
     29; 
     30; @keyword _EXTRA 
    3131; extra keywords for usersym.  These are thick, color and fill 
    3232; 
     
    4242; @version 
    4343; $Id$ 
    44 ;  
     44; 
    4545;- 
    4646 
  • trunk/SRC/ToBeReviewed/STRING/getfile.pro

    r192 r223  
    77; @param filein {in}{required} 
    88; text file name. 
    9 ;  
    10 ; @Keyword ERROR 
     9; 
     10; @keyword ERROR 
    1111; =err  error flag: 0=ok, 1=file not opened, 
    1212; 2=no lines in file. 
    13 ;          
    14 ; @keyword QUIET  
     13; 
     14; @keyword QUIET 
    1515; means give no error message. 
    16 ;          
     16; 
    1717; @keyword LINES 
    1818; =n  Number of lines to read (def=all). 
    1919; Much faster if number of lines is known. 
    2020; Automatic for IDL 5.6 or later. 
    21 ;          
    22 ; @keyword FIND  
     21; 
     22; @keyword FIND 
    2323; search the file in the all !path directories (use 
    2424; find.pro) 
    2525; 
    2626; @keyword HELP 
    27 ;  
     27; 
    2828; @returns 
    29 ;  
     29; 
    3030; @history 
    3131;       R. Sterner, 20 Mar, 1990 
     
    5252;- 
    5353;------------------------------------------------------------- 
    54   
     54 
    5555        function getfile, filein, error=err, help=hlp, quiet=quiet, lines=lines, find = find 
    5656; 
    5757  compile_opt idl2, strictarrsubs 
    5858; 
    59   
     59 
    6060        if (n_params(0) lt 1) or keyword_set(hlp) then begin 
    6161          print,' Read a text file into a string array.' 
     
    8181          endif 
    8282        ENDIF ELSE file = filein 
    83          
     83 
    8484        if (!version.release+0. ge 5.5) then begin 
    8585          f = call_function('file_search', file, count = c) 
     
    9191          return,'' 
    9292        endif 
    93   
     93 
    9494        if n_elements(line) eq 0 and (!version.release+0. ge 5.6) then begin 
    9595          lines = file_lines(file) 
     
    101101          minlines = 0 
    102102        endif else minlines=1 
    103   
     103 
    104104        get_lun, lun 
    105105        on_ioerror, err 
    106106        openr, lun, file 
    107   
     107 
    108108        if n_elements(lines) ne 0 then begin 
    109109          s = strarr(lines) 
     
    117117          endwhile 
    118118        endelse 
    119   
     119 
    120120        close, lun 
    121121        free_lun, lun 
     
    126126        endif 
    127127        if minlines eq 1 then s=s[1:*] 
    128   
     128 
    129129        err = 0 
    130130        return, s 
    131   
     131 
    132132err:    if !err eq -168 then begin 
    133133          if not keyword_set(quiet) then print,' Non-standard text file format.' 
     
    140140        err = 1 
    141141        return, -1 
    142   
     142 
    143143        end 
  • trunk/SRC/ToBeReviewed/STRING/string2struct.pro

    r157 r223  
    11;+ 
    22; @file_comments 
    3 ; This is a really, really cool way to turn keywords into 
    4 ; a structure. 
    5 ;  
     3; This is a really, really cool way to turn keywords into a structure. 
     4; 
    65; @categories 
    76; 
     
    1211; @returns 
    1312; 
    14 ; 
    1513; @restrictions 
    16 ; 
    1714; 
    1815; @examples 
     
    2017; 
    2118; @history 
    22 ; 
    2319; 
    2420; @version 
     
    4642; plot,findgen(100),_extra=stringToStructure('title="testing"') 
    4743; 
    48 ; @RETURNS  
     44; @returns 
    4945; This function returns the string as an anonymous structure. If an 
    5046; error was found then this function returns a structure with a null field. 
  • trunk/SRC/Utilities/protype.pro

    r163 r223  
    66; test is a ".pro" file corresponds to an IDL procedure, function or batch file. 
    77; 
    8 ; @categories  
     8; @categories 
    99; Utilities 
    1010; 
    11 ; @param FILE {in}  
    12 ; A scalar of string type, the name of the ".pro" file to be tested 
     11; @param FILE {in}{required}{type=string} 
     12; the name of the ".pro" file to be tested. 
    1313; if necessary, the input name is completed with '.pro' 
    1414; and its path found in !path 
    1515; 
    16 ; @returns  
     16; @returns 
     17; -1 if not found 
    1718; A scalar of string type: 'proc', 'func' or 'batch' 
    1819; 
     
    5455    ELSE:RETURN, 'batch' 
    5556  ENDCASE 
    56   
     57 
    5758  RETURN, -1 
    5859END 
  • trunk/SRC/Utilities/xfile.pro

    r163 r223  
    44;+ 
    55; 
    6 ; @file_comments  
     6; @file_comments 
    77; display in a widget an ASCII file. 
    8 ; It is the same thing that xdisplayfile but here, we use it  
    9 ; to display the content of a procedure or of a function,  
     8; It is the same thing that xdisplayfile but here, we use it 
     9; to display the content of a procedure or of a function, 
    1010; even if it is not in the current directory (thanks to the path). 
    1111; 
    12 ; @categories  
     12; @categories 
    1313; Utilities 
    1414; 
    15 ; @param FILENAME {in}{required}  
    16 ; It is the name of the procedure or of the function  
     15; @param FILENAME {in}{required} 
     16; It is the name of the procedure or of the function 
    1717; we want to display (with or without .pro at the end). 
    1818; 
    19 ; @keyword _EXTRA  
     19; @keyword _EXTRA 
    2020; used to pass your keywords 
    2121; 
    22 ; @examples xfile,'plt' 
     22; @examples 
     23; IDL> xfile,'plt' 
    2324; 
    24 ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) 
    25 ;                       7/1/99 
    26 ;                       6/7/1999: compatibility mac and windows 
     25; @history 
     26; Sebastien Masson (smasson\@lodyc.jussieu.fr) 
     27; 7/1/99 
     28; 6/7/1999: compatibility mac and windows 
    2729; 
    28 ; @version $Id$ 
     30; @version 
     31; $Id$ 
    2932; 
    3033;- 
     
    3841pfile = strlowcase(filename) 
    3942; 
    40 ; we have to find the full name.  
     43; we have to find the full name. 
    4144; 
    42    if strpos(pfile,".pro") lt 0 then pfile=pfile+".pro"  
     45   if strpos(pfile,".pro") lt 0 then pfile=pfile+".pro" 
    4346   thisOS = strupcase(strmid(!version.os_family, 0, 3)) 
    4447   CASE thisOS of 
     
    5659   i = 0 
    5760   repeat begin 
    58       res = findfile(pfile[i])  
     61      res = findfile(pfile[i]) 
    5962      i = i+1 
    60    endrep until res[0] NE '' OR i EQ n_elements(pfile)  
     63   endrep until res[0] NE '' OR i EQ n_elements(pfile) 
    6164   if res[0] NE  '' then BEGIN 
    6265; we open the file in a widget 
    6366   xdisplayfile, pfile[i-1], _extra = ex 
    64    ENDIF ELSE ras = report('le fichier demande n''existe pas...') 
     67   ENDIF ELSE ras = report('file does not exist ...') 
    6568; 
    6669; 
  • trunk/SRC/Utilities/xhelp.pro

    r163 r223  
    11;+ 
    22; 
    3 ; @file_comments  
     3; @file_comments 
    44; Display an IDL procedure header using widgets and the widget manager. 
    55; 
     
    77; Widget 
    88; 
    9 ; @param FILENAME {in}{required}  
    10 ; A scalar string that contains the filename of the file to display.   
    11 ; If FILENAME does not include a complete path specification, xhelp will  
     9; @param FILENAME {in}{required} 
     10; A scalar string that contains the filename of the file to display. 
     11; If FILENAME does not include a complete path specification, xhelp will 
    1212; search for the file in the current working directory and then each of the 
    1313; directories listed in !PATH environment variable.  The 
    1414; ".pro" file suffix will be appended if it is not supplied. 
    1515; 
    16 ; @keyword _EXTRA  
     16; @keyword _EXTRA 
    1717; used to pass your keywords 
    1818; 
    19 ; @restrictions  
     19; @restrictions 
    2020; Triggers the XMANAGER if it is not already in use. 
    2121; 
    22 ; @examples  
    23 ; Open a file and create a widget to display its contents. 
     22; @examples 
     23; IDL> xhelp,'plt' 
    2424; 
    25 ; @history Written By Steve Richards, December 1990 
     25; @history 
     26; Written By Steve Richards, December 1990 
    2627;       Graceful error recovery, DMS, Feb, 1992. 
    2728;       Modified to extract .pro documentation headers, PJR/ESRG mar94 
     
    3334;  6/7/1999: compatibility mac and windows 
    3435; 
    35 ; @version $Id$ 
     36; @version 
     37; $Id$ 
    3638; 
    3739;- 
     
    4749      return 
    4850   endif 
    49 ; We have to find the full name  
     51; We have to find the full name 
    5052   pfile=FILENAME 
    51    if strpos(pfile,".pro") lt 0 then pfile=pfile+".pro"  
     53   if strpos(pfile,".pro") lt 0 then pfile=pfile+".pro" 
    5254   thisOS = strupcase(strmid(!version.os_family, 0, 3)) 
    5355   CASE thisOS of 
     
    6769   n = 0 
    6870   repeat begin 
    69       res = findfile(pfile[n])  
     71      res = findfile(pfile[n]) 
    7072      n = n+1 
    71    endrep until res[0] NE '' OR n EQ n_elements(pfile)  
     73   endrep until res[0] NE '' OR n EQ n_elements(pfile) 
    7274   if res[0] NE '' then BEGIN 
    7375      openr, unit,pfile[n-1], /get_lun ; opening of the file 
    74 ; we select the heading piece      
     76; we select the heading piece 
    7577      a = strarr(1000)          ;Maximum # of lines 
    7678      xsize=0 
     
    9092      endwhile 
    9193      if i EQ 0 then $ 
    92          ras = report('le programme a etait mal ecrit, il n''y a pas d''en-tete... utiliser xfile.pro.') ELSE BEGIN  
     94         ras = report('le programme a etait mal ecrit, il n''y a pas d''en-tete... utiliser xfile.pro.') ELSE BEGIN 
    9395         a = a[0:i-1] 
    9496; we wrote the a's content in a widget 
    9597         xdisplayfile,'toto',text = a,title=pfile[n-1], _extra = ex 
    96       ENDELSE  
     98      ENDELSE 
    9799      FREE_LUN, unit         ;free the file unit. 
    98100   ENDIF ELSE ras = report('le fichier demande n''existe pas...') 
  • trunk/SRC/buildinit.pro

    r163 r223  
    7474; @returns 
    7575; 
    76 ; 
    7776; @uses 
    7877; 
    79 ; 
    80 ; @restrictions: 
    81 ; 
     78; @restrictions 
    8279; 
    8380; @examples 
     
    8582; 
    8683; @history 
    87 ; 
    8884; 
    8985; @version 
Note: See TracChangeset for help on using the changeset viewer.