Ignore:
Timestamp:
11/27/07 17:13:57 (16 years ago)
Author:
kolasinski
Message:

Add var_read_grd_file in def_grid and mesh_from_file - Define valmask if needed when the grid is read in mesh_from_file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/procs/meshes/mesh_from_file.pro

    r2 r9  
    66; masks made in data_read 
    77; 
     8   IF debug_w THEN print, '  ENTER mesh_from_file...' 
    89 
    910   IF strpos(ncdf_db, ':') GE 1 THEN directory = (str_sep(ncdf_db, ':'))[1] $ 
     
    1213   s_file = directory+file_name 
    1314 
    14    print,' Model inits for ', model, ' from file', s_file 
     15   print,'   Model inits for ', model, ' from file: ', s_file 
    1516 
    1617   sm_file = hom_idl+'grids/grids_'+model+'.nc'  
     
    2122      initncdf, s_file, GLAMBOUNDARY = glamboundary_box 
    2223 
    23       IF debug_w THEN print, ' Found mask from ',sm_file  
     24      print, '    Found mask from ',sm_file  
    2425 
    2526      tmask = byte(read_ncdf('sftlf', 0, 0, /timestep, file = sm_file, /nostruct)) 
     
    3536 
    3637   ENDIF ELSE BEGIN  
    37       initncdf, s_file, USEASMASK = var_name, GLAMBOUNDARY = glamboundary_box, ZAXISNAME = 'depth' 
     38      CASE var_name OF 
     39         '@@voenergy': var_local = 'so' 
     40         ELSE: var_local = var_read_grd_file 
     41      ENDCASE  
     42 
     43      ; find valmask 
     44      cdfidl=ncdf_open(s_file)  
     45      contient=ncdf_inquire(cdfidl) 
     46      varidl = ncdf_varid(cdfidl, var_local) 
     47      varcontient=ncdf_varinq(cdfidl, var_local) 
     48      valmask = 1.e20 
     49      FOR i = 0, varcontient.natts-1 DO BEGIN 
     50         att_txt = ncdf_attname(cdfidl, varidl, i) 
     51         IF att_txt EQ 'missing_value' OR att_txt EQ 'mask value' OR att_txt EQ '_FillValue' THEN ncdf_attget, cdfidl, varidl, att_txt, valmask 
     52         IF debug_w THEN print, 'valmask found = ',valmask  
     53      ENDFOR  
     54      ncdf_close, cdfidl 
     55      ; read grid 
     56      initncdf, s_file, USEASMASK = var_local, missing_value = valmask, GLAMBOUNDARY = glamboundary_box, ZAXISNAME = 'depth' 
     57 
    3858   ENDELSE  
    39  
    40    IF debug_w THEN print, 'vargrid = ',vargrid  
    4159 
    4260   key_offset = [0, 0, 0] 
     
    4563; 
    4664   diaznl_idx = 1 
     65   IF debug_w THEN print, '  ...EXIT mesh_from_file' 
    4766 
    4867  return 
Note: See TracChangeset for help on using the changeset viewer.