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

update meshmask related file for full compatibility with partial steps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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  
Note: See TracChangeset for help on using the changeset viewer.