1.9 FGlob Objects

An FGlob object is an iterable object which iterates over filenames from a SiLK data store. It does this internally by calling the rwfglob program. The FGlob object assumes that the rwfglob program is in the PATH, and will throw an execption when used if not.

class FGlob( classname=None, type=None, sensors=None, start_date=None, end_date=None, data_rootdir=None, site_config_file=None)

Arguments are:

classname, if given, should be a string representing the class name. If not given, defaults based on the site configuration file.

type, if given, can be either a string representing a type name or comma-separated list of type names, or can be a list of strings representing type names. If not given, defaults based on the site configuration file.

sensors, if given, should be either a string representing a comma-separated list of sensor names or IDs, and integer representing a sensor ID, or a list of strings or integers representing sensor names or IDs. If not given, defaults to all sensors.

start_date, if given, should be either a string in the format YYYY/MM/DD[:HH], a date object, a datetime object (which will be used to the precision of one hour), or a time object (which is used for the given hour on the current date). If not given, defaults to start of current day.

end_date, if given, should be either a string in the format YYYY/MM/DD[:HH], a date object, a datetime object (which will be used to the precision of one hour), or a time object (which is used for the given hour on the current date). If not given, defaults to start_date. end_date cannot be used without a start_date.

data_rootdir, if given, should be a string representing the directory in which to find the packed SiLK data files. If not given, defaults to $SILK_DATA_ROOTDIR or the compiled-in default.

site_config_file, if given, should be a string representing the path of the site configuration file. If not given, defaults to $SILK_CONFIG_FILE or $SILK_DATA_ROOTDIR/silk.conf.

At least one of classname, type, sensors, start_date must be specified.

An FGlob object can be used as a standard iterator. For example:

for filename in FGlob(classname="all", start_date="2005/09/22"):
    for rec in SilkFile(filename):
        ...