Ignore:
Timestamp:
03/16/14 20:38:39 (10 years ago)
Author:
pinsard
Message:

fix thanks to coding rules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/forcagequimarche.pro

    r36 r48  
    22; 
    33; @file_comments 
    4 ; calcul d'une matrice 3D de conductivité sigma=f(T,S) en fonction de T et S 
     4; calcul d'une matrice 3D de conductivité sigma=f(T,S) en fonction de T et S 
    55; de ORCA, sur la grille T 
    66; 
     
    6767; 
    6868PRO forcagequimarche, orcares, iyear, ian, DRAKKAR_EXP = drakkar_exp 
    69 ; 
    70 ;---- 
    71 ; check input parameters 
    72 ;---- 
    73 ; 
    74 ; check orcares definition 
    75 ; 
    76   CASE orcares OF 
    77      'ORCA2': BEGIN 
    78                  msg = 'iii : valid orcares parameter = ' + orcares 
    79                  ras = report(msg) 
    80                  filename_oce = 'meshmask_bab.nc' 
    81                  IF keyword_set(DRAKKAR_EXP) THEN BEGIN 
    82                     msg = 'www : unused DRAKKAR_EXP keyword = ' + drakkar_exp 
    83                     ras = report(msg) 
    84                  END 
     69    ; 
     70    ;---- 
     71    ; check input parameters 
     72    ;---- 
     73    ; 
     74    ; check orcares definition 
     75    ; 
     76    CASE orcares OF 
     77       'ORCA2': BEGIN 
     78                   msg = 'iii : valid orcares parameter = ' + orcares 
     79                   ras = report(msg) 
     80                   filename_oce = 'meshmask_bab.nc' 
     81                   IF keyword_set(DRAKKAR_EXP) THEN BEGIN 
     82                      msg = 'www : unused DRAKKAR_EXP keyword = ' + drakkar_exp 
     83                      ras = report(msg) 
     84                   END 
     85        END 
     86        ELSE : BEGIN 
     87                   msg = 'eee : invalid orcares parameter = ' + orcares 
     88                   ras = report(msg) 
     89                   msg = 'eee : orcares must be ORCA2 or ORCA025++' 
     90                   ras = report(msg) 
     91                   RETURN 
     92        END 
     93    ENDCASE 
     94   
     95    ; ++ check iyear 
     96    ; ++ check ian 
     97     
     98    ;++@init2 
     99    ; init grid 
     100    initocemeshmask, orcares, DRAKKAR_EXP = drakkar_exp 
     101   
     102    @common 
     103    ; 
     104    ; check for input files 
     105    ; 
     106    ; test if ${GEOMAG_ID} defined 
     107    geomag_id_env=GETENV('GEOMAG_ID') 
     108    CASE geomag_id_env OF 
     109       ''  :  BEGIN 
     110                msg = 'eee : ${GEOMAG_ID} is not defined' 
     111                ras = report(msg) 
     112                RETURN 
    85113              END 
    86       ELSE  : BEGIN 
    87                  msg = 'eee : invalid orcares parameter = ' + orcares 
    88                  ras = report(msg) 
    89                  msg = 'eee : orcares must be ORCA2 or ORCA025++' 
    90                  ras = report(msg) 
    91                  RETURN 
    92               END 
     114       ELSE : BEGIN 
     115               msg = 'iii : ${GEOMAG_ID} is ' + geomag_id_env 
     116               ras = report(msg) 
     117       END 
     118    ENDCASE 
     119    ; 
     120    iodirin = isadirectory(geomag_id_env) 
     121    ; 
     122  ; existence and protection of ${GEOMAG_ID} 
     123    IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN 
     124       msg = 'eee : the directory' + iodirin  + ' is not accessible.' 
     125       ras = report(msg) 
     126       RETURN 
     127    ENDIF 
     128  ; 
     129  ; test if ${GEOMAG_OD} defined 
     130    geomag_od_env=GETENV('GEOMAG_OD') 
     131    CASE geomag_od_env OF 
     132       '' : BEGIN 
     133               msg = 'eee : ${GEOMAG_OD} is not defined' 
     134               ras = report(msg) 
     135               RETURN 
     136            END 
     137       ELSE : BEGIN 
     138               msg = 'iii : ${GEOMAG_OD} is ' + geomag_od_env 
     139               ras = report(msg) 
     140             END 
    93141  ENDCASE 
    94  
    95 ; ++ check iyear 
    96 ; ++ check ian 
    97  
    98 ;++@init2 
    99 ; init grid 
    100 initocemeshmask, orcares, DRAKKAR_EXP = drakkar_exp 
    101  
    102 @common 
    103 ; 
    104 ; check for input files 
    105 ; 
    106 ; test if ${GEOMAG_ID} defined 
    107   geomag_id_env=GETENV('GEOMAG_ID') 
    108   CASE geomag_id_env OF 
    109      ''  :  BEGIN 
    110               msg = 'eee : ${GEOMAG_ID} is not defined' 
    111               ras = report(msg) 
    112               RETURN 
    113             END 
    114      ELSE: BEGIN 
    115              msg = 'iii : ${GEOMAG_ID} is ' + geomag_id_env 
    116              ras = report(msg) 
    117            END 
    118   ENDCASE 
    119 ; 
    120   iodirin = isadirectory(geomag_id_env) 
    121 ; 
    122 ; existence and protection of ${GEOMAG_ID} 
    123   IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN 
    124      msg = 'eee : the directory' + iodirin  + ' is not accessible.' 
    125      ras = report(msg) 
    126      RETURN 
    127   ENDIF 
    128 ; 
    129 ; test if ${GEOMAG_OD} defined 
    130   geomag_od_env=GETENV('GEOMAG_OD') 
    131   CASE geomag_od_env OF 
    132      '' : BEGIN 
    133              msg = 'eee : ${GEOMAG_OD} is not defined' 
    134              ras = report(msg) 
    135              RETURN 
    136           END 
    137      ELSE: BEGIN 
    138              msg = 'iii : ${GEOMAG_OD} is ' + geomag_od_env 
    139              ras = report(msg) 
    140            END 
    141   ENDCASE 
    142 ; 
    143 ; check if output data will be possible 
    144   iodirout = isadirectory(geomag_od_env) 
    145 ; 
    146 ; existence and protection 
    147   IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN 
    148      msg = 'eee : the directory' + iodirout  + ' was not found.' 
    149      ras = report(msg) 
    150      RETURN 
    151   ENDIF 
    152 ; 
    153 e_exp='ESS' 
    154 key_portrait = 0 
    155 ; stockage des fichiers brut 
    156   ioDATA=geomag_id_env 
    157  
    158   CASE orcares OF 
    159      'ORCA2': BEGIN 
    160   file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' 
    161   file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' 
    162   file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc' 
    163 jpt = 73 ;time counter des fichiers ci-dessus 
    164      END 
    165   ENDCASE 
    166   file_Sed= geomag_id_env+'cond_sed_'+orcares+'.nc' 
    167   file_Br= geomag_id_env+'Br_'+orcares + '.nc' 
    168 ; 
    169 ; title 
    170      t_exp= e_exp 
    171      t_bt  = 'bar_transp' 
    172 ioORLN2 = geomag_id_env 
    173 ; 
    174 ;facteur d'echelle vertical for partial steps 
    175 e3v3d=read_ncdf('e3v_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc') 
    176 e3u3d=read_ncdf('e3u_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc') 
    177 SIGMAsed=read_ncdf('cond_sed',0,/timestep,/nostruct,/tout,filename=file_Sed,/cont_nofill) 
    178 ;BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br) 
    179 BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br,/cont_nofill) 
    180 ; 
    181 ; vertical integration: 
    182 e3t3d=make_array(jpi,jpj,jpk) 
    183         for k=0, jpk-1 do begin              &$ 
    184           for j=0,jpj-1 do begin              &$ 
    185             for i=0,jpi-1 do begin             &$ 
    186               e3t3d(i,j,k) = e3t(k)    &$ 
    187             endfor                     &$ 
    188           endfor                      &$ 
    189         endfor 
    190 ; 
    191 ;vud = make_array(jpi,jpj,jpt) 
    192 ;vvd = make_array(jpi, jpj, jpt) 
    193 divBustar = make_array(jpi, jpj, jpt) 
    194 diver3=replicate(0.,182,149,1,jpt) 
    195 sigma3=replicate(0.,182,149,1,jpt) 
    196 ; 
    197 FOR jt = 0, jpt-1 DO BEGIN &$ 
    198 ; 
    199 ; ouverture des fichiers et stockage en memoire partial steps 
    200   vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U)  &$ 
     142  ; 
     143  ; check if output data will be possible 
     144    iodirout = isadirectory(geomag_od_env) 
     145  ; 
     146  ; existence and protection 
     147    IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN 
     148       msg = 'eee : the directory' + iodirout  + ' was not found.' 
     149       ras = report(msg) 
     150       RETURN 
     151    ENDIF 
     152  ; 
     153  e_exp='ESS' 
     154  key_portrait = 0 
     155  ; stockage des fichiers brut 
     156    ioDATA=geomag_id_env 
     157   
     158    CASE orcares OF 
     159       'ORCA2': BEGIN 
     160    file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' 
     161    file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' 
     162    file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc' 
     163  jpt = 73 ;time counter des fichiers ci-dessus 
     164       END 
     165    ENDCASE 
     166    file_Sed= geomag_id_env+'cond_sed_'+orcares+'.nc' 
     167    file_Br= geomag_id_env+'Br_'+orcares + '.nc' 
     168  ; 
     169  ; title 
     170       t_exp= e_exp 
     171       t_bt  = 'bar_transp' 
     172  ioORLN2 = geomag_id_env 
     173  ; 
     174  ;facteur d'echelle vertical for partial steps 
     175  e3v3d=read_ncdf('e3v_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc') 
     176  e3u3d=read_ncdf('e3u_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc') 
     177  SIGMAsed=read_ncdf('cond_sed',0,/timestep,/nostruct,/tout,filename=file_Sed,/cont_nofill) 
     178  ;BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br) 
     179  BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br,/cont_nofill) 
     180  ; 
     181  ; vertical integration: 
     182  e3t3d=make_array(jpi,jpj,jpk) 
     183          for k=0, jpk-1 do begin              &$ 
     184            for j=0,jpj-1 do begin              &$ 
     185              for i=0,jpi-1 do begin             &$ 
     186                e3t3d(i,j,k) = e3t(k)    &$ 
     187              endfor                     &$ 
     188            endfor                      &$ 
     189          endfor 
     190  ; 
     191  ;vud = make_array(jpi,jpj,jpt) 
     192  ;vvd = make_array(jpi, jpj, jpt) 
     193  divBustar = make_array(jpi, jpj, jpt) 
     194  diver3=replicate(0.,182,149,1,jpt) 
     195  sigma3=replicate(0.,182,149,1,jpt) 
     196  ; 
     197  FOR jt = 0, jpt-1 DO BEGIN &$ 
     198  ; 
     199  ; ouverture des fichiers et stockage en memoire partial steps 
     200    vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U)  &$ 
     201  ;stop 
     202    vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V)  &$ 
     203  ;stop 
     204  ; lecture salinite & temperature 
     205    temp= read_ncdf('votemper',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T) 
     206  ;stop 
     207    salin=read_ncdf('vosaline',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T) 
     208  ;stop 
     209    conduct=0.02047780622061 + 0.00273147624197*temp + 0.00035133182334*temp*temp + 0.09139808809909*salin + 0.00241425798890*salin*temp -0.00023998958774*salin*salin 
     210    mask_t=where(conduct GT 1.e+19) 
     211    conduct(mask_t)=0. 
     212  ; Somme conduct au point T 
     213  ; 
     214  ; Calcul SIGMA 
     215  ; 
     216    SIGMAoc=total(conduct*e3t3d*tmask,3) 
     217    SIGMA=SIGMAsed+SIGMAoc 
     218  ; 
     219    SIGMA_u=(SIGMA+shift(SIGMA,-1,0))/2. 
     220    SIGMA_v=(SIGMA+shift(SIGMA,0,1))/2. 
     221  ; 
     222  ; Calcul B en points u et v 
     223  ; 
     224    BR_u=(BR+shift(BR,-1,0))/2. 
     225    BR_v=(BR+shift(BR,0,1))/2. 
     226  ; 
     227  ; Calcul integrale conduct 
     228  ; 
     229    conduct_u=(conduct+shift(conduct,-1,0,0))/2. 
     230    conduct_v=(conduct+shift(conduct,0,1,0))/2. 
     231  ; 
     232    u_cond_u=total( vu*conduct_u*e3u3d*umask(),3) 
     233    v_cond_v=total( vv*conduct_v*e3v3d*vmask(),3) 
     234  ; 
     235    Bu_star= BR_u*u_cond_u/SIGMA_u 
     236    Bv_star= BR_v*v_cond_v/SIGMA_v 
     237   
     238  ; Transport horizontal 
     239    T_u=total( vu*e3u3d*umask(),3) 
     240    T_v=total( vv*e3v3d*vmask(),3) 
     241   
     242  ; 
     243  ; Divergence du champ 
     244    Diver=divfred(Bu_star,Bv_star) 
     245   
     246  Diver=Diver*1e-6 
     247  ;stop 
     248  lecontinent=where(Diver GT 1.E08) 
     249  Diver(lecontinent)=0. 
     250 
    201251;stop 
    202   vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V)  &$ 
    203 ;stop 
    204 ; lecture salinite & temperature 
    205   temp= read_ncdf('votemper',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T) 
    206 ;stop 
    207   salin=read_ncdf('vosaline',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T) 
    208 ;stop 
    209   conduct=0.02047780622061 + 0.00273147624197*temp + 0.00035133182334*temp*temp + 0.09139808809909*salin + 0.00241425798890*salin*temp -0.00023998958774*salin*salin 
    210   mask_t=where(conduct GT 1.e+19) 
    211   conduct(mask_t)=0. 
    212 ; Somme conduct au point T 
    213 ; 
    214 ; Calcul SIGMA 
    215 ; 
    216   SIGMAoc=total(conduct*e3t3d*tmask,3) 
    217   SIGMA=SIGMAsed+SIGMAoc 
    218 ; 
    219   SIGMA_u=(SIGMA+shift(SIGMA,-1,0))/2. 
    220   SIGMA_v=(SIGMA+shift(SIGMA,0,1))/2. 
    221 ; 
    222 ; Calcul B en points u et v 
    223 ; 
    224   BR_u=(BR+shift(BR,-1,0))/2. 
    225   BR_v=(BR+shift(BR,0,1))/2. 
    226 ; 
    227 ; Calcul integrale conduct 
    228 ; 
    229   conduct_u=(conduct+shift(conduct,-1,0,0))/2. 
    230   conduct_v=(conduct+shift(conduct,0,1,0))/2. 
    231 ; 
    232   u_cond_u=total( vu*conduct_u*e3u3d*umask(),3) 
    233   v_cond_v=total( vv*conduct_v*e3v3d*vmask(),3) 
    234 ; 
    235   Bu_star= BR_u*u_cond_u/SIGMA_u 
    236   Bv_star= BR_v*v_cond_v/SIGMA_v 
    237  
    238 ; Transport horizontal 
    239   T_u=total( vu*e3u3d*umask(),3) 
    240   T_v=total( vv*e3v3d*vmask(),3) 
    241  
    242 ; 
    243 ; Divergence du champ 
    244   Diver=divfred(Bu_star,Bv_star) 
    245  
    246 Diver=Diver*1e-6 
    247 ;stop 
    248 lecontinent=where(Diver GT 1.E08) 
    249 Diver(lecontinent)=0. 
    250  
    251 ;stop 
    252 ;bande de recouvrement:: 
     252;bande de recouvrement: 
    253253 
    254254diver3(1:180,0:147,*,jt)=Diver(*,*) 
     
    342342 
    343343   NCDF_CLOSE, idout 
    344 ; ++ l'équivalent avec forcage_output 
     344; ++ l'équivalent avec forcage_output 
    345345forcage_output, orcares, variable, 'Divergence', long_name, jpiglo, jpjglo, gphit, glamt,diver3 
    346346 
Note: See TracChangeset for help on using the changeset viewer.