DATAFILENAME

Function DATAFILENAME returns the data file names of the highest version numbers during a given time period. If there are several files with the same date and version then the normal string comparison is used, so the file in the older data system version in the .01cd-directory is selected over .01-directory and .DAT-file is selected over .dat1-file. Notice that empty files are discarded. There are two versions of this same function. The recent one should works in both data system versions, but it is not very exhaustedly tested. Actually this version works only with the latest data directory structure (e.g. /data/soho/

IDL doc_library comment

FUNCTION DataFileName

Example:

        datfiles=DataFileName(title='File Selection',root='/data/cepac/')

 Parameters:

        None

 Keywords:

        TITLE   The title of the main window. String.
        
        ROOT    The root directory of the data directory tree. String
                or array of strings. Default is '/data/soho/' if
                DSVERSION > "1" else default is '/dat/cepac/'.

        START   Start time of the time period. String. E.g. '130496'
                or '13041996'.

        STOP    Stopping time of the time period in format 'ddmmyy' or
                'ddmmyyyy'. String. E.g. '140496' or '14041996'.

        DATATYPE The type of the data. String. Fixed type strings e.g.
                'LED Light Raw' or a sub string in a file name that
                isolates the data type without contradiction among all of
                the data type file names.

        UNDERCOVER Set this keyword and the process goes without widgets,
                IF at least the keywords START, STOP and DATATYPE are given.
                Default values are used for other parameters if not given.

        RROOT   Return the root directory of the data directory tree. Only
                with widget.

        RSTART  Return the start time of the time period. String. E.g. '130496'
                or '13041996'. Only with widget.

        RSTOP   Return stopping time of the time period. String.
                E.g. '140496' or '14041996'. Only with widget.

        RDATATYPE Return the type of the data. String. Fixed type strings e.g.
                'LED Light Raw' or a sub string in a file name that
                isolates the data type without contradiction among all of
                the data type file names. Only with widget.

        DSVERSION Data system version. Default depends on the running
                machine (host). "Old" system version is "1" (helium) and
                all the others are new ("2" (xenon, castor ...)).

        RDSVERSION Return data system version used.

        DLEVEL  Data level (1, 2 or 3). String. Default is "3" if
                DSVERSION > "1".

        RDLEVEL Return data level used. String.

        DFORMAT Data format (10, 30, 40 or 50). String. Default is "10" if
                DSVERSION > "1".

        RDFORMAT Data format used. String.

        DSOURCE  Data source ('cd', 'rl', 'tm', 'ql'). String. Default is "cd".

        RDSOURCE Returns the data source used. String.

        MUTE     Suppresses on-screen messages.

 Restrictions:

        Assumes that there are 'which'- and 'tcsh'-commands to be called
        from the os-level.

 Notices:

        One wolf pit is the name and the location of the data type file.
        The procedure "DataFileName" in helium and in xenon are the same
        except the data type file names and the directory it resides are
        different. This is not a pleasant situation. I know that the code
        should be the same in both computers and the information of the
        name of the file should be somewhere outside of this procedure.

        Parameter files are read from the directory: '/usr/srl/pro/para/'.

        Uses unix commands: 'ls', 'grep', 'cut', 'echo', 'chmod', 'which'
        and 'tcsh'.

 Modifications:

        Jun  9, 1997    Export Level 2 data types added. MT

        Jun 19, 1997    In some occasions several files for the same day was
                        returned. Fixed. MT

        Oct 17, 1997    Keywords RSTART, RSTOP, RROOT and RDATATYPE for
                        the selections returning added. MT

        Mar 10, 1998    Root may be an array of strings. MT.

        Mar 24, 2000    Works for new and old dataversions. The default
                        data system version is determined by deducing
                        the name of the computer (host). MT.

        Jun 26, 2000    New keywords: DLEVEL, RDLEVEL, DFORMAT and RDFORMAT.
                        MT. Data types put into several files depending on the
                        level and format.

        Mar 02, 2001    New keywords: DSOURCE, RDSOURCE. More data sources.
                        Works only in data version higher than 1. MT.

        Mar 05, 2001    Added some default parametres and help texts in widget
                        mode. MT.

        Nov 23, 2001    Default data format made to work also under cover.

        Feb 17, 2005    Added keyword 'MUTE' (ER).