def create_continuous_period_test_files(path, period_units, period_length, num_periods, start_datetime, prefix='',
                                        suffix='_.mrf', prototype_file=None, make_year_dirs=False, no_files=False):
    """
    Fills a directory structure with files that have a continuous period interval between them
    using the specified parameters.
    Arguments:
        path -- base directory tree to populate.
        period_units -- unit size of each period in 'days', 'months', or 'years'.
        period_length -- the length of each period in the aforementioned units.
        num_periods -- the number of period files to create.
        start_date -- a datetime.datetime object with the desired start date.
        prefix -- (optional) a string to append to the beginning of each filename.
        suffix -- (optional) a string to append to the end of each filename.
        prototype_file -- (optional) a prototype file to create each copy from (otherwise creates just empty files).
        make_year_dirs -- (optional) choose to create separate year dirs for the created files instead of dumping them all
            in one dir.
        no_files -- (optional) returns a list of dates but creates no files.
    """
    if not no_files:
        make_dir_tree(path)
    # Keep track of each date so we can evaluate if a new year directory needs to be created.
    test_dates = []
    date = start_datetime
    year_dir = ''
    # Create a set of date intervals and corresponding dummy files
    for x in range(0, num_periods + 1):
        test_dates.append(date)
        if any(unit in period_units for unit in ('hours', 'minutes', 'seconds')):
            subdaily = True
        else:
            subdaily = False
        
        if not no_files:
            # Create year directory if requested
            if make_year_dirs and (not x or test_dates[-1].year != date.year):
                year_dir = str(date.year)
                make_dir_tree(os.path.join(path, year_dir))

            # Assemble new filename and create file, using prototype if specified
            if subdaily is True:
                time_string = str(date.hour).zfill(2) + str(date.minute).zfill(2) + str(date.second).zfill(2)
            else:
                time_string = ''
            filename = prefix + str(date.year) + str(date.timetuple().tm_yday).zfill(3) + time_string + suffix
            output_path = os.path.join(path, year_dir)
            output_file = os.path.join(output_path, filename)
            if prototype_file:
                try:
                    copyfile(prototype_file, output_file)
                except __HOLE__:
                    pass
            else:
                open(output_file, 'a').close()
        date += relativedelta(**{period_units: period_length})
    return test_dates
dataset/ETHPy150Open nasa-gibs/onearth/src/test/oe_test_utils.py/create_continuous_period_test_files