From 2fb792458f66c56664a42b0ee3071e2a5645e915 Mon Sep 17 00:00:00 2001 From: Brian Medeiros Date: Mon, 8 Jan 2024 13:25:14 -0700 Subject: [PATCH] addressing code review comments --- lib/adf_diag.py | 6 +++--- lib/adf_variable_defaults.yaml | 2 +- scripts/analysis/amwg_table.py | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/adf_diag.py b/lib/adf_diag.py index 951f3352c..2dff57f85 100644 --- a/lib/adf_diag.py +++ b/lib/adf_diag.py @@ -1040,7 +1040,7 @@ def derive_variables(self, vars_to_derive=None, ts_dir=None, overwrite=None): print( f"[{__name__}] Warning: PRECT file was found and overwrite is False. Will use existing file." ) - return None + continue # append PRECC to the file containing PRECL os.system(f"ncks -A -v PRECC {constit_files[0]} {constit_files[1]}") # create new file with the sum of PRECC and PRECL @@ -1073,10 +1073,10 @@ def derive_variables(self, vars_to_derive=None, ts_dir=None, overwrite=None): print( f"[{__name__}] Warning: RESTOM file was found and overwrite is False. Will use existing file." ) - return None + continue # append FSNT to the file containing FLNT os.system(f"ncks -A -v FLNT {constit_files[0]} {constit_files[1]}") - # create new file with the sum of FLNT and FSNT + # create new file with the difference of FLNT and FSNT os.system( f"ncap2 -s 'RESTOM=(FSNT-FLNT)' {constit_files[1]} {derived_file}" ) diff --git a/lib/adf_variable_defaults.yaml b/lib/adf_variable_defaults.yaml index b39ba0a0c..244d61e7c 100644 --- a/lib/adf_variable_defaults.yaml +++ b/lib/adf_variable_defaults.yaml @@ -685,7 +685,7 @@ QRS: #+++++++++++++++++ RESTOM: colormap: "RdBu_r" - contour_levels_range: [-10, 10, 0.5] + contour_levels_range: [-100, 100, 5] diff_colormap: "seismic" diff_contour_range: [-10, 10, 0.5] scale_factor: 1 diff --git a/scripts/analysis/amwg_table.py b/scripts/analysis/amwg_table.py index 1c7564f35..286573770 100644 --- a/scripts/analysis/amwg_table.py +++ b/scripts/analysis/amwg_table.py @@ -295,9 +295,7 @@ def amwg_table(adf): #---------------------------- if 'RESTOM' in var_list: table_df = pd.read_csv(output_csv_file) - idx = table_df.index[table_df['variable'] == 'RESTOM'].tolist()[0] table_df = pd.concat([table_df[table_df['variable'] == 'RESTOM'], table_df]).reset_index(drop = True) - table_df = table_df.drop([idx+1]).reset_index(drop=True) table_df = table_df.drop_duplicates() table_df.to_csv(output_csv_file, header=cols, index=False) #End if