function ff_tostr, desc, file = file
;+
; NAME:
;	FF_TOSTR
;
; PURPOSE:
;	Convert a SMEI image descriptor string to a structure.
;
; CATEGORY:
;	UTILS
;
; CALLING SEQUENCE:
;	ff_str = ff_tostr(desc)
;
;
; INPUTS:
;	desc	string	The descriptor string (from img_hdr.txt).
;
; OUTPUTS:
;	ff_str	struct	The {ff_data} structure derived.
;
; MODIFICATION HISTORY:
;	Original (extracted from FF_SUMMARY): 20/4/10; SJT
;-

yr = 0l & day = 0l
h0 = 0l & m0 = 0l &  s0 = 0l
d = 0. & nax1 = 0l & nax2 = 0l & nax3 = 0 & f1p = ''

reads, desc, yr, day, h0, m0, d, nax1, nax2, nax3, $
  f1p, format = $
  "(I5,I4,I2,1x,I2,F7.0,I5,1x,I4,1x,i1,1x,A)"

f1ps = strsplit(f1p, ' ', /extract, count = nstr)

f1 = f1ps[0]
if nstr eq 2 then project = f1ps[1] $
else begin
    smei_msg, /warn, $
      "Obsolete img_hdr.txt found, remake it to get " + $
      "projection information"
    project = "       "
endelse

jd0 = doy2jd([yr, day, h0, m0, s0])

case n_elements(file) of
    0: fs = strarr(2)
    1: fs = [file_dirname(file), file_basename(file)]
    2: fs = file
    else: begin
        smei_msg, /warn, "File name has too many elements using [0:1]"
        fs = file[0:1]
    end
endcase

rv = {ff_data, $
      fname: fs[1], $
      dir: fs[0], $
      stime: jd0, $
      durn: d, $
      flags: f1, $
      project: project, $
      size: [nax1, nax2, nax3]}

return, rv

end
