From da62dba3228eee25593ec8632356e369285efe96 Mon Sep 17 00:00:00 2001 From: justin-richling Date: Fri, 31 Jan 2025 13:00:25 -0700 Subject: [PATCH] Update notification for starting plot types --- lib/adf_diag.py | 3 ++- lib/adf_info.py | 2 +- scripts/analysis/aerosol_gas_tables.py | 3 ++- scripts/analysis/amwg_table.py | 10 +++++++--- scripts/averaging/create_climo_files.py | 3 ++- scripts/plotting/cam_taylor_diagram.py | 3 ++- scripts/plotting/global_latlon_map.py | 3 ++- scripts/plotting/global_latlon_vect_map.py | 3 ++- scripts/plotting/global_mean_timeseries.py | 3 ++- scripts/plotting/meridional_mean.py | 3 ++- scripts/plotting/ozone_diagnostics.py | 4 ++++ scripts/plotting/polar_map.py | 3 ++- scripts/plotting/qbo.py | 3 ++- scripts/plotting/regional_map_multicase.py | 3 ++- scripts/plotting/tape_recorder.py | 3 ++- scripts/plotting/tem.py | 3 ++- scripts/plotting/zonal_mean.py | 4 +++- scripts/regridding/regrid_and_vert_interp.py | 3 ++- 18 files changed, 43 insertions(+), 19 deletions(-) diff --git a/lib/adf_diag.py b/lib/adf_diag.py index e65f9e7da..b27c921ee 100644 --- a/lib/adf_diag.py +++ b/lib/adf_diag.py @@ -328,7 +328,8 @@ def create_time_series(self, baseline=False): """ #Notify user that script has started: - print("\n Calculating CAM time series...") + msg = "\n Calculating CAM time series..." + print(f"{msg}\n{'-' * len(msg)}") global call_ncrcat diff --git a/lib/adf_info.py b/lib/adf_info.py index d0febfbc2..70ee46741 100644 --- a/lib/adf_info.py +++ b/lib/adf_info.py @@ -541,7 +541,7 @@ def __init__(self, config_file, debug=False): #Go ahead and make the diag plot location if it doesn't exist already diag_location = Path(plot_loc) if not diag_location.is_dir(): - print(f"\t INFO: Diagnostic Plot Location: {diag_location} not found, making new directory") + print(f"\n\tINFO: Diagnostic Plot Location: {diag_location} not found, making new directory") diag_location.mkdir(parents=True) #End for diff --git a/scripts/analysis/aerosol_gas_tables.py b/scripts/analysis/aerosol_gas_tables.py index 0ff2e0a23..774acfa16 100644 --- a/scripts/analysis/aerosol_gas_tables.py +++ b/scripts/analysis/aerosol_gas_tables.py @@ -98,7 +98,8 @@ def aerosol_gas_tables(adfobj): #Notify user that script has started: - print("\n Calculating chemistry/aerosol budget tables...") + msg = "\n Calculating chemistry/aerosol budget tables..." + print(f"{msg}\n{'-' * len(msg)}") # Inputs #------- diff --git a/scripts/analysis/amwg_table.py b/scripts/analysis/amwg_table.py index c8edfbb63..269feb5b4 100644 --- a/scripts/analysis/amwg_table.py +++ b/scripts/analysis/amwg_table.py @@ -97,6 +97,10 @@ def amwg_table(adf): # and then in time it is DJF JJA ANN + #Notify user that script has started: + msg = "\n Calculating AMWG variable tables..." + print(f"{msg}\n{'-' * len(msg)}") + # within each domain and season # the result is just a table of # VARIABLE-NAME, RUN VALUE, OBS VALUE, RUN-OBS, RMSE @@ -140,7 +144,7 @@ def amwg_table(adf): #Save the baseline to the first case's plots directory: output_locs.append(output_locs[0]) else: - print("AMWG table doesn't currently work with obs, so obs table won't be created.") + print("\t WARNING: AMWG table doesn't currently work with obs, so obs table won't be created.") #End if #----------------------------------------- @@ -164,7 +168,7 @@ def amwg_table(adf): adf.debug_log(f"DEBUG: location of files is {str(input_location)}") #Notify user that script has started: - print(f"\n Calculating AMWG variable table for '{case_name}'...") + print(f"\n Creating table for '{case_name}'...") #Create output file name: output_csv_file = output_location / f"amwg_table_{case_name}.csv" @@ -197,7 +201,7 @@ def amwg_table(adf): #TEMPORARY: For now, make sure only one file exists: if len(ts_files) != 1: - errmsg = " WARNING: Currently the AMWG table script can only handle one time series file per variable." + errmsg = "\t WARNING: Currently the AMWG table script can only handle one time series file per variable." errmsg += f" Multiple files were found for the variable '{var}', so it will be skipped." print(errmsg) continue diff --git a/scripts/averaging/create_climo_files.py b/scripts/averaging/create_climo_files.py index 8fb90a2b6..be01cca3a 100644 --- a/scripts/averaging/create_climo_files.py +++ b/scripts/averaging/create_climo_files.py @@ -59,7 +59,8 @@ def create_climo_files(adf, clobber=False, search=None): from adf_base import AdfError #Notify user that script has started: - print("\n Calculating CAM climatologies...") + msg = "\n Calculating CAM climatologies..." + print(f"{msg}\n{'-' * len(msg)}") # Set up multiprocessing pool to parallelize writing climo files. number_of_cpu = adf.num_procs # Get number of available processors from the ADF diff --git a/scripts/plotting/cam_taylor_diagram.py b/scripts/plotting/cam_taylor_diagram.py index 0a7b86f59..aa80b121c 100644 --- a/scripts/plotting/cam_taylor_diagram.py +++ b/scripts/plotting/cam_taylor_diagram.py @@ -34,7 +34,8 @@ def my_formatwarning(msg, *args, **kwargs): def cam_taylor_diagram(adfobj): #Notify user that script has started: - print("\n Generating Taylor Diagrams...") + msg = "\n Generating Taylor Diagrams..." + print(f"{msg}\n{'-' * len(msg)}") # Taylor diagrams currently don't work for model to obs comparison # If compare_obs is set to True, then skip this script: diff --git a/scripts/plotting/global_latlon_map.py b/scripts/plotting/global_latlon_map.py index 86a25b329..dfb604b23 100644 --- a/scripts/plotting/global_latlon_map.py +++ b/scripts/plotting/global_latlon_map.py @@ -93,7 +93,8 @@ def global_latlon_map(adfobj): """ #Notify user that script has started: - print("\n Generating lat/lon maps...") + msg = "\n Generating lat/lon maps..." + print(f"{msg}\n{'-' * len(msg)}") # # Use ADF api to get all necessary information diff --git a/scripts/plotting/global_latlon_vect_map.py b/scripts/plotting/global_latlon_vect_map.py index d98660506..c854308a7 100644 --- a/scripts/plotting/global_latlon_vect_map.py +++ b/scripts/plotting/global_latlon_vect_map.py @@ -46,7 +46,8 @@ def global_latlon_vect_map(adfobj): # - make plot #Notify user that script has started: - print("\n Generating lat/lon vector maps...") + msg = "\n Generating lat/lon vector maps..." + print(f"{msg}\n{'-' * len(msg)}") # # Use ADF api to get all necessary information diff --git a/scripts/plotting/global_mean_timeseries.py b/scripts/plotting/global_mean_timeseries.py index a28d86eb1..d24fa2715 100644 --- a/scripts/plotting/global_mean_timeseries.py +++ b/scripts/plotting/global_mean_timeseries.py @@ -32,7 +32,8 @@ def global_mean_timeseries(adfobj): """ #Notify user that script has started: - print("\n Generating global mean time series plots...") + msg = "\n Generating global mean time series plots..." + print(f"{msg}\n{'-' * len(msg)}") # Gather ADF configurations plot_loc = get_plot_loc(adfobj) diff --git a/scripts/plotting/meridional_mean.py b/scripts/plotting/meridional_mean.py index b781027ac..967e09a5b 100644 --- a/scripts/plotting/meridional_mean.py +++ b/scripts/plotting/meridional_mean.py @@ -22,7 +22,8 @@ def meridional_mean(adfobj): """ #Notify user that script has started: - print("\n Generating meridional mean plots...") + msg = "\n Generating meridional mean plots..." + print(f"{msg}\n{'-' * len(msg)}") #Extract needed quantities from ADF object: #----------------------------------------- diff --git a/scripts/plotting/ozone_diagnostics.py b/scripts/plotting/ozone_diagnostics.py index 5b40590b8..8d5fd7697 100755 --- a/scripts/plotting/ozone_diagnostics.py +++ b/scripts/plotting/ozone_diagnostics.py @@ -108,6 +108,10 @@ def my_formatwarning(msg, *args, **kwargs): warnings.formatwarning = my_formatwarning +#Notify user that script has started: +msg = "\n Generating ozone plots..." +print(f"{msg}\n{'-' * len(msg)}") + #----------------------------------------------------------------------------------------- #Lookup pertinent region info #----------------------------------------------------------------------------------------- diff --git a/scripts/plotting/polar_map.py b/scripts/plotting/polar_map.py index 3765f2224..a95464d0f 100644 --- a/scripts/plotting/polar_map.py +++ b/scripts/plotting/polar_map.py @@ -17,7 +17,8 @@ def polar_map(adfobj): [based on global_latlon_map.py] """ #Notify user that script has started: - print("\n Generating polar maps...") + msg = "\n Generating polar maps..." + print(f"{msg}\n{'-' * len(msg)}") # # Use ADF api to get all necessary information diff --git a/scripts/plotting/qbo.py b/scripts/plotting/qbo.py index a5ab9dddf..91a34cf55 100644 --- a/scripts/plotting/qbo.py +++ b/scripts/plotting/qbo.py @@ -30,7 +30,8 @@ def qbo(adfobj): """ #Notify user that script has started: - print("\n Generating qbo plots...") + msg = "\n Generating qbo plots..." + print(f"{msg}\n{'-' * len(msg)}") #Extract relevant info from the ADF: case_names = adfobj.get_cam_info('cam_case_name', required=True) diff --git a/scripts/plotting/regional_map_multicase.py b/scripts/plotting/regional_map_multicase.py index 0783dc664..956e2f006 100644 --- a/scripts/plotting/regional_map_multicase.py +++ b/scripts/plotting/regional_map_multicase.py @@ -57,7 +57,8 @@ def regional_map_multicase(adfobj): """ # Notify user that script has started: - print("\n Generating regional contour plots ...") + msg = "\n Generating regional contour plots ..." + print(f"{msg}\n{'-' * len(msg)}") # We need to know: # - Variable to plot diff --git a/scripts/plotting/tape_recorder.py b/scripts/plotting/tape_recorder.py index 03ebd6151..78b9031c5 100644 --- a/scripts/plotting/tape_recorder.py +++ b/scripts/plotting/tape_recorder.py @@ -30,7 +30,8 @@ def tape_recorder(adfobj): since a defualt set of obs are already being compared against in the tape recorder. """ #Notify user that script has started: - print("\n Generating tape recorder plots...") + msg = "\n Generating tape recorder plots..." + print(f"{msg}\n{'-' * len(msg)}") #Special ADF variable which contains the output paths for plots: plot_location = adfobj.plot_location diff --git a/scripts/plotting/tem.py b/scripts/plotting/tem.py index 7b5f1e4b1..a03fc5ffe 100644 --- a/scripts/plotting/tem.py +++ b/scripts/plotting/tem.py @@ -28,7 +28,8 @@ def tem(adf): """ #Notify user that script has started: - print("\n Generating TEM plots...") + msg = "\n Generating TEM plots..." + print(f"{msg}\n{'-' * len(msg)}") #Special ADF variable which contains the output paths for #all generated plots and tables for each case: diff --git a/scripts/plotting/zonal_mean.py b/scripts/plotting/zonal_mean.py index f78ec72f2..6fbfa93bc 100644 --- a/scripts/plotting/zonal_mean.py +++ b/scripts/plotting/zonal_mean.py @@ -42,7 +42,9 @@ def zonal_mean(adfobj): method to infer what the user wants. """ - print("\n Generating zonal mean plots...") + #Notify user that script has started: + msg = "\n Generating zonal mean plots..." + print(f"{msg}\n{'-' * len(msg)}") var_list = adfobj.diag_var_list diff --git a/scripts/regridding/regrid_and_vert_interp.py b/scripts/regridding/regrid_and_vert_interp.py index af6d3677e..1961c6719 100644 --- a/scripts/regridding/regrid_and_vert_interp.py +++ b/scripts/regridding/regrid_and_vert_interp.py @@ -46,7 +46,8 @@ def regrid_and_vert_interp(adf): # - regrid one to the other (probably should be a choice) #Notify user that script has started: - print("\n Regridding CAM climatologies...") + msg = "\n Regridding CAM climatologies..." + print(f"{msg}\n{'-' * len(msg)}") #Extract needed quantities from ADF object: #-----------------------------------------