Ignore:
Timestamp:
09/05/06 14:24:07 (18 years ago)
Author:
smasson
Message:

clean div, curl, grad + minors bugfix

Location:
trunk/SRC/ToBeReviewed/WIDGET
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/scanfile.pro

    r150 r167  
    114114    namedim[dimiq] = strlowcase(tmpname) 
    115115  ENDFOR 
    116 ; we are looking for a x dimension... 
    117   dimidx = where(namedim EQ 'x' OR strmid(namedim, 0, 3) EQ 'lon' OR strmid(namedim, 0, 3) EQ 'xi_' OR namedim EQ 'xt_i7_156') 
    118   dimidx = dimidx[0] 
    119   if dimidx EQ -1 then begin 
    120     print, 'one of the dimensions must have the name: ''x'' or ''lon...'' or ''xi_...'' or ''xt_i7_156''' 
    121     stop 
    122   endif 
    123 ; we are looking for a y dimension... 
    124   dimidy = where(namedim EQ 'y' OR strmid(namedim, 0, 3) EQ 'lat' OR strmid(namedim, 4) EQ 'eta_' OR namedim EQ 'yt_j6_75') 
    125   dimidy = dimidy[0] 
    126   if dimidy EQ -1 then begin 
    127     print, 'one of the dimensions must have the name: ''y'' or ''lat...'' or ''eta_...'' or ''yt_j6_75''' 
    128     stop 
    129   endif 
     116; we are looking for a x dimension with a name matching one of the following regular expression: 
     117  testname = ['longitude', 'lon', 'x', 'longitude*', 'lon*', 'x*', '*longitude*', '*lon*', '*x*'] 
     118  cnt = -1 
     119  ii = 0 
     120  WHILE cnt NE 1 AND ii LT n_elements(testname) DO BEGIN 
     121    dimidx = where(strmatch(namedim, testname[ii]) EQ 1, cnt) 
     122    ii = ii+1 
     123  ENDWHILE 
     124  CASE cnt OF 
     125    0:begin 
     126      dummy = report(['none of the dimensions name matches one of the following regular expression:' $ 
     127                      , '''longitude'', ''lon'', ''x'', ''longitude*'', ''lon*'', ''x*'', ''*longitude*'', ''*lon*'', ''*x*''' $ 
     128                      , ' => we cannot find the x dimension']) 
     129      stop 
     130    END 
     131    1:dimidx = dimidx[0] 
     132    ELSE:begin 
     133      dummy = report(['several (and not one unique) dimensions name matches the following regular expression:' $ 
     134                      , '''longitude'', ''lon'', ''x'', ''longitude*'', ''lon*'', ''x*'', ''*longitude*'', ''*lon*'', ''*x*''' $ 
     135                      , ' => we cannot find the x dimension']) 
     136      stop 
     137    END 
     138  ENDCASE 
     139; we are looking for a y dimension with a name matching one of the following regular expression: 
     140  testname = ['latitude', 'lat', 'y', 'latitude*', 'lat*', 'y*', 'eta_*', '*latitude*', '*lat*', '*y*'] 
     141  cnt = -1 
     142  ii = 0 
     143  WHILE cnt NE 1 AND ii LT n_elements(testname) DO BEGIN 
     144    dimidy = where(strmatch(namedim, testname[ii]) EQ 1, cnt) 
     145    ii = ii+1 
     146  ENDWHILE 
     147  CASE cnt OF 
     148    0:begin 
     149      dummy = report(['none of the dimensions name matches one of the following regular expression:' $ 
     150                      , '''latitude'', ''lat'', ''y'', ''latitude*'', ''lat*'', ''y*'', ''eta_*'', ''*latitude*'', ''*lat*'', ''*y*''' $ 
     151                      , ' => we cannot find the y dimension']) 
     152      stop 
     153    END 
     154    1:dimidy = dimidy[0] 
     155    ELSE:begin 
     156      dummy = report(['several (and not one unique) dimensions name matches the following regular expression:' $ 
     157                      , '''latitude'', ''lat'', ''y'', ''latitude*'', ''lat*'', ''y*'', ''eta_*'', ''*latitude*'', ''*lat*'', ''*y*''' $ 
     158                      , ' => we cannot find the x dimension']) 
     159      stop 
     160    END 
     161  ENDCASE 
    130162;------------------------------------------------------------ 
    131163; name of all variables 
     
    156188    varid = 0 
    157189    repeat BEGIN 
    158       invar = ncdf_varinq(cdfid, varid)  
    159       varid = varid+1 
    160     endrep until n_elements(invar.dim) EQ 1 AND invar.dim[0] EQ infile.recdim 
     190      IF varid LT infile.nvars THEN BEGIN 
     191        invar = ncdf_varinq(cdfid, varid)  
     192        varid = varid+1         
     193      ENDIF ELSE varid = 0 
     194    endrep until (n_elements(invar.dim) EQ 1 AND invar.dim[0] EQ infile.recdim) OR (varid EQ 0) 
    161195    varid = varid-1 
    162196; 
     
    179213        for attiq = 0, invar.natts-1 do attnames[attiq] = ncdf_attname(cdfid, varid, attiq) 
    180214        if (where(attnames EQ 'units'))[0] EQ -1 then BEGIN 
    181           dummy = report('Attribut ''units'' not found for the variable '+varid.name+'!C we create a fake calendar ...') 
     215          dummy = report('Attribut ''units'' not found for the variable '+invar.name+'!C we create a fake calendar ...') 
    182216          fakecal = 1 
    183217          time = date0fk + lindgen(jpt) 
     
    218252          ENDELSE 
    219253; 
    220 ; BEWARE we have to recuperate the calendar attribute and ajust TIME by consequence... 
    221 ; 
    222 ; 
    223 ; We pass TIME in IDL julian days 
     254; BEWARE we have to get back the calendar attribute and ajust time by consequence... 
     255; 
     256; 
     257; We pass time in IDL julian days 
    224258; 
    225259          unite = strlowcase(unite) 
  • trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_domain.pro

    r157 r167  
    662662; 
    663663  min2 = gdep2[indice1] 
    664   if indice2 EQ jpk-1 then BEGIN  
    665     max2 = max([gdept, gdepw]) 
    666     max2 = strtrim(string(max2, format = '(e8.0)'), 1) 
    667     max2 = float('1'+strmid(max2, 1))+float(max2) 
    668   ENDIF ELSE max2 = gdep1[indice2+1] 
    669   if max2 EQ min2 then max2 = min2+1 
     664  if indice2 EQ jpk-1 then max2 = ceil(max([gdept, gdepw])) $ 
     665  ELSE max2 = gdep1[indice2+1] 
     666  if floor(max2) LE floor(min2) then max2 = min2+1 
    670667  rien = cw_slider_pm(basez, value = (min2 > boxzoom[4]) > boxzoom[5] < max2 $ 
    671668                      , uvalue = {name:'depth2'}, minimum = min2, maximum =  max2 $ 
Note: See TracChangeset for help on using the changeset viewer.