From 09950dec3214795af6c933f6c7c89f7affa410bf Mon Sep 17 00:00:00 2001 From: Mads Christian Lund Date: Mon, 12 Aug 2024 15:55:57 +0200 Subject: [PATCH] Updated docstring in create_bufr_files.py --- .../postprocess/create_bufr_files.py | 34 ++++++++++++------- src/pypromice/postprocess/get_bufr.py | 5 +-- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/pypromice/postprocess/create_bufr_files.py b/src/pypromice/postprocess/create_bufr_files.py index f542a8d0..a6cb7842 100644 --- a/src/pypromice/postprocess/create_bufr_files.py +++ b/src/pypromice/postprocess/create_bufr_files.py @@ -27,15 +27,25 @@ def create_bufr_files( """ Generate hourly bufr files from the for all input files - :param input_files: Paths to csv l3 hourly data files - :param station_configuration_root: Root directory containing station configuration toml files - :param period_start: Datetime string for period start. Eg '2024-01-01T00:00' or '20240101 - :param period_end: Datetime string for period end - :param output_root: Output dir for both bufr files for individual stations and compiled. Organized in two sub directories. - :param override: If False: Skip a period if the compiled output file exists. - :param break_on_error: If True: Stop processing if an error occurs - :param output_filename_suffix: Suffix for the compiled output file - :return: + Parameters + ---------- + input_files + Paths to csv l3 hourly data files + station_configuration_root + Root directory containing station configuration toml files + period_start + Datetime string for period start. Eg '2024-01-01T00:00' or '20240101 + period_end + Datetime string for period end + output_root + Output dir for both bufr files for individual stations and compiled. Organized in two sub directories. + override + If False: Skip a period if the compiled output file exists. + break_on_error + If True: Stop processing if an error occurs + output_filename_suffix + Suffix for the compiled output file + """ periods = pd.date_range(period_start, period_end, freq="H") output_individual_root = output_root / "individual" @@ -82,6 +92,7 @@ def create_bufr_files( # %% + def main(): import argparse import glob @@ -101,9 +112,7 @@ def main(): main_logger.addHandler(main_handler) main_logger.setLevel(logging.INFO) - parser = argparse.ArgumentParser( - "Create BUFR files from L3 tx .csv files." - ) + parser = argparse.ArgumentParser("Create BUFR files from L3 tx .csv files.") parser.add_argument( "--input_files", "--l3-filepath", @@ -164,5 +173,6 @@ def main(): station_configuration_root=args.station_configuration_root, ) + if __name__ == "__main__": main() diff --git a/src/pypromice/postprocess/get_bufr.py b/src/pypromice/postprocess/get_bufr.py index 48efa656..c59553e6 100644 --- a/src/pypromice/postprocess/get_bufr.py +++ b/src/pypromice/postprocess/get_bufr.py @@ -232,10 +232,7 @@ def get_bufr( positions_df.to_csv(positions_filepath, index_label="stid") logger.info("--------------------------------") - not_processed_count = ( - len(skipped) - + len(no_recent_data) - ) + not_processed_count = len(skipped) + len(no_recent_data) logger.info( "BUFR exported for {} of {} fpaths.".format( (len(input_files) - not_processed_count), len(input_files)