Changeset 198 for trunk/SRC/ToBeReviewed


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

add flexibility for the name of time attribut units

Location:
trunk/SRC/ToBeReviewed
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/ToBeReviewed/LECTURE/read_ncdf.pro

    r192 r198  
    253253      mots = str_sep(value, ' ') 
    254254      unite = mots[0] 
    255       IF unite NE 'seconds' AND unite NE 'hours' AND unite NE 'days' $ 
    256          AND unite NE 'months' AND unite NE 'years' THEN BEGIN 
     255      unite = strlowcase(unite) 
     256      IF strpos(unite, 's', strlen(unite)-1) NE -1 THEN unite = strmid(unite, 0, strlen(unite)-1) 
     257      IF strpos(unite, 'julian_') NE -1 THEN unite = strmid(unite, 7) 
     258      IF unite NE 'second' AND unite NE 'hour' AND unite NE 'day' $ 
     259         AND unite NE 'month' AND unite NE 'year' THEN BEGIN 
    257260        ncdf_close, cdfid 
    258261        return, report('time units does not start with seconds/hours/days/months/years') 
     
    265268      ncdf_varget, cdfid, timeid, time 
    266269      time = double(time) 
    267       unite = strlowcase(unite) 
    268       IF strpos(unite, 's', strlen(unite)-1) NE -1 THEN unite = strmid(unite, 0, strlen(unite)-1) 
    269       IF strpos(unite, 'julian_') NE -1 THEN unite = strmid(unite, 7) 
    270270      case unite of 
    271271        'second':time = julday(depart[1], depart[2], depart[0])+time/86400.d 
     
    300300      if lasttps[0] EQ -1 THEN BEGIN 
    301301        ncdf_close, cdfid 
    302         return, report('the time axis as no date before date 2: '+strtrim(jul2date(date2), 1)) 
     302        return, report('the time axis has no date before date 2: '+strtrim(jul2date(date2), 1)) 
    303303      endif 
    304304      lasttps = lasttps[n_elements(lasttps)-1] 
    305305      if lasttps LT firsttps then BEGIN 
    306306        ncdf_close, cdfid 
    307         return, report('the time axis as no dates between date1 and  date 2: '+strtrim(jul2date(date1), 1)+' '+strtrim(jul2date(date2), 1)) 
     307        return, report('the time axis has no dates between date1 and  date 2: '+strtrim(jul2date(date1), 1)+' '+strtrim(jul2date(date2), 1)) 
    308308      endif 
    309309    ENDELSE 
  • 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.