Changeset 451


Ignore:
Timestamp:
03/22/11 10:33:45 (13 years ago)
Author:
smasson
Message:

update meshmask related file for full compatibility with partial steps

Location:
trunk/SRC
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Commons/cm_4mesh.pro

    r238 r451  
    2626; not used (as far as I know...) COMMON coriolis, ff 
    2727COMMON vertical, gdept, gdepw, e3t, e3w 
    28 COMMON partial_steps, hdept, hdepw, e3t_ps, e3w_ps, e3u_ps, e3v_ps 
     28COMMON partial_steps, hdept, hdepw, e3t_ps, e3w_ps 
    2929COMMON keys_grid, key_shift, key_periodic, key_stride, key_gridtype, key_yreverse, key_zreverse, key_partialstep, key_onearth 
    3030; 
  • trunk/SRC/Grid/micromeshmask.pro

    r394 r451  
    103103  zgr_varlist = ncdf_listvars(cdfid) 
    104104  zgr_varlist = strtrim(strlowcase(zgr_varlist), 2) 
     105; is e3t a real 3D array? 
     106  IF (where(zgr_varlist EQ 'e3t'))[0] NE -1 THEN BEGIN  
     107    varinq = ncdf_varinq(cdfid, 'e3t') 
     108    if varinq.ndims GE 3 THEN BEGIN 
     109      ncdf_diminq, cdfid, varinq.dim[0], name, iii 
     110      ncdf_diminq, cdfid, varinq.dim[1], name, jjj 
     111      ncdf_diminq, cdfid, varinq.dim[2], name, kkk 
     112      IF iii EQ jpi AND jjj EQ jpj AND kkk EQ jpk THEN key_e3_3d = 1 
     113    ENDIF    
     114  ENDIF 
     115; is gdept a real 3D array? 
     116  IF (where(zgr_varlist EQ 'gdept'))[0] NE -1 THEN BEGIN  
     117    varinq = ncdf_varinq(cdfid, 'gdept') 
     118    if varinq.ndims GE 3 THEN BEGIN 
     119      ncdf_diminq, cdfid, varinq.dim[0], name, iii 
     120      ncdf_diminq, cdfid, varinq.dim[1], name, jjj 
     121      ncdf_diminq, cdfid, varinq.dim[2], name, kkk 
     122      IF iii EQ jpi AND jjj EQ jpj AND kkk EQ jpk THEN key_gdep_3d = 1 
     123    ENDIF    
     124  ENDIF 
    105125;------------------------------------------------------ 
    106126;------------------------------------------------------ 
     
    134154    varid[16+z] = ncdf_vardef(cdfidout, zgrlist[z], [dimidz], /float) 
    135155; variables related to the partial steps 
    136   IF (where(zgr_varlist EQ 'hdept'))[0] NE -1 THEN $ 
     156  with_partial = keyword_set(key_e3_3d) OR (where(zgr_varlist EQ 'hdept'))[0] NE -1 $ 
     157                 OR (where(zgr_varlist EQ 'e3tp'))[0] NE -1 $ 
     158                 OR (where(zgr_varlist EQ 'e3t_ps'))[0] NE -1 
     159  IF with_partial THEN BEGIN 
    137160    varid = [varid, ncdf_vardef(cdfidout, 'hdept', [dimidx, dimidy], /float)] 
    138   IF (where(zgr_varlist EQ 'hdepw'))[0] NE -1 THEN $ 
    139161    varid = [varid, ncdf_vardef(cdfidout, 'hdepw', [dimidx, dimidy], /float)] 
    140 ; old variable name. keep for compatibility with old run. Change e3tp to e3t_ps 
    141   IF (where(zgr_varlist EQ 'e3tp'))[0] NE -1 THEN $ 
    142162    varid = [varid, ncdf_vardef(cdfidout, 'e3t_ps', [dimidx, dimidy], /float)] 
    143 ; old variable name. keep for compatibility with old run. Change e3wp to e3w_ps 
    144   IF (where(zgr_varlist EQ 'e3wp'))[0] NE -1 THEN $ 
    145163    varid = [varid, ncdf_vardef(cdfidout, 'e3w_ps', [dimidx, dimidy], /float)] 
    146 ; 
    147   IF (where(zgr_varlist EQ 'e3t_ps'))[0] NE -1 THEN $ 
    148     varid = [varid, ncdf_vardef(cdfidout, 'e3t_ps', [dimidx, dimidy], /float)] 
    149   IF (where(zgr_varlist EQ 'e3w_ps'))[0] NE -1 THEN $ 
    150     varid = [varid, ncdf_vardef(cdfidout, 'e3w_ps', [dimidx, dimidy], /float)] 
    151 ;   IF (where(zgr_varlist EQ 'e3u_ps'))[0] NE -1 THEN $ 
    152 ;     varid = [varid, ncdf_vardef(cdfidout, 'e3u_ps', [dimidx, dimidy], /float)] 
    153 ;   IF (where(zgr_varlist EQ 'e3v_ps'))[0] NE -1 THEN $ 
    154 ;     varid = [varid, ncdf_vardef(cdfidout, 'e3v_ps', [dimidx, dimidy], /float)] 
     164  ENDIF 
     165; 
    155166  IF (where(zgr_varlist EQ 'mbathy'))[0] NE -1 THEN $ 
    156167    varid = [varid, ncdf_vardef(cdfidout, 'mbathy', [dimidx, dimidy], /short)] 
     
    191202    ncdf_transfer, cdfid, cdfidout, inzgrlist[z], zgrlist[z] 
    192203; partial step variables 
    193   IF (where(zgr_varlist EQ 'hdept'))[0] NE -1 THEN $ 
    194     ncdf_transfer, cdfid, cdfidout, 'hdept' 
    195   IF (where(zgr_varlist EQ 'hdepw'))[0] NE -1 THEN $ 
    196     ncdf_transfer, cdfid, cdfidout, 'hdepw' 
    197   IF (where(zgr_varlist EQ 'e3tp'))[0] NE -1 THEN $ 
    198     ncdf_transfer, cdfid, cdfidout, 'e3tp', 'e3t_ps' 
    199   IF (where(zgr_varlist EQ 'e3wp'))[0] NE -1 THEN $ 
    200     ncdf_transfer, cdfid, cdfidout, 'e3wp', 'e3w_ps' 
    201   IF (where(zgr_varlist EQ 'e3t_ps'))[0] NE -1 THEN $ 
    202     ncdf_transfer, cdfid, cdfidout, 'e3t_ps' 
    203   IF (where(zgr_varlist EQ 'e3w_ps'))[0] NE -1 THEN $ 
    204     ncdf_transfer, cdfid, cdfidout, 'e3w_ps' 
    205 ;   IF (where(zgr_varlist EQ 'e3u_ps'))[0] NE -1 THEN $ 
    206 ;     ncdf_transfer, cdfid, cdfidout, 'e3u_ps' 
    207 ;   IF (where(zgr_varlist EQ 'e3v_ps'))[0] NE -1 THEN $ 
    208 ;     ncdf_transfer, cdfid, cdfidout, 'e3v_ps' 
    209   IF (where(zgr_varlist EQ 'mbathy'))[0] NE -1 THEN $ 
    210     ncdf_transfer, cdfid, cdfidout, 'mbathy' 
     204  IF (where(zgr_varlist EQ 'hdept' ))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'hdept' 
     205  IF (where(zgr_varlist EQ 'hdepw' ))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'hdepw' 
     206  IF (where(zgr_varlist EQ 'e3tp'  ))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'e3tp', 'e3t_ps' 
     207  IF (where(zgr_varlist EQ 'e3wp'  ))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'e3wp', 'e3w_ps' 
     208  IF (where(zgr_varlist EQ 'e3t_ps'))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'e3t_ps' 
     209  IF (where(zgr_varlist EQ 'e3w_ps'))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'e3w_ps' 
     210  IF (where(zgr_varlist EQ 'mbathy'))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'mbathy' 
     211; 
     212  IF keyword_set(key_e3_3d)  THEN BEGIN 
     213; get the bottom 
     214    CASE (ncdf_varinq(cdfid, 'mbathy')).ndims OF 
     215      2:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj] 
     216      3:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj, 1] 
     217      4:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj, 1, 1] 
     218    ENDCASE 
     219    bottom = 0L > ( long(bat) - 1L ) 
     220    bottom = lindgen(jpi, jpj) + jpi*jpj*temporary(bottom) 
     221; 
     222    CASE (ncdf_varinq(cdfid, 'e3t')).ndims OF 
     223      3:ncdf_varget, cdfid, 'e3t', res, count = [jpi, jpj, jpk] 
     224      4:ncdf_varget, cdfid, 'e3t', res, count = [jpi, jpj, jpk, 1] 
     225    ENDCASE 
     226    ncdf_varput, cdfidout, 'e3t_ps', (temporary(res))[bottom] * (bat NE 0L) 
     227; 
     228    CASE (ncdf_varinq(cdfid, 'e3w')).ndims OF 
     229      3:ncdf_varget, cdfid, 'e3w', res, count = [jpi, jpj, jpk] 
     230      4:ncdf_varget, cdfid, 'e3w', res, count = [jpi, jpj, jpk, 1] 
     231    ENDCASE 
     232    ncdf_varput, cdfidout, 'e3w_ps', (temporary(res))[bottom] * (bat NE 0L) 
     233  ENDIF 
     234; 
     235  IF keyword_set(key_gdep_3d)  THEN BEGIN 
     236; get the bottom 
     237    CASE (ncdf_varinq(cdfid, 'mbathy')).ndims OF 
     238      2:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj] 
     239      3:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj, 1] 
     240      4:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj, 1, 1] 
     241    ENDCASE 
     242    bottom = 0L > ( long(bat) - 1L ) 
     243    bottom = lindgen(jpi, jpj) + jpi*jpj*temporary(bottom) 
     244; 
     245    CASE (ncdf_varinq(cdfid, 'gdept')).ndims OF 
     246      3:ncdf_varget, cdfid, 'gdept', res, count = [jpi, jpj, jpk] 
     247      4:ncdf_varget, cdfid, 'gdept', res, count = [jpi, jpj, jpk, 1] 
     248    ENDCASE 
     249    ncdf_varput, cdfidout, 'hdept', (temporary(res))[bottom] * (bat NE 0L) 
     250; 
     251    bottom = jpi*jpj + temporary(bottom) 
     252    CASE (ncdf_varinq(cdfid, 'gdepw')).ndims OF 
     253      3:ncdf_varget, cdfid, 'gdepw', res, count = [jpi, jpj, jpk] 
     254      4:ncdf_varget, cdfid, 'gdepw', res, count = [jpi, jpj, jpk, 1] 
     255    ENDCASE 
     256    ncdf_varput, cdfidout, 'hdepw', (temporary(res))[bottom] * (bat NE 0L) 
     257  ENDIF 
    211258; 
    212259; mask 
  • trunk/SRC/Grid/ncdf_meshread.pro

    r371 r451  
    281281; for the variables related to the partial steps 
    282282  allvarname =  ncdf_listvars(cdfid) 
     283; 
     284  key_partialstep = 0 
     285  hdept = -1 
     286  hdepw = -1 
    283287  IF (where(allvarname EQ 'hdept'))[0] NE -1 THEN BEGIN 
    284288    key_partialstep = 1 
    285289    namevar = [namevar, 'hdept', 'hdepw'] 
    286   ENDIF ELSE BEGIN 
    287     key_partialstep = 0 
    288     hdept = -1 
    289     hdepw = -1 
    290   ENDELSE 
     290  ENDIF 
     291; is gdept a real 3D array? 
     292  IF (where(allvarname EQ 'gdept' ))[0] NE -1 THEN BEGIN 
     293    varinq = ncdf_varinq(cdfid, 'gdept') 
     294    if varinq.ndims GE 3 THEN BEGIN 
     295      ncdf_diminq, cdfid, varinq.dim[0], name, iii 
     296      ncdf_diminq, cdfid, varinq.dim[1], name, jjj 
     297      ncdf_diminq, cdfid, varinq.dim[2], name, kkk 
     298      IF iii EQ jpiglo AND jjj EQ jpjglo AND kkk EQ jpkglo THEN key_gdep_3d = 1 
     299    ENDIF    
     300  ENDIF    
    291301; for compatibility with old versions of meshmask/partial steps 
    292   IF (where(allvarname EQ 'e3tp'))[0] NE -1 THEN $ 
    293     namevar = [namevar, 'e3tp', 'e3wp'] ELSE BEGIN 
    294     e3t_ps = -1 
    295     e3w_ps = -1 
    296   ENDELSE 
    297   IF (where(allvarname EQ 'e3t_ps'))[0] NE -1 $ 
    298   THEN namevar = [namevar, 'e3t_ps', 'e3w_ps' ]ELSE BEGIN 
    299     e3t_ps = -1 
    300     e3w_ps = -1 
    301   ENDELSE 
    302   IF (where(allvarname EQ 'e3u_ps'))[0] NE -1 $ 
    303   THEN namevar = [namevar, 'e3u_ps', 'e3v_ps'] ELSE BEGIN 
    304     e3u_ps = -1 
    305     e3v_ps = -1 
    306   ENDELSE 
     302  e3t_ps = -1 
     303  e3w_ps = -1 
     304  IF (where(allvarname EQ 'e3tp'  ))[0] NE -1 THEN namevar = [namevar, 'e3tp', 'e3wp'] 
     305  IF (where(allvarname EQ 'e3t_ps'))[0] NE -1 THEN namevar = [namevar, 'e3t_ps', 'e3w_ps' ] 
     306; is e3t a real 3D array? 
     307  IF (where(allvarname EQ 'e3t'   ))[0] NE -1 THEN BEGIN 
     308    varinq = ncdf_varinq(cdfid, 'e3t') 
     309    if varinq.ndims GE 3 THEN BEGIN 
     310      ncdf_diminq, cdfid, varinq.dim[0], name, iii 
     311      ncdf_diminq, cdfid, varinq.dim[1], name, jjj 
     312      ncdf_diminq, cdfid, varinq.dim[2], name, kkk 
     313      IF iii EQ jpiglo AND jjj EQ jpjglo AND kkk EQ jpkglo THEN BEGIN 
     314        key_e3_3d = 1 
     315        key_partialstep = 1 
     316      ENDIF 
     317    ENDIF    
     318  ENDIF 
    307319; 
    308320; read all the 2d variables 
     
    312324    name = varinq.name 
    313325@read_ncdf_varget 
    314     command = namevar[i]+'=float(temporary(res))' 
     326    IF strmid(name, 0, 2) EQ 'e3' THEN command = namevar[i]+' = temporary(res)' $ 
     327    ELSE command = namevar[i]+' = float(temporary(res))' 
    315328    nothing = execute(command) 
    316329  ENDFOR 
     
    403416    tmask = byte(res) 
    404417  ENDELSE 
     418; if e3t is true 3D array... 
     419  IF keyword_set(key_e3_3d)  THEN BEGIN 
     420    bottom = 0 > ( total(tmask, 3)-1 ) 
     421    bottom = lindgen(jpi, jpj) + jpi*jpj*temporary(bottom) 
     422; 
     423    varinq = ncdf_varinq(cdfid, 'e3t') 
     424    name = varinq.name 
     425@read_ncdf_varget 
     426    e3t_ps = (temporary(res))[bottom] * tmask[*, *, 0] 
     427; 
     428    varinq = ncdf_varinq(cdfid, 'e3w') 
     429    name = varinq.name 
     430@read_ncdf_varget 
     431    e3w_ps = (temporary(res))[bottom] * tmask[*, *, 0] 
     432  ENDIF 
     433; if gdep is true 3D array... 
     434  IF keyword_set(key_gdep_3d) THEN BEGIN 
     435    bottom = 0 > ( total(tmask, 3)-1 ) 
     436    bottom = lindgen(jpi, jpj) + jpi*jpj*temporary(bottom) 
     437; 
     438    varinq = ncdf_varinq(cdfid, 'gdept') 
     439    name = varinq.name 
     440@read_ncdf_varget 
     441    hdept = (temporary(res))[bottom] * tmask[*, *, 0] 
     442; 
     443    bottom = jpi*jpj + temporary(bottom) 
     444    varinq = ncdf_varinq(cdfid, 'gdepw') 
     445    name = varinq.name 
     446@read_ncdf_varget 
     447    hdepw = (temporary(res))[bottom] * tmask[*, *, 0] 
     448  ENDIF 
    405449; boundary conditions used to compute umask. 
    406450  IF ncdf_varid(cdfid, 'umask') NE -1 THEN BEGIN  
  • trunk/SRC/Grid/smallmeshmask.pro

    r371 r451  
    108108  zgr_varlist = ncdf_listvars(cdfid) 
    109109  zgr_varlist = strtrim(strlowcase(zgr_varlist), 2) 
    110 ;------------------------------------------------------ 
     110; is e3t a real 3D array? 
     111  IF (where(zgr_varlist EQ 'e3t'))[0] NE -1 THEN BEGIN  
     112    varinq = ncdf_varinq(cdfid, 'e3t') 
     113    if varinq.ndims GE 3 THEN BEGIN 
     114      ncdf_diminq, cdfid, varinq.dim[0], name, iii 
     115      ncdf_diminq, cdfid, varinq.dim[1], name, jjj 
     116      ncdf_diminq, cdfid, varinq.dim[2], name, kkk 
     117      IF iii EQ jpi AND jjj EQ jpj AND kkk EQ jpk THEN key_e3_3d = 1 
     118    ENDIF    
     119  ENDIF 
     120; is gdept a real 3D array? 
     121  IF (where(zgr_varlist EQ 'gdept'))[0] NE -1 THEN BEGIN  
     122    varinq = ncdf_varinq(cdfid, 'gdept') 
     123    if varinq.ndims GE 3 THEN BEGIN 
     124      ncdf_diminq, cdfid, varinq.dim[0], name, iii 
     125      ncdf_diminq, cdfid, varinq.dim[1], name, jjj 
     126      ncdf_diminq, cdfid, varinq.dim[2], name, kkk 
     127      IF iii EQ jpi AND jjj EQ jpj AND kkk EQ jpk THEN key_gdep_3d = 1 
     128    ENDIF    
     129  ENDIF 
    111130;------------------------------------------------------ 
    112131; 
     
    139158    varid[16+z] = ncdf_vardef(cdfidout, zgrlist[z], [dimidz], /float) 
    140159; variables related to the partial steps 
    141   IF (where(zgr_varlist EQ 'hdept'))[0] NE -1 THEN $ 
     160  with_partial = keyword_set(key_e3_3d) OR (where(zgr_varlist EQ 'hdept'))[0] NE -1 $ 
     161                 OR (where(zgr_varlist EQ 'e3tp'))[0] NE -1 $ 
     162                 OR (where(zgr_varlist EQ 'e3t_ps'))[0] NE -1 
     163  IF with_partial THEN BEGIN 
    142164    varid = [varid, ncdf_vardef(cdfidout, 'hdept', [dimidx, dimidy], /float)] 
    143   IF (where(zgr_varlist EQ 'hdepw'))[0] NE -1 THEN $ 
    144165    varid = [varid, ncdf_vardef(cdfidout, 'hdepw', [dimidx, dimidy], /float)] 
    145 ; old variable name. keep for compatibility with old run. Change e3tp to e3t_ps 
    146   IF (where(zgr_varlist EQ 'e3tp'))[0] NE -1 THEN $ 
    147166    varid = [varid, ncdf_vardef(cdfidout, 'e3t_ps', [dimidx, dimidy], /float)] 
    148 ; old variable name. keep for compatibility with old run. Change e3wp to e3w_ps 
    149   IF (where(zgr_varlist EQ 'e3wp'))[0] NE -1 THEN $ 
    150167    varid = [varid, ncdf_vardef(cdfidout, 'e3w_ps', [dimidx, dimidy], /float)] 
    151 ; 
    152   IF (where(zgr_varlist EQ 'e3t_ps'))[0] NE -1 THEN $ 
    153     varid = [varid, ncdf_vardef(cdfidout, 'e3t_ps', [dimidx, dimidy], /float)] 
    154   IF (where(zgr_varlist EQ 'e3w_ps'))[0] NE -1 THEN $ 
    155     varid = [varid, ncdf_vardef(cdfidout, 'e3w_ps', [dimidx, dimidy], /float)] 
    156 ;   IF (where(zgr_varlist EQ 'e3u_ps'))[0] NE -1 THEN $ 
    157 ;     varid = [varid, ncdf_vardef(cdfidout, 'e3u_ps', [dimidx, dimidy], /float)] 
    158 ;   IF (where(zgr_varlist EQ 'e3v_ps'))[0] NE -1 THEN $ 
    159 ;     varid = [varid, ncdf_vardef(cdfidout, 'e3v_ps', [dimidx, dimidy], /float)] 
     168  ENDIF 
     169; 
    160170  IF (where(zgr_varlist EQ 'mbathy'))[0] NE -1 THEN $ 
    161171    varid = [varid, ncdf_vardef(cdfidout, 'mbathy', [dimidx, dimidy], /short)] 
     
    163173  msklist = ['tmask', 'umask', 'vmask', 'fmask'] 
    164174  FOR m = 0, n_elements(msklist)-1 DO $ 
    165     varid = [varid, ncdf_vardef(cdfidout, msklist[m] $ 
    166                                 , [dimidx, dimidy, dimidz], /byte)] 
     175    varid = [varid, ncdf_vardef(cdfidout, msklist[m], [dimidx, dimidy, dimidz], /byte)] 
    167176;------------------------------------------------------ 
    168177;------------------------------------------------------ 
     
    189198  inzgrlist =  zgrlist 
    190199  IF (where(zgr_varlist EQ 'gdept_0'))[0] NE -1 THEN inzgrlist =  inzgrlist+'_0' 
    191   FOR z = 0, n_elements(zgrlist)-1 DO $ 
    192     ncdf_transfer, cdfid, cdfidout, inzgrlist[z], zgrlist[z] 
     200  FOR z = 0, n_elements(zgrlist)-1 DO ncdf_transfer, cdfid, cdfidout, inzgrlist[z], zgrlist[z] 
    193201; partial step variables 
    194   IF (where(zgr_varlist EQ 'hdept'))[0] NE -1 THEN $ 
    195     ncdf_transfer, cdfid, cdfidout, 'hdept' 
    196   IF (where(zgr_varlist EQ 'hdepw'))[0] NE -1 THEN $ 
    197     ncdf_transfer, cdfid, cdfidout, 'hdepw' 
    198   IF (where(zgr_varlist EQ 'e3tp'))[0] NE -1 THEN $ 
    199     ncdf_transfer, cdfid, cdfidout, 'e3tp', 'e3t_ps' 
    200   IF (where(zgr_varlist EQ 'e3wp'))[0] NE -1 THEN $ 
    201     ncdf_transfer, cdfid, cdfidout, 'e3wp', 'e3w_ps' 
    202   IF (where(zgr_varlist EQ 'e3t_ps'))[0] NE -1 THEN $ 
    203     ncdf_transfer, cdfid, cdfidout, 'e3t_ps' 
    204   IF (where(zgr_varlist EQ 'e3w_ps'))[0] NE -1 THEN $ 
    205     ncdf_transfer, cdfid, cdfidout, 'e3w_ps' 
    206 ;   IF (where(zgr_varlist EQ 'e3u_ps'))[0] NE -1 THEN $ 
    207 ;     ncdf_transfer, cdfid, cdfidout, 'e3u_ps' 
    208 ;   IF (where(zgr_varlist EQ 'e3v_ps'))[0] NE -1 THEN $ 
    209 ;     ncdf_transfer, cdfid, cdfidout, 'e3v_ps' 
    210   IF (where(zgr_varlist EQ 'mbathy'))[0] NE -1 THEN $ 
    211     ncdf_transfer, cdfid, cdfidout, 'mbathy' 
     202  IF (where(zgr_varlist EQ 'hdept' ))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'hdept' 
     203  IF (where(zgr_varlist EQ 'hdepw' ))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'hdepw' 
     204  IF (where(zgr_varlist EQ 'e3tp'  ))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'e3tp', 'e3t_ps' 
     205  IF (where(zgr_varlist EQ 'e3wp'  ))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'e3wp', 'e3w_ps' 
     206  IF (where(zgr_varlist EQ 'e3t_ps'))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'e3t_ps' 
     207  IF (where(zgr_varlist EQ 'e3w_ps'))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'e3w_ps' 
     208  IF (where(zgr_varlist EQ 'mbathy'))[0] NE -1 THEN ncdf_transfer, cdfid, cdfidout, 'mbathy' 
     209; 
     210  IF keyword_set(key_e3_3d)  THEN BEGIN 
     211; get the bottom 
     212    CASE (ncdf_varinq(cdfid, 'mbathy')).ndims OF 
     213      2:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj] 
     214      3:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj, 1] 
     215      4:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj, 1, 1] 
     216    ENDCASE 
     217    bottom = 0L > ( long(bat) - 1L ) 
     218    bottom = lindgen(jpi, jpj) + jpi*jpj*temporary(bottom) 
     219; 
     220    CASE (ncdf_varinq(cdfid, 'e3t')).ndims OF 
     221      3:ncdf_varget, cdfid, 'e3t', res, count = [jpi, jpj, jpk] 
     222      4:ncdf_varget, cdfid, 'e3t', res, count = [jpi, jpj, jpk, 1] 
     223    ENDCASE 
     224    ncdf_varput, cdfidout, 'e3t_ps', (temporary(res))[bottom] * (bat NE 0L) 
     225; 
     226    CASE (ncdf_varinq(cdfid, 'e3w')).ndims OF 
     227      3:ncdf_varget, cdfid, 'e3w', res, count = [jpi, jpj, jpk] 
     228      4:ncdf_varget, cdfid, 'e3w', res, count = [jpi, jpj, jpk, 1] 
     229    ENDCASE 
     230    ncdf_varput, cdfidout, 'e3w_ps', (temporary(res))[bottom] * (bat NE 0L) 
     231  ENDIF 
     232; 
     233  IF keyword_set(key_gdep_3d)  THEN BEGIN 
     234; get the bottom 
     235    CASE (ncdf_varinq(cdfid, 'mbathy')).ndims OF 
     236      2:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj] 
     237      3:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj, 1] 
     238      4:ncdf_varget, cdfid, 'mbathy', bat, count = [jpi, jpj, 1, 1] 
     239    ENDCASE 
     240    bottom = 0L > ( long(bat) - 1L ) 
     241    bottom = lindgen(jpi, jpj) + jpi*jpj*temporary(bottom) 
     242; 
     243    CASE (ncdf_varinq(cdfid, 'gdept')).ndims OF 
     244      3:ncdf_varget, cdfid, 'gdept', res, count = [jpi, jpj, jpk] 
     245      4:ncdf_varget, cdfid, 'gdept', res, count = [jpi, jpj, jpk, 1] 
     246    ENDCASE 
     247    ncdf_varput, cdfidout, 'hdept', (temporary(res))[bottom] * (bat NE 0L) 
     248; 
     249    bottom = jpi*jpj + temporary(bottom) 
     250    CASE (ncdf_varinq(cdfid, 'gdepw')).ndims OF 
     251      3:ncdf_varget, cdfid, 'gdepw', res, count = [jpi, jpj, jpk] 
     252      4:ncdf_varget, cdfid, 'gdepw', res, count = [jpi, jpj, jpk, 1] 
     253    ENDCASE 
     254    ncdf_varput, cdfidout, 'hdepw', (temporary(res))[bottom] * (bat NE 0L) 
     255  ENDIF 
    212256; 
    213257; mask 
     
    221265    FOR m = 0, 3 DO BEGIN 
    222266      CASE (ncdf_varinq(cdfid, msklist[m])).ndims OF 
    223         3:ncdf_varget, cdfid, msklist[m], zzz, offset = [0, 0, k] $ 
    224         , count = [jpi, jpj, 1] 
    225         4:ncdf_varget, cdfid, msklist[m], zzz, offset = [0, 0, k, 0] $ 
    226         , count = [jpi, jpj, 1, 1] 
     267        3:ncdf_varget, cdfid, msklist[m], zzz, offset = [0, 0, k   ], count = [jpi, jpj, 1] 
     268        4:ncdf_varget, cdfid, msklist[m], zzz, offset = [0, 0, k, 0], count = [jpi, jpj, 1, 1] 
    227269      ENDCASE 
    228       ncdf_varput, cdfidout, msklist[m], byte(temporary(zzz)) $ 
    229         , offset = [0, 0, k], count = [jpi, jpj, 1] 
     270      ncdf_varput, cdfidout, msklist[m], byte(temporary(zzz)), offset = [0, 0, k], count = [jpi, jpj, 1] 
    230271    ENDFOR 
    231272  ENDFOR 
Note: See TracChangeset for help on using the changeset viewer.