def not_monotone_files(source_marker: str) -> FileList: """ List not monotone files related to a data source. File counted as not monotone if UT parameter is not monotone. :param source_marker: identificator of a data source. :return list of not monotone files. """ return [ filename for filename in all_files(source_marker) if not monotone('ut', filename, source_marker) ]
def monotone_files(source_marker: str) -> FileList: """ List monotone files related to a data source. File counted as monotone if UT parameter is monotone (nicely growing). :param source_marker: identificator of a data source. :return list of not monotone files. """ all_files_list = all_files(source_marker) not_monotone_files_list = not_monotone_files(source_marker) already_monotone = set(all_files_list).difference( set(not_monotone_files_list)) # Here do fixes on `not_monotone_files_list` files if needed return list(already_monotone)
def list_days(source_marker: str, filtered: bool = False) -> List[Tuple[int, int]]: """ List all days available for a data source. :param source_marker: identificator of a data source. :return list of tuples, where first element is a year and second is a day. """ files_list = all_files(source_marker) if not filtered else filtered_files( source_marker) path, parser_class, selector, features_extractor = resolve_data_source( source_marker) days_set = set() for file in files_list: features = features_extractor(file) days_set.add((int(features['year'], 10), int(features['day'], 10))) return list(days_set)
def test_all_nacs_files() -> None: files_list = all_files(DE2_SOURCE_NACS) assert len(files_list) == len(NACS_TEST_FILES_ALL) for filename in files_list: assert basename(filename) in NACS_TEST_FILES_ALL
def test_all_wats_files() -> None: files_list = all_files(DE2_SOURCE_WATS) assert len(files_list) == len(WATS_TEST_FILES_ALL) for filename in files_list: assert basename(filename) in WATS_TEST_FILES_ALL