;+
; NAME:
;	vu_filename
; PURPOSE:
;	Construct filename for tomography output file
; CATEGORY:
;	sat/idl/util/vupack
; CALLING SEQUENCE:
	FUNCTION vu_filename, prefix, time, marker=marker, root=root, format=format
; INPUTS:
;	prefix			scalar; type: string; default: 'nv3d' (plasma file)
;					'nv3d' or 'wson' (magnetic field file)
;	time			time to be coded into filename as a Carrington variable
; OPTIONAL INPUT PARAMETERS:
;	marker=marker	'marker' value coded into file name if not equal zero
;	format=format	scalar; type: string; default: '(F9.4)'
;					format used to code Carrington variable into filenamae
;	root=root		scalar; type: string; default: none
;					directory prefixed to constructed filename
; OUTPUTS:
;	result			scalar; type: string
;					filename
; INCLUDE:
	@compile_opt.pro			; On error, return to caller
; CALLS:
;	InitVar, vu_prefix, Carrington
; PROCEDURE:
; MODIFICATION HISTORY:
;	SEP-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
;-

InitVar, prefix, vu_prefix(/silent)
InitVar, time  , 0.0d0
InitVar, marker, 0
InitVar, format, '(F9.4)'

name = prefix+string(format=format,Carrington(time, /get_variable))

IF marker NE 0 THEN name += '_'+string(format='(I5.5)',marker)

IF IsType(root, /defined) THEN name = filepath(root=root, name)

RETURN, name  &  END
