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/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 
Note: See TracChangeset for help on using the changeset viewer.