Changeset 8


Ignore:
Timestamp:
11/27/07 12:16:16 (16 years ago)
Author:
kolasinski
Message:

Simplify macro_read.pro with get_macro_def - Add def_macro_base_fld.pro and get_macro_def.pro on the server - Bugfix for def_grid.pro also

Location:
trunk/procs
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/procs/macro_read.pro

    r2 r8  
    66@com_eg 
    77 
    8    IF debug_w THEN print, 'keyword_set(ALL_DATA) : ', keyword_set(ALL_DATA) 
     8   IF debug_w THEN print, '   ENTER macro_read...' 
     9 
     10   IF debug_w THEN print, '    keyword_set(ALL_DATA) : ', keyword_set(ALL_DATA) 
    911; 
    1012; 1) read macro definition of field 
    1113; 
    12 ; name of macro file 
     14   @get_macro_def 
    1315 
    14    file_mac = hom_def+'fld_macros.def' 
    15    IF debug_w THEN print,  'var_name in macro_read: ', var_name  
    16 ;  
    17 ; special case for stddev monthly  
    18    stddev_mth =  '00' 
    19    pos_underscore =  strpos(var_name,'_') 
    20    IF pos_underscore GE 0 THEN BEGIN 
    21       stddev_mth = STRMID(var_name, pos_underscore + 1, 2) 
    22       var_name = STRMID(var_name, 0, pos_underscore) 
    23    ENDIF 
    24  
    25 ; find definition of macro 
    26    spawn, 'grep -i " '+STRMID(var_name, 2, 16)+' " '+file_mac, line 
    27    line = strcompress(strtrim(line[0], 2)) 
    28    length = strlen(line) 
    29  
    30    IF length EQ 0 THEN BEGIN 
    31       print, ' *** WARNING : No macro definition for field ', var_name, $ 
    32        ' in file ', file_mac 
    33       return, -1 
    34    ENDIF 
    35  
    36  
    37 ; Separate macro def and legend+unit 
    38 ; 
    39    leg_pos = strpos(line,'<') 
    40    line_def = STRMID(line,0,leg_pos) 
    41    line_def = strcompress(strtrim(line_def[0], 2)) 
    42    macro_def = str_sep(line_def, ' ') 
    43    nfields = n_elements(macro_def) 
    4416   print, '    Computing macro : ', macro_def 
    45 ; 
    46 ; extract legend and unit 
    47 ; 
    48    legend = extract_str(line, '<', '>') 
    49    unit = extract_str(line, '[', ']') 
    5017 
    5118; 2) loop to decode definition and build field 
     
    12693 
    12794 
     95   IF debug_w THEN print, '   ...EXIT macro_read' 
     96 
    12897 
    12998   return, fieldo 
Note: See TracChangeset for help on using the changeset viewer.