Ignore:
Timestamp:
12/01/06 12:05:05 (18 years ago)
Author:
smasson
Message:

add flexibility for the name of time attribut units

File:
1 edited

Legend:

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

    r181 r198  
    261261          mots = str_sep(value, ' ') 
    262262          unite = mots[0] 
     263          unite = strlowcase(unite) 
     264          IF strpos(unite, 's', strlen(unite)-1) NE -1 THEN unite = strmid(unite, 0, strlen(unite)-1) 
     265          IF strpos(unite, 'julian_') NE -1 THEN unite = strmid(unite, 7) 
    263266          err = 0 
    264           IF unite NE 'seconds' AND unite NE 'hours' AND unite NE 'days' $ 
    265              AND unite NE 'months' AND unite NE 'years' THEN BEGIN 
     267          IF unite NE 'second' AND unite NE 'hour' AND unite NE 'day' $ 
     268             AND unite NE 'month' AND unite NE 'year' THEN BEGIN 
    266269            dummy = report('time units does not start with seconds/hours/days/months/years') 
    267270            err = 1 
    268271          ENDIF 
    269           err = err + 1 - stregex(value, '[^ ]* since ([0-9]){4}-([0-9]){2}-([0-9]){2}.*', /boolean) 
     272          IF stregex(value, '[^ ]* since ([0-9]){4}-([0-9]){2}-([0-9]){2}.*', /boolean) EQ 0 THEN BEGIN 
     273            dummy = report('attribut units of time has not the good format: [^ ]* since ([0-9]){4}-([0-9]){2}-([0-9]){2}.*') 
     274            err = 1 
     275          ENDIF 
    270276          IF err GT 0 THEN BEGIN  
    271             dummy = report('attribut units of time has not the good format: [^ ]* since ([0-9]){4}-([0-9]){2}-([0-9]){2}.*') 
    272277            fakecal = 1 
    273278            time = date0fk + lindgen(1>jpt) 
     
    301306; We pass time in IDL julian days 
    302307; 
    303             unite = strlowcase(unite) 
    304             IF strpos(unite, 's', strlen(unite)-1) NE -1 THEN unite = strmid(unite, 0, strlen(unite)-1) 
    305             IF strpos(unite, 'julian_') NE -1 THEN unite = strmid(unite, 7) 
    306308            case unite of 
    307309              'second':time = julday(debut[1], debut[2], debut[0])+time/86400.d 
Note: See TracChangeset for help on using the changeset viewer.