Ignore:
Timestamp:
05/02/06 14:59:12 (18 years ago)
Author:
pinsard
Message:

upgrade of CALCULS according to cerbere.lodyc.jussieu.fr: /usr/home/smasson/SAXO_RD/ : files

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/ToBeReviewed/CALCULS/grad.pro

    r23 r25  
    3434@common 
    3535;------------------------------------------------------------ 
     36; 
     37   IF finite(glamu[0])*finite(gphiu[0])*finite(glamv[0])*finite(gphiv[0]) EQ 0 THEN $ 
     38     return, report(['This version of grad is based on Arakawa C-grid.' $ 
     39                     , 'U and V grids must therefore be defined']) 
     40; 
    3641   res = litchamp(field) 
    3742   taille=size(res) 
    38    grille, mask, glam, gphi, gdep, nx, ny,nz,premierx,premiery,premierz,dernierx, derniery, dernierz      
     43   grille, mask, glam, gphi, gdep, nx, ny,nz,firstx,firsty,firstz,lastx, lasty, lastz      
    3944   if n_elements(valmask) EQ 0 then valmask = 1e20 
    4045   case strupcase(vargrid) of 
     
    4247         case direc of 
    4348            'x':BEGIN  
    44                divi = e1u[premierx:dernierx, premiery:derniery] 
    45                newmask = (umask())[premierx:dernierx, premiery:derniery, premierz:dernierz] 
     49               divi = e1u[firstx:lastx, firsty:lasty] 
     50               newmask = (umask())[firstx:lastx, firsty:lasty, firstz:lastz] 
    4651               vargrid = 'U' 
    47                domdef, glamt[premierx, 0], glamu[dernierx, 0] $ 
    48                 , gphit[0, premiery], gphiu[0, derniery], grille = ['T','U'] 
     52               domdef, glamt[firstx, 0], glamu[lastx, 0] $ 
     53                , gphit[0, firsty], gphiu[0, lasty], gridtype = ['T','U'] 
    4954            END 
    5055            'y':BEGIN 
    51                divi = e2v[premierx:dernierx, premiery:derniery] 
    52                newmask = (vmask())[premierx:dernierx, premiery:derniery, premierz:dernierz] 
     56               divi = e2v[firstx:lastx, firsty:lasty] 
     57               newmask = (vmask())[firstx:lastx, firsty:lasty, firstz:lastz] 
    5358               vargrid = 'V' 
    54                domdef, glamt[premierx, 0], glamv[dernierx, 0] $ 
    55                 , gphit[0, premiery], gphiv[0, derniery], grille = ['T','V'] 
    56             END 
    57             'z':BEGIN 
    58                divi = e3w[premierz:dernierz] 
     59               domdef, glamt[firstx, 0], glamv[lastx, 0] $ 
     60                , gphit[0, firsty], gphiv[0, lasty], gridtype = ['T','V'] 
     61            END 
     62            'z':BEGIN 
     63               divi = e3w[firstz:lastz] 
    5964               newmask = mask 
    6065               vargrid = 'W' 
     
    6570      'W':BEGIN 
    6671         case direc of 
    67             'x':divi = e1u[premierx:dernierx, premiery:derniery] 
    68             'y':divi = e2v[premierx:dernierx, premiery:derniery] 
    69             'z':BEGIN 
    70                divi = e3t[premierz:dernierz] 
     72            'x':divi = e1u[firstx:lastx, firsty:lasty] 
     73            'y':divi = e2v[firstx:lastx, firsty:lasty] 
     74            'z':BEGIN 
     75               divi = e3t[firstz:lastz] 
    7176               newmask = mask 
    7277               vargrid = 'T' 
     
    7883         case direc of 
    7984            'x':BEGIN 
    80                divi = (shift(e1t, -1, 0))[premierx:dernierx, premiery:derniery] 
    81                newmask = tmask[premierx:dernierx, premiery:derniery, premierz:dernierz] 
     85               divi = (shift(e1t, -1, 0))[firstx:lastx, firsty:lasty] 
     86               newmask = tmask[firstx:lastx, firsty:lasty, firstz:lastz] 
    8287               vargrid = 'T' 
    83                domdef, glamt[premierx, 0], glamu[dernierx] $ 
    84                 , gphit[0, premiery], gphiu[0, derniery], grille = ['T','U'] 
     88               domdef, glamt[firstx, 0], glamu[lastx] $ 
     89                , gphit[0, firsty], gphiu[0, lasty], gridtype = ['T','U'] 
    8590            END 
    8691            'y':BEGIN 
    87                divi = e2f[premierx:dernierx, premiery:derniery] 
    88                newmask = (fmask())[premierx:dernierx, premiery:derniery, premierz:dernierz] 
     92               divi = e2f[firstx:lastx, firsty:lasty] 
     93               newmask = (fmask())[firstx:lastx, firsty:lasty, firstz:lastz] 
    8994               vargrid = 'F' 
    90                domdef, glamu[premierx, 0], glamf[dernierx, 0] $ 
    91                 , gphiu[0, premiery], gphif[0, derniery], grille = ['U','F'] 
    92             END 
    93             'z':BEGIN 
    94                divi = e3w[premierz:dernierz] 
     95               domdef, glamu[firstx, 0], glamf[lastx, 0] $ 
     96                , gphiu[0, firsty], gphif[0, lasty], gridtype = ['U','F'] 
     97            END 
     98            'z':BEGIN 
     99               divi = e3w[firstz:lastz] 
    95100               newmask = mask 
    96101               vargrid = 'W' 
     
    102107         case direc of 
    103108            'x':BEGIN 
    104                divi = e1f[premierx:dernierx, premiery:derniery] 
    105                newmask = (fmask())[premierx:dernierx, premiery:derniery, premierz:dernierz] 
     109               divi = e1f[firstx:lastx, firsty:lasty] 
     110               newmask = (fmask())[firstx:lastx, firsty:lasty, firstz:lastz] 
    106111               vargrid = 'F' 
    107                domdef, glamv[premierx, 0], glamf[dernierx, 0] $ 
    108                 , gphiv[0, premiery], gphif[0, derniery], grille = ['V','F'] 
     112               domdef, glamv[firstx, 0], glamf[lastx, 0] $ 
     113                , gphiv[0, firsty], gphif[0, lasty], gridtype = ['V','F'] 
    109114            END 
    110115            'y':BEGIN 
    111                divi = (shift(e2t, 0, -1))[premierx:dernierx, premiery:derniery] 
    112                newmask = tmask[premierx:dernierx, premiery:derniery, premierz:dernierz] 
     116               divi = (shift(e2t, 0, -1))[firstx:lastx, firsty:lasty] 
     117               newmask = tmask[firstx:lastx, firsty:lasty, firstz:lastz] 
    113118               vargrid = 'T' 
    114                domdef, glamt[premierx, 0], glamv[dernierx, 0] $ 
    115                 , gphit[0, premiery], gphiv[0, derniery], grille = ['T','V'] 
    116             END 
    117             'z':BEGIN 
    118                divi = e3w[premierz:dernierz] 
     119               domdef, glamt[firstx, 0], glamv[lastx, 0] $ 
     120                , gphit[0, firsty], gphiv[0, lasty], gridtype = ['T','V'] 
     121            END 
     122            'z':BEGIN 
     123               divi = e3w[firstz:lastz] 
    119124               newmask = mask 
    120125               vargrid = 'W' 
     
    125130;       'F':BEGIN 
    126131;          case direc of 
    127 ;             'x':divi = (shift(e1v, -1, 0))[premierx:dernierx, premiery:derniery] 
    128 ;             'y':divi = (shift(e2u, 0, -1))[premierx:dernierx, premiery:derniery] 
    129 ;             'z':divi = e3w[premierz:dernierz] 
     132;             'x':divi = (shift(e1v, -1, 0))[firstx:lastx, firsty:lasty] 
     133;             'y':divi = (shift(e2u, 0, -1))[firstx:lastx, firsty:lasty] 
     134;             'z':divi = e3w[firstz:lastz] 
    130135;             ELSE:return, report('Bad definition of direction argument') 
    131136;          endcase 
     
    139144;---------------------------------------------------------------------------- 
    140145      taille[0] EQ 2:BEGIN 
    141          earth = where(mask[*, *, premierz] EQ 0) 
     146         earth = where(mask[*, *, firstz] EQ 0) 
    142147         if earth[0] NE -1 then res[earth] = !values.f_nan 
    143148         case direc of 
    144149            'x':BEGIN  
    145150               res = (shift(res, -1, 0)-res)/divi 
    146                if key_periodique EQ 0 OR nx NE jpi THEN res[nx-1, *] = !values.f_nan 
     151               if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *] = !values.f_nan 
    147152               if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(res, 1, 0) 
    148153            END 
     
    154159            ELSE:return,  report('Bad definition of direction argument for the type of array') 
    155160         ENDCASE 
    156          earth = where(newmask[*, *, premierz] EQ 0) 
     161         earth = where(newmask[*, *, firstz] EQ 0) 
    157162         if earth[0] NE -1 then res[earth] = valmask 
    158163      END 
     
    161166;---------------------------------------------------------------------------- 
    162167      taille[0] EQ 3 AND jpt NE 1:BEGIN 
    163          earth = where(mask[*, *, premierz] EQ 0) 
     168         earth = where(mask[*, *, firstz] EQ 0) 
    164169         if earth[0] NE -1 then BEGIN 
    165170            earth = earth#replicate(1, jpt)+replicate(1, n_elements(earth))#(nx*ny*lindgen(jpt)) 
     
    170175            'x':BEGIN  
    171176               res = (shift(res, -1, 0, 0)-res)/divi 
    172                if key_periodique EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan 
     177               if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan 
    173178               if vargrid EQ 'T' OR vargrid EQ 'V'  then res = shift(res, 1, 0, 0) 
    174179            END 
     
    180185            ELSE:return,  report('Bad definition of direction argument for the type of array') 
    181186         ENDCASE 
    182          earth = where(newmask[*, *, premierz] EQ 0) 
    183          if earth[0] NE -1 then BEGIN  
    184             earth = earth#replicate(1, jpt)+replicate(1, n_elements(earth))#(nx*ny*lindgen(jpt)) 
    185             res[earth] = valmask 
    186          ENDIF 
     187         earth = where(newmask[*, *, firstz] EQ 0) 
     188         if earth[0] NE -1 THEN res[earth] = valmask 
    187189      END 
    188190;---------------------------------------------------------------------------- 
     
    196198               divi = divi[*]#replicate(1, nz) 
    197199               res = (shift(res, -1, 0, 0)-res)/divi 
    198                if key_periodique EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan 
     200               if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan 
    199201               if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(res, 1, 0, 0) 
    200202            END 
     
    227229         if earth[0] NE -1 then res[earth] = !values.f_nan 
    228230         case direc OF 
     231            'x':BEGIN  
     232               divi = divi[*]#replicate(1, nz*jpt) 
     233               res = (shift(res, -1, 0, 0, 0)-res)/divi 
     234               if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *, *, *] = !values.f_nan 
     235               if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(res, 1, 0, 0, 0) 
     236            END 
     237            'y':BEGIN  
     238               divi = divi[*]#replicate(1, nz*jpt) 
     239               res = (shift(res, 0, -1, 0, 0)-res)/divi 
     240               res[*, ny-1, *, *] = !values.f_nan 
     241               if vargrid EQ 'T' OR vargrid EQ 'U'  then res = shift(res, 0, 1, 0, 0)         
     242            END 
    229243            'z':BEGIN 
    230244               divi = replicate(1, nx*ny)#divi 
     
    238252                  res[*, *, nz-1, *] = !values.f_nan 
    239253               ENDELSE 
    240                if earth[0] NE -1 then res[earth] = valmask 
    241             END 
    242          ENDCASE 
     254            END 
     255         ENDCASE 
     256         if earth[0] NE -1 then res[earth] = valmask 
    243257      END 
    244258;------------------------------------------------------------ 
Note: See TracChangeset for help on using the changeset viewer.