Changeset 83


Ignore:
Timestamp:
04/04/08 16:08:47 (16 years ago)
Author:
kolasinski
Message:

improvements made for procs-read branche - tests made with post_it_tests.pro

Location:
branches/procs-read
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • branches/procs-read/com_eg.pro

    r41 r83  
    44; attributs horizontal+vertical means 
    55; 
    6 COMMON zm_att, box_h, depth_z, zoom_z, diaznl_idx, box_plot, legbox, hpa_max, hpa_min, max_spec, spec_win, vert_type, vert_mean,  vert_switch, glamboundary_box, msf_mean, name_level 
     6COMMON zm_att, box_h, depth_z, zoom_z, diaznl_idx, box_plot, legbox, pres_max, pres_min, max_spec, spec_win, vert_type, vert_mean,  vert_switch, glamboundary_box, msf_mean, name_level 
    77; 
    88; attributs hoevmoeller 
  • branches/procs-read/data_read.pro

    r81 r83  
    9191   ENDIF  
    9292 
    93 ; define horizontal domain 
    94 ; if needed, vertical domain will be defined in the call of read_ncdf 
     93; define horizontal domain and vertical domain if needed (used in 
     94; read_ncdf and update_data) 
    9595   box_plot = def_box(cmd.plt, dimplot, legbox, time_stride) 
    96    ;domdef, [box_plot[0:3], vert_mean], /MEMEINDICES 
    97    ;domdef, box_plot[0:3], /MEMEINDICES 
    9896   CASE n_elements(box_plot) OF 
    9997      4 : IF vert_switch GE 1 THEN box_plot = [box_plot, vert_mean] 
    100       6 : IF vert_switch GE 1 THEN box_plot = [box_plot[0:3], vert_mean] 
     98      6 : IF vert_switch GE 1 THEN box_plot = [box_plot[0:3],  vert_mean] ELSE box_plot = box_plot[0:3] 
    10199   ENDCASE 
     100; Exceptions : need to read all the vertical data (and not a subset) 
     101; for the pltz case. Other cases ?    
     102   IF plttyp EQ 'pltz' THEN box_plot = box_plot[0:3] 
    102103 
    103104; define timetsteps time1 and time2 
    104     IF hotyp NE '-' THEN BEGIN 
    105        time1 = delta_t1 
    106        timearr = compute_time(cmd.timave, cmd.date1, cmd.spec) 
    107        time2 =  timearr.count+delta_t1 
    108     ENDIF ELSE BEGIN 
    109        IF strpos(cmd.timave, 'mm') NE -1 THEN time1 = delta_t1+long(strmid(cmd.date1, 0, 2)) $ 
    110        ELSE  time1 = delta_t1 
    111        time2 = time1 
    112     ENDELSE 
     105   IF hotyp NE '-' THEN BEGIN 
     106      time1 = delta_t1+1 
     107      timearr = compute_time(cmd.timave, cmd.date1, cmd.spec) 
     108      time2 =  timearr.count+delta_t1 
     109      time = timearr.scale 
     110   ENDIF ELSE BEGIN 
     111      IF strpos(cmd.timave, 'mm') NE -1 THEN time1 = delta_t1+long(strmid(cmd.date1, 0, 2)) $ 
     112      ELSE  time1 = delta_t1+1 
     113      time2 = time1 
     114      time = time1 
     115   ENDELSE 
    113116 
    114117;    IF hotyp NE '-' THEN BEGIN   ; time serie 
     
    193196               idx = strpos(cmd.var, '=f(') 
    194197               var1 = strmid(cmd.var, 0, idx) 
    195                fldr1 = nc_read(file_name, var1, ncdf_db, $ 
     198               fldr1 = nc_read(file_name, var1, ncdf_db, BOXZOOM = box_plot, $ 
    196199                               TIME_1 = time1,  TIME_2 =  time2, ALL_DATA = all_data, _extra = ex) 
    197200               file_name1 = file_name 
     
    204207               IF strpos(cmd.var, '=f(next)') EQ -1 THEN BEGIN  ; type 1 y=f(x) on 1 line 
    205208                  var2 = strmid(cmd.var, idx+3, strlen(cmd.var)-idx-4) 
    206                   fldr2 = nc_read(file_name, var2, ncdf_db, $ 
     209                  fldr2 = nc_read(file_name, var2, ncdf_db, BOXZOOM = box_plot, $ 
    207210                                  TIME_1 = time1,  TIME_2 =  time2, ALL_DATA = all_data, _extra = ex) 
    208211                  datyp2 = datyp 
     
    336339   ENDCASE   
    337340 
    338 ; Pb with varexp which is always updated in read_ncdf 
    339 ; For Seb, varexp is the name of the file 
    340 ; For Eric, varexp is the name of the experiment 
    341    varexp = cmd.exp 
     341; Redefinition of time because it is updated in read_ncdf 
     342; Useful for pltt routine 
     343   IF hotyp NE '-' THEN BEGIN 
     344      time = timearr.scale 
     345   ENDIF ELSE BEGIN 
     346      time = time1 
     347   ENDELSE 
    342348 
    343349; if tkeavt, take log 
     
    379385            print,  '   Date1 = ',  cmd.date1 
    380386            sfild = fldr 
    381             bin_sigma, cmd, sfild    ;;;;;;;;;;;;;; prob 
     387            bin_sigma, cmd, sfild, BOXZOOM = box_plot, ALL_DATA = all_data ;;;;;;;;;;;;;; prob 
    382388            cumulative = cumulative + sfild.data 
    383389         ENDFOR 
     
    394400               print, 'data_read: Performing monthly bining. Indices: first, last, current = 0,',  timedim-1,  i 
    395401               sfild2 = {name: sfild.name, data: sfild.data(*, *, *, i), legend: sfild.legend, units: sfild.units, origin: sfild.origin, dim: sfild.dim-1} 
    396                bin_sigma, cmd, sfild2 
     402               bin_sigma, cmd, sfild2, BOXZOOM = box_plot, ALL_DATA = all_data  
    397403               fldrd(*, *, *, i)= sfild2.data 
    398404            ENDFOR  
     
    400406         ENDIF ELSE BEGIN 
    401407            sfild = fldr 
    402             bin_sigma, cmd, sfild 
     408            bin_sigma, cmd, sfild, BOXZOOM = box_plot, ALL_DATA = all_data 
     409            ;;bin_sigma, cmd, sfild, ALL_DATA = all_data 
    403410            fldr = sfild 
    404411         ENDELSE  
     
    438445 
    439446      ; perform difference 
    440  
    441447      diff = fldr.data-field2.data 
    442448      IF (where(fldr.data EQ valmask))[0] NE -1 THEN $ 
     
    455461       
    456462      ; read field2 
    457  
    458463      field2 = data_read(cmd, hotyp, plttyp, dimplot, iover, ALL_DATA = all_data, _extra = ex) 
    459464      IF n_elements(field2.data) EQ 1 THEN return, field2 
     
    496501          
    497502         ; decode field2 
    498  
    499503         argvar = strsplit(cmdl, '/', /EXTRACT) 
    500504 
     
    507511          
    508512         ; read field2 
    509  
    510513         field2 = data_read(cmd2, hotyp, plttyp, dimplot, iover, ALL_DATA = all_data, _extra = ex) 
    511514         IF n_elements(field2.data) EQ 1 THEN return, field2 
    512515 
    513516         ; perform difference 
    514  
    515517         diff = fldr.data-field2.data 
    516518         IF (where(fldr.data EQ valmask))[0] NE -1 THEN $ 
     
    533535ENDELSE 
    534536 
     537; Pb with varexp which is always updated in read_ncdf 
     538; For Seb, varexp is the name of the file. For Eric, varexp is the name of the experiment 
     539varexp = cmd.exp 
     540 
    535541IF debug_w THEN print, '       varexp before exit in data_read = ', varexp 
    536542IF debug_w THEN print, '   ...EXIT data_read' 
  • branches/procs-read/macros/make_depth.pro

    r68 r83  
    11;------------------------------------------------------------ 
    22;------------------------------------------------------------ 
    3 FUNCTION make_depth, file_name, ncdf_db,  TIME_1 = time_1,  TIME_2 =  time_2, ZMTYP = zmtyp 
     3FUNCTION make_depth, file_name, ncdf_db,  TIME_1 = time_1,  TIME_2 =  time_2, ZMTYP = zmtyp, _EXTRA = ex 
    44; 
    55@common 
  • branches/procs-read/macros/make_eos.pro

    r81 r83  
    5757; Read T and S 
    5858; 
    59    tn = nc_read(file_name,'votemper', ncdf_db, BOXZOOM = boxzoom, TIME_1 = time_1,  TIME_2 =  time_2, no_mean = 1) 
    60    sn = nc_read(file_name,'vosaline', ncdf_db, BOXZOOM = boxzoom, TIME_1 = time_1,  TIME_2 =  time_2, no_mean = 1) 
    61  
     59   tn = nc_read(file_name,'votemper', ncdf_db, BOXZOOM = boxzoom, TIME_1 = time_1,  TIME_2 =  time_2, ALL_DATA = all_data, no_mean = 1) 
     60   sn = nc_read(file_name,'vosaline', ncdf_db, BOXZOOM = boxzoom, TIME_1 = time_1,  TIME_2 =  time_2, ALL_DATA = all_data, no_mean = 1) 
     61   stop 
    6262; declarations 
    6363; 
  • branches/procs-read/macros/make_msf.pro

    r81 r83  
    1414; 
    1515   file_nam = strmid(file_name, 0, strlen(file_name)-4) 
    16    v = nc_read(file_nam+'V.nc','vomecrty', ncdf_db, BOXZOOM = boxzoom, TIME_1 = time_1,  TIME_2 =  time_2) 
     16   v = nc_read(file_nam+'V.nc','vomecrty', ncdf_db, BOXZOOM = boxzoom, TIME_1 = time_1,  TIME_2 =  time_2, ALL_DATA = all_data, _extra = ex) 
    1717 
    1818   idx = where(v.data EQ valmask) 
  • branches/procs-read/mask_z.pro

    r2 r83  
    169169               CASE strmid(cmd.plt, 1, 1) OF  
    170170                  't': boite_pltz = box_h 
    171                   ELSE : boite_pltz = [box_h, hpa_min, hpa_max ] 
     171                  ELSE :  boite_pltz = [box_h, pres_min, pres_max ] 
    172172               ENDCASE  
    173173            ENDIF  
     
    191191               CASE strmid(cmd.plt, 1, 1) OF  
    192192                  't': boite_pltz = zbox 
    193                   ELSE : IF n_elements(boite_pltz) EQ 4 THEN boite_pltz = [zbox, hpa_min, hpa_max] 
     193                  ELSE : IF n_elements(boite_pltz) EQ 4 THEN boite_pltz = [zbox, pres_min, pres_max] 
    194194               ENDCASE  
    195195            ENDIF  
  • branches/procs-read/msf_simple.pro

    r2 r83  
    4545;  integration zonale du flux ! 
    4646; 
    47 fm = total(z, 1)  
     47fm = total(z, 1, /NAN)  
    4848; 
    4949;  calcul de la msf en integrant depuis le fond 
  • branches/procs-read/nc_read.pro

    r81 r83  
    197197;   IF debug_w THEN print, '     ' 
    198198 
     199; Find the variable's attribute 
    199200   ncdf_getatt, directory+file_name, var_name, add_offset = add_offset, scale_factor = scale_factor, $ 
    200201    missing_value = missing_value, units = units, calendar = calendar, long_name = long_name 
    201202 
    202203; By default units for the Z axis are meters 
    203    IF n_elements(gdept) GT 1 AND name_level NE '-' THEN BEGIN 
    204      ncdf_getatt, directory+file_name, name_level, units = units_depth 
    205    ENDIF ELSE units_depth = 'm' 
     204   IF n_elements(gdept) GT 1 THEN BEGIN 
     205      IF name_level NE '-' THEN $ 
     206       ncdf_getatt, directory+file_name, name_level, units = units_depth ELSE units_depth = 'm' 
     207   ENDIF ELSE units_depth = '' 
     208 
     209; Check consistency between time_2 computed from param in cmdline and the max number 
     210; of time steps found in the file. 
     211   jpt_max = find_jptmax(file_name, IODIRECTORY = directory) 
     212   IF time_2-time_1+1 GT jpt_max THEN time_2 = time_1+jpt_max-1 
    206213 
    207214; Read the data with a call to read_ncdf 
     
    213220                        ZINVAR = zinvar, ZINDEX = zindex) 
    214221 
    215    print,  'zinvar', zinvar 
    216     
     222   IF debug_w THEN print,  '    zinvar=', zinvar 
    217223   IF debug_w THEN print, '     ' 
    218224;   IF debug_w THEN print, '     key=', key  
     
    227233   IF debug_w THEN print, '     key_shift in nc_read=', key_shift 
    228234;   IF debug_w THEN print, '     key_yreverse, firsty, lasty',key_yreverse, firsty, lasty 
    229    IF debug_w THEN print, '     key_yreverse',key_yreverse  
     235   IF debug_w THEN print, '     key_yreverse=',key_yreverse  
    230236   IF debug_w THEN print, '     ' 
    231237 
     
    603609;      IF att_txt EQ 'missing_value' OR att_txt EQ 'mask value' OR att_txt EQ '_FillValue' THEN ncdf_attget, cdfid, varid, att_txt, valmask 
    604610;   ENDFOR  
    605    valmask = missing_value 
    606 ; set valmask to 1.e20 
    607  
     611 
     612   IF size(missing_value,  /TYPE) EQ 4 OR size(missing_value,  /TYPE) EQ 5 THEN BEGIN 
     613      valmask = missing_value 
    608614; ensure valmask is positive 
    609  
    610    IF valmask LT 0 THEN BEGIN 
    611       print, '      *** Warning valmask is negative - changing sign: ', valmask 
    612       idx_t = where (field.data EQ valmask) 
    613       IF idx_t(0) NE -1 THEN field.data(idx_t) = -valmask 
    614       valmask = -valmask 
    615       idx_t=0 ; free memory 
     615      IF valmask LT 0 THEN BEGIN 
     616         print, '      *** Warning valmask is negative - changing sign: ', valmask 
     617         idx_t = where (field.data EQ valmask) 
     618         IF idx_t(0) NE -1 THEN field.data(idx_t) = -valmask 
     619         valmask = -valmask 
     620         idx_t=0                ; free memory 
     621      ENDIF 
    616622   ENDIF 
    617623 
  • branches/procs-read/plt_map.pro

    r70 r83  
    598598         ENDELSE  
    599599         END  
    600       'atm': BEGIN & type_yz = ',type_yz=''hPa''' & zoom_txt = ', zoom='+string(hpa_max) & END  
     600      'atm': BEGIN & type_yz = ',type_yz=''Pa''' & zoom_txt = ', zoom='+string(pres_max) & END  
    601601      ELSE:type_yz = '' 
    602602   ENDCASE  
     
    802802               IF vecplot EQ 0 THEN BEGIN  
    803803 
    804                   IF cmd.var EQ 'vozonbsf' THEN xindstr = ', /xindex' ELSE xindstr = '' 
     804                  IF cmd.var EQ 'vozonbsf' THEN xindstr = ', /xindex' ELSE xindstr = ''   
    805805 
    806806                  pltcmd = 'pltz,{a:fld, d:'''+date_txt+''', n:'''+varlegend+'   '+legz+''', u:'''+field.units+''', g:'''+vargrid+'''}'+mincmd+maxcmd+intcmd+',/'+pltztyp+', boite=boite_pltz'+zoom_txt+com_strplt+xindstr 
  • branches/procs-read/trends.pro

    r81 r83  
    375375      ENDELSE 
    376376   ENDIF  
    377  
    378    return, fld 
    379377    
    380378   IF debug_w THEN print, '   Vargrid : ',  vargrid 
    381379   IF debug_w THEN print, '   Leaving trends.pro' 
    382380 
     381   return, fld 
     382 
    383383END   
    384384       
  • branches/procs-read/update_data.pro

    r81 r83  
    1818      END 
    1919       
    20       ;; fichier 2d : surface (dimz = 0 or 1) 
     20      ;; fichier 2d : surface (n_elements(gdept) = 0 or 1) 
    2121      2: BEGIN 
    2222         print, '    Found ', vname, ' (2D data) from file'        
     
    3838      END  
    3939       
    40       ;; fichier 3d : 2 cas = 1/ 2d espace + temps 2/ 3d espace (dimz > 1) 
     40      ;; fichier 3d : 2 cas = 1/ 2d espace + temps 2/ 3d espace (n_elements(gdept) > 1) 
    4141      3: BEGIN 
    4242         IF jpt EQ 1 THEN BEGIN 
     
    7979               CASE vert_type OF 
    8080                  'z': BEGIN    
    81                      zmean = grossemoyenne(tab, 'z', boite = vert_mean, /NAN) 
     81                     zmean = grossemoyenne(tab, 'z', boite = boxzoom, /NAN) 
    8282                     suffix = ' averaged in ['+strtrim(string(long(vert_mean(0))), 2)+zunits+','+strtrim(string(long(vert_mean(1))), 2)+zunits+']' 
    8383                  END  
    8484                  'level': BEGIN ; case level (zindex) 
    85                      zmean = grossemoyenne(temporary(tab), 'z', boite = vert_mean, /zindex, /NAN) 
     85                     zmean = grossemoyenne(temporary(tab), 'z', boite = boxzoom, /zindex, /NAN) 
    8686                     suffix = ' averaged in '+vert_type+' ['+strtrim(string(long(vert_mean(0))), 2)+','+strtrim(string(long(vert_mean(1))), 2)+']' 
    8787                  END  
  • branches/procs-read/yfx.pro

    r71 r83  
    3535               IF debug_w THEN print, '   cmd1_back = ', cmd1_back 
    3636               IF debug_w THEN print, '   cmd2_back = ', cmd2_back 
    37                IF debug_w THEN print, '   grid1_full = ', grid1_full 
    38                IF debug_w THEN print, '   grid2_full = ', grid2_full 
     37               IF debug_w AND sw_diffg THEN print, '   grid1_full = ', grid1_full 
     38               IF debug_w AND sw_diffg THEN print, '   grid2_full = ', grid2_full 
    3939               IF sw_diffg EQ 1 THEN BEGIN 
    4040                  jptb = jpt 
Note: See TracChangeset for help on using the changeset viewer.