Loading scripts/cf_compliance/check_cf_compliance.py +24 −3 Original line number Diff line number Diff line Loading @@ -38,6 +38,16 @@ def first_netcdf_in_subdirs(parent_dir): return first_files def all_netcdf_in_subdirs(parent_dir): """Return all NetCDF files in each subdirectory.""" all_files = [] for subdir in glob.glob(os.path.join(parent_dir, "*/")): files = glob.glob(os.path.join(subdir, "*.nc")) files = [f for f in files if os.path.isfile(f)] if files: files.sort() all_files.extend(files) return all_files def check_cf_compliance(file_path, cf_version=None): """ Loading Loading @@ -96,9 +106,14 @@ def main(): export_csv = True elif arg.lower() == "--excel": export_excel = True elif arg.lower() =="--all": check_all=True elif not arg.startswith("--"): cf_version = arg if check_all: files_to_check = all_netcdf_in_subdirs(parent_dir) else: files_to_check = first_netcdf_in_subdirs(parent_dir) if not files_to_check: Loading Loading @@ -138,7 +153,13 @@ def main(): errors, warnings, infos = parse_cf_output(out + err) summary.append([os.path.basename(fpath), errors, warnings, infos, "PASS" if errors == 0 else "FAIL"]) summary.append([ os.path.basename(os.path.dirname(fpath)), # Folder os.path.basename(fpath), # File errors, warnings, infos, "PASS" if errors == 0 else "FAIL" ]) # Save detailed output with open(DETAILS_LOG, "a") as f: Loading @@ -149,7 +170,7 @@ def main(): f.write("\n") # Build summary table headers = ["File", "Errors", "Warnings", "Info", "Result"] headers = ["Folder", "File", "Errors", "Warnings", "Info", "Result"] table = tabulate(summary, headers, tablefmt="github") with open(SUMMARY_LOG, "a") as f: Loading Loading
scripts/cf_compliance/check_cf_compliance.py +24 −3 Original line number Diff line number Diff line Loading @@ -38,6 +38,16 @@ def first_netcdf_in_subdirs(parent_dir): return first_files def all_netcdf_in_subdirs(parent_dir): """Return all NetCDF files in each subdirectory.""" all_files = [] for subdir in glob.glob(os.path.join(parent_dir, "*/")): files = glob.glob(os.path.join(subdir, "*.nc")) files = [f for f in files if os.path.isfile(f)] if files: files.sort() all_files.extend(files) return all_files def check_cf_compliance(file_path, cf_version=None): """ Loading Loading @@ -96,9 +106,14 @@ def main(): export_csv = True elif arg.lower() == "--excel": export_excel = True elif arg.lower() =="--all": check_all=True elif not arg.startswith("--"): cf_version = arg if check_all: files_to_check = all_netcdf_in_subdirs(parent_dir) else: files_to_check = first_netcdf_in_subdirs(parent_dir) if not files_to_check: Loading Loading @@ -138,7 +153,13 @@ def main(): errors, warnings, infos = parse_cf_output(out + err) summary.append([os.path.basename(fpath), errors, warnings, infos, "PASS" if errors == 0 else "FAIL"]) summary.append([ os.path.basename(os.path.dirname(fpath)), # Folder os.path.basename(fpath), # File errors, warnings, infos, "PASS" if errors == 0 else "FAIL" ]) # Save detailed output with open(DETAILS_LOG, "a") as f: Loading @@ -149,7 +170,7 @@ def main(): f.write("\n") # Build summary table headers = ["File", "Errors", "Warnings", "Info", "Result"] headers = ["Folder", "File", "Errors", "Warnings", "Info", "Result"] table = tabulate(summary, headers, tablefmt="github") with open(SUMMARY_LOG, "a") as f: Loading