find_log_file¶
-
Data_Reduction.DSN.logs.
find_log_file
(logdir, prefix, year, midfix, doy, suffix, max_look_back)¶ Find a generic log file.
Notes
Tries the current date and then work backwards as much as ‘max_look_back’ days until one is found. The pseudo-code for this is:
initialize output list to empty count = 0 # look bad only max_look_back days while output list is empty form name pattern if name pattern has * result = glob(pattern) if result is not empty: return result elif max_look_back exceeded: return empty result else: try an earlier date else: while log name == None: see if file exists if yes: return log name as a list elif max_look_back exceeded: return empty list else: try an earlier date return output list
- :param logdirstring
Full path to the directory with the log(s)
- :param prefixstring
Whatever precides the date, such as ‘PESD-pm-‘. Could include ‘*’
- :param yearint
Four digit year
- :param midfixstring
What, if anything, that goes between the year andd the day of year. Could be ‘’.
- :param doyint
Day of year, no leading zero(s)
- :param suffixstring
The rest of the pattern. Could include ‘*’.
- :param max_look_backint
Number of days before the specified DOY to look for the file
- Returns
list File names of the latest file fitting the pattern