Changeset 440 for trunk/SRC


Ignore:
Timestamp:
12/21/10 14:26:05 (14 years ago)
Author:
smasson
Message:

take into account the ssh in moyenne and grossemoyenne

Location:
trunk/SRC/ToBeReviewed/CALCULS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/ToBeReviewed/CALCULS/grossemoyenne.pro

    r424 r440  
    6161; mean even if NAN is activated (see SPATIALFIRST explanations...) 
    6262; 
     63; @keyword SSH 
     64; array giving the sea level elenation (in meter) that must be added 
     65; to the thickness of the first level when computing vertical mean 
     66; 
    6367; @keyword WDEPTH 
    6468; to specify that the field is at W depth instead of T 
     
    8993;- 
    9094FUNCTION grossemoyenne, tab, direc, BOXZOOM=boxzoom, INTEGRATION=integration, KEEPBOTTOM = keepbottom $ 
    91                       , NAN=nan, NODOMDEF=nodomdef, WDEPTH=wdepth $ 
     95                      , NAN=nan, NODOMDEF=nodomdef, WDEPTH=wdepth, ssh=ssh $ 
    9296                      , SPATIALFIRST=spatialfirst, TEMPORALFIRST=temporalfirst $ 
    9397                      , _EXTRA=ex 
     
    164168;--------------------------------------------------------------- 
    165169  grille, mask, glam, gphi, gdep, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz, e1, e2, e3, WDEPTH = wdepth 
     170;--------------------------------------------------------------- 
     171; check the use of ssh keyword... 
     172;--------------------------------------------------------------- 
     173  IF keyword_set(ssh) AND dirz NE 0 AND firstz EQ 0 AND taille[0] GT 2 THEN BEGIN 
     174    szssh = size(ssh) 
     175    IF szssh[1] NE taille[1] OR szssh[2] NE taille[2] THEN $ 
     176       return, report('ssh and input arrays must have the same size') 
     177    sshh = ssh 
     178  ENDIF 
    166179;------------------------------------------------------------ 
    167180; I.4) if dirt equal 1, we make the temporal average and we send it in moyenne 
    168181;------------------------------------------------------------ 
    169   if dirt EQ 1 AND NOT keyword_set(spatialfirst) then begin 
     182  if dirt EQ 1 AND NOT keyword_set(spatialfirst) then BEGIN 
     183    IF keyword_set(sshh) THEN return, report('ssh and temporal mean: case not coded...') 
    170184    if dim EQ 3d then BEGIN 
    171185      case 1 of 
     
    338352;--------------------------------------------------------------- 
    339353    case 1 of 
    340       taille[1] eq jpi and taille[2] eq jpj and taille[3] eq jpk and taille[4] eq jpt: $ 
     354      taille[1] eq jpi and taille[2] eq jpj and taille[3] eq jpk and taille[4] eq jpt:BEGIN  
    341355        res = tab[firstx:lastx, firsty:lasty, firstz:lastz, *] 
    342       taille[1] eq jpi and taille[2] eq jpj and taille[3] eq nz and taille[4] eq jpt: $ 
     356        IF keyword_set(sshh) THEN sshh = sshh[firstx:lastx, firsty:lasty, *] 
     357      END 
     358      taille[1] eq jpi and taille[2] eq jpj and taille[3] eq nz and taille[4] eq jpt:BEGIN  
    343359        res = tab[firstx:lastx, firsty:lasty, *, *] 
     360        IF keyword_set(sshh) THEN sshh = sshh[firstx:lastx, firsty:lasty, *] 
     361      END 
    344362      taille[1] EQ  nx and taille[2] eq  ny and taille[3] eq nz and taille[4] eq jpt:res = tab 
    345363      taille[1] EQ  nx and taille[2] eq  ny and taille[3] eq jpk and taille[4] eq jpt: $ 
     
    455473        echelle = (temporary(e33)*temporary(mask))[*]#replicate(1, jpt) 
    456474        echelle = reform(echelle, nx, ny, nz, jpt, /over) 
     475        IF keyword_set(sshh) THEN echelle[*, *, 0, *] = echelle[*, *, 0, *] + sshh 
    457476        if keyword_set(integration) then divi = 1 ELSE begin 
    458477          IF msknan[0] NE -1 THEN divi = total(echelle*msknan, 3) $ 
     
    506525        echelle = (temporary(e133[*])*temporary(mask[*]))#replicate(1, jpt) 
    507526        echelle = reform(echelle, nx, ny, nz, jpt, /over) 
     527        IF keyword_set(sshh) THEN echelle[*, *, 0, *] = echelle[*, *, 0, *] + sshh*( e1[*]#replicate(1., jpt) ) 
    508528        if keyword_set(integration) then divi = 1 ELSE begin 
    509529          IF msknan[0] NE -1 THEN divi = total(total(echelle*msknan, 1), 2) $ 
     
    527547        echelle = (temporary(e233[*])*temporary(mask[*]))#replicate(1, jpt) 
    528548        echelle = reform(echelle, nx, ny, nz, jpt, /over) 
     549        IF keyword_set(sshh) THEN echelle[*, *, 0, *] = echelle[*, *, 0, *] + sshh*( e2[*]#replicate(1., jpt) ) 
    529550        if keyword_set(integration) then divi = 1 ELSE begin 
    530551          IF msknan[0] NE -1 THEN divi = total(total(echelle*msknan, 2), 2) $ 
     
    548569        echelle = (temporary(e1233[*])*temporary(mask[*]))#replicate(1, jpt) 
    549570        echelle = reform(echelle, nx, ny, nz, jpt, /over) 
     571        IF keyword_set(sshh) THEN echelle[*, *, 0, *] = echelle[*, *, 0, *] + sshh*( (e1[*]*e2[*])#replicate(1., jpt) ) 
    550572        if keyword_set(integration) then divi = 1 ELSE begin 
    551573          IF msknan[0] NE -1 THEN divi = total(total(total(echelle*msknan, 1), 1), 1) $ 
  • trunk/SRC/ToBeReviewed/CALCULS/moyenne.pro

    r424 r440  
    4545; To make an integral rather than an average 
    4646; 
     47; @keyword SSH 
     48; array giving the sea level elenation (in meter) that must be added 
     49; to the thickness of the first level when computing vertical mean 
     50; 
    4751; @keyword WDEPTH 
    4852; to specify that the field is at W depth instead of T 
     
    7377;- 
    7478FUNCTION moyenne, tab, direc, BOXZOOM=boxzoom, INTEGRATION=integration, KEEPBOTTOM = keepbottom $ 
    75                 , NAN=nan, NODOMDEF=nodomdef, WDEPTH=wdepth, _EXTRA=ex 
     79                , NAN=nan, NODOMDEF=nodomdef, SSH = ssh, WDEPTH=wdepth, _EXTRA=ex 
    7680; 
    7781  compile_opt idl2, strictarrsubs 
     
    143147  IF vargrid EQ 'W' THEN wdepth = 1 
    144148  grille, mask, glam, gphi, gdep, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz, e1, e2, e3, WDEPTH = wdepth 
     149;--------------------------------------------------------------- 
     150; check the use of ssh keyword... 
     151;--------------------------------------------------------------- 
     152  IF keyword_set(ssh) AND dirz NE 0 AND firstz EQ 0 AND taille[0] GE 2 THEN BEGIN 
     153    szssh = size(ssh) 
     154    IF szssh[1] NE taille[1] OR szssh[2] NE taille[2] THEN $ 
     155       return, report('ssh and input arrays must have the same size') 
     156    sshh = ssh 
     157  ENDIF 
    145158;------------------------------------------------------------ 
    146159;------------------------------------------------------------ 
     
    317330;--------------------------------------------------------------- 
    318331    case 1 of 
    319       taille[1] eq jpi and taille[2] eq jpj and taille[3] eq jpk: $ 
     332      taille[1] eq jpi and taille[2] eq jpj and taille[3] eq jpk:BEGIN 
    320333        res = tab[firstx:lastx, firsty:lasty, firstz:lastz] 
    321       taille[1] eq jpi and taille[2] eq jpj and taille[3] eq nz: $ 
     334        IF keyword_set(sshh) THEN sshh = sshh[firstx:lastx, firsty:lasty] 
     335      END 
     336      taille[1] eq jpi and taille[2] eq jpj and taille[3] eq nz:BEGIN  
    322337        res = tab[firstx:lastx, firsty:lasty, *] 
     338        IF keyword_set(sshh) THEN sshh = sshh[firstx:lastx, firsty:lasty] 
     339      END 
    323340      taille[1] EQ  nx and taille[2] eq  ny and taille[3] eq nz :res = tab 
    324341      taille[1] EQ  nx and taille[2] eq  ny and taille[3] eq jpk : $ 
     
    424441        e33 = replicate(1, 1.*nx*ny)#e3 
    425442        e33 = reform(e33, nx, ny, nz, /over) 
     443        IF keyword_set(sshh) THEN e33[*, *, 0] = e33[*, *, 0] + sshh 
    426444        IF keyword_set(key_partialstep) AND bottom[0] NE -1 THEN BEGIN 
    427445          IF keyword_set(wdepth) THEN $ 
     
    476494        e133 = e1[*]#e3 
    477495        e133 = reform(e133, nx, ny, nz, /over) 
     496        IF keyword_set(sshh) THEN e133[*, *, 0] = e133[*, *, 0] + sshh*e1 
    478497        IF keyword_set(key_partialstep) AND bottom[0] NE -1 THEN BEGIN 
    479498          IF keyword_set(wdepth) THEN $ 
     
    500519        e233 = e2[*]#e3 
    501520        e233 = reform(e233, nx, ny, nz, /over) 
     521        IF keyword_set(sshh) THEN e233[*, *, 0] = e233[*, *, 0] + sshh*e2 
    502522        IF keyword_set(key_partialstep) AND bottom[0] NE -1 THEN BEGIN 
    503523          IF keyword_set(wdepth) THEN $ 
     
    524544        e1233 = (e1*e2)[*]#e3 
    525545        e1233 = reform(e1233, nx, ny, nz, /over) 
     546        IF keyword_set(sshh) THEN e1233[*, *, 0] = e1233[*, *, 0] + sshh*e1*e2 
    526547        IF keyword_set(key_partialstep) AND bottom[0] NE -1 THEN BEGIN 
    527548          IF keyword_set(wdepth) THEN $ 
Note: See TracChangeset for help on using the changeset viewer.