function comp_runs, run1, op, run2 ;+ ; ; function: comp_runs ; ; purpose: compare two ASP run dates ; ; author: rob@ncar, 3/95 ; ;============================================================================== ; ; Check number of parameters. ; if n_params() ne 3 then begin print print, "usage: ret = comp_runs(run1, op, run2)" print print, " Compare two ASP run dates." print, " Function returns 1 for true, 0 for false." print print, " Arguments" print, " run1 - first run ('mmmyy')" print, " op - operation ('lt'|'le'|'eq'|'ge'|'gt')" print, " run2 - second run ('mmmyy')" print print, " Keywords" print, " (none)" print print print, " ex: IDL> print, comp_runs('may94', 'lt', 'jun94')" print, " 1" print return, -1 endif ;- ; ; Check inputs. ; msg = 'error in run specification' if (strlen(run1) ne 5) or $ (strlen(run2) ne 5) then message, msg ; ; Get months. ; months = 'jan feb mar apr may jun jul aug sep oct nov dec' m1 = strpos(months, strmid(run1, 0, 3)) & if m1 lt 0 then message, msg m2 = strpos(months, strmid(run2, 0, 3)) & if m2 lt 0 then message, msg ; ; Get years. ; y1 = run_year(run1) & if (y1 lt 1990) or (y1 gt 2050) then message, msg y2 = run_year(run2) & if (y2 lt 1990) or (y2 gt 2050) then message, msg ; ; Set dates as floating point values. ; v1 = y1 + (m1 * 0.0025) v2 = y2 + (m2 * 0.0025) ; ; Compare the values and return the result. ; result = 0 if not execute( 'result = v1 ' + op + ' v2' ) then $ message, 'error in op specification' return, result end